Exact meaning of dashtype index in the Gnuplot 5.0?

谁都会走 提交于 2020-01-19 06:21:48

问题


I got a problem in Gnuplot 5.0, the dashtype index, such as ``set dashtype 1 (2,5,2,15)` in the manual.

My question is: what do these numbers in parenthesis exactly mean? I tried to change them to get a feeling, but it would be great to know the exact meaning.

My actual problem is, that simply using dashtype N, gives lines which look very different from the previous 4.6 version, unfortunately. I just try to reproduce the plots which were made in gnuplot 4.6.


回答1:


Those are numerical pairs

<solid length>,<empty length>

Those lengths are factors for an internal unit length. The dash pattern length further depends on the dashlength terminal option and the line width.

So, having

plot x dt (2,4,2,6)

plots a dash, an empty space twice as long, again a dash of same length and an empty space three times the dash length.

The actual length of the first dash is then

linewidth * terminal_linewidth * solid_length * terminal_dashlength * dash_unit

First example:

set terminal pngcairo size 600,50 dashlength 2 linewidth 1
set output 'dash1.png'
unset border; unset key; unset tics
plot 0 dt (2,4,2,6) lw 10

What might be confusing is, that some terminals like qt or wxt use rounded line ends by default (terminal option round), which are applied to every single dash, which distorts the actually given dash lengths:

set terminal pngcairo size 600,50 round dashlength 2 linewidth 1
set output 'dash2.png'
unset border; unset key; unset tics
plot 0 dt (2,4,2,6) lw 10

Terminal option square extends each dash by one line width at each end:

set terminal pngcairo size 600,50 square dashlength 2 linewidth 1
set output 'dash2.png'
unset border; unset key; unset tics
plot 0 dt (2,4,2,6) lw 10

In this last example, the final dash lengths are (4,2,4,4).

To get the behavior of the first example (exact dash length) also by default with other terminals, use the butt terminal option.




回答2:


from: http://www.gnuplot.info/gnuplot_cvs.pdf page 37

set dashtype 1 (2,5,2,15)

means: define stype 1 as:

solid 2
empty 5
solid 2
empty 15

(==     ==               )*


来源:https://stackoverflow.com/questions/29949876/exact-meaning-of-dashtype-index-in-the-gnuplot-5-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!