6
votes

I have recently upgraded to gnuplot 5 and have been unable to produce dashed lines using the TikZ terminal. Running these commands:

set term tikz
set output "test.tex"
test

produce dashed line types in gnuplot 4.6 (first image), but only solid ones in gnuplot 5 (second image). Is there a way to fix this without downgrading?

I have tried setting different values for the dashlength terminal option, but that didn't help.

1

1 Answers

8
votes

With 5.0 gnuplot has changed its way to deal with dashed lines. All line types are solid by default, this is what the test command shows you.

To enable dashed lines, use the new dashtype keyword, e.g

plot for [i=1:4] i*x dashtype i

That works for all terminals which support dashed lines.

Note, that with dashtype you can also specify your own dash patterns.

Example script:

set terminal lua tikz linewidth 3 standalone
set output 'dash.tex'    
unset key

set linetype 1 dashtype 2
set linetype 2 dashtype '..-'
set linetype 3 dashtype (2,2,4,4,6,6)
plot for [i=1:3] i*x

enter image description here