How to create dashed lines in gnuplot 5 using TikZ terminal?

I recently upgraded to gnuplot 5 and was unable to create dashed lines using the TikZ terminal. The execution of these commands:

set term tikz set output "test.tex" test 

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

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

+6
source share
1 answer

With 5.0, gnuplot has changed its way of working with dashed lines. By default, all string types are solid, and this is what the test command shows.

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

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

This works for all terminals that support dashed lines.

Note that with dashtype you can also specify your own dashes.

Sample 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

+6
source

Source: https://habr.com/ru/post/982287/


All Articles