使用线条时绘制参数函数(或其相应的数据块)的奇怪行为

Weird behavior on plotting parametric functions (or their corresponding datablock) when using lines

我在绘制参数函数时有一些奇怪的行为and/or它们在使用线条时对应的数据块。
该图似乎不遵守 linestyle(第 1 行),同时当比较来自函数或数据块(第 2 行)的图时,应用的默认 linetype 似乎相反。 奇怪的是,情节似乎从 linestyle(第 3 行)继承了 linewidth。 仅当使用 linecolor(第 4 行)时,图表看起来才正确。

这里是代码,在 5.2.85.4 rc1 版本下测试:

reset

set terminal pngcairo size 750,9.0 font ",10"
set output "parametric.png"

unset tics
unset border
set view equal xyz
set view ,,2
set view 100,30
set xyplane 0
set hidden3d

set parametric
set urange [0:2*pi]
set vrange [0:pi/2]

set style line 1 lc "red" lw 2

f(u,v) = cos(u)*cos(v)
g(u,v) = sin(u)*cos(v)
h(v)   = sin(v)

set table $hemisphere
    splot f(u,v), g(u,v), h(v)
unset table

set multiplot layout 4,2 columnsfirst
    splot f(u,v), g(u,v), h(v) w l ls -1 t "Using functions (with ls -1 )"
    splot f(u,v), g(u,v), h(v) w l lt  3 t "Using functions (with lt 3)"
    splot f(u,v), g(u,v), h(v) w l ls  1 t "Using functions (with custom ls 1)"
    splot f(u,v), g(u,v), h(v) w l lc "red" t "Using functions (with lc 'red')"
    splot $hemisphere w l ls -1 t "Using datablock (with ls -1)"
    splot $hemisphere w l lt  3 t "Using datablock (with lt 3)"
    splot $hemisphere w l ls  1 t "Using datablock (with custom ls 1)"
    splot $hemisphere w l lc "red" t "Using datablock (with lc 'red')"
unset multiplot 

此外,如果你仔细观察表面,它有一条反转的线段。

这里发生了什么?我错过了什么吗?

基本原因: 来自文档(来自 help hidden3d 的选定文本)

Syntax:
       set hidden3d {defaults} |
                    {{offset <offset>} | {nooffset}}
[...]

The first option, `offset`, influences the linetype used for lines on the
'back' side.  Normally, they are drawn in a linetype one index number higher
than the one used for the front, to make the two sides of the surface
distinguishable.  You can specify a different linetype offset to add
instead of the default 1, by `offset <offset>`.  Option `nooffset` stands for
`offset 0`, making the two sides of the surface use the same linetype.

请注意,与线型相反,没有提及线型。 hidden3d 算法执行一个复杂的过程,将颜色分配给明确基于数字线型的各个线段。密钥中行样本的生成更为通用。它显然无法准确复制 hidden3d 处于活动状态时发生的情况,所以我们称其为错误。

一条线段的颜色不对:我想这一定是某处的舍入错误造成的。视角甚至终端尺寸的微小变化都会导致伪影消失。

并没有真正帮助任何东西,但解释了为什么它是您看到它的方式: 在 gnuplot 5 中,线型的使用几乎补充了旧的线型机制。通过命令 set style increment user 有部分向后兼容性,它在许多地方触发,程序必须为 "next thing" 选择一种颜色,无论它是什么。但它并没有捕捉到涉及多种颜色的所有地方,而 hidden3d 就是其中之一。