When you are using svg teminal (self-defined linestyle under postscript terminal will be talked in another post) this problem can solved easily. Fisrt, plot your file with solid line.
set term svg set output "sin.svg" plot sin(x) with line set output
After that, open the svg file with a text-editor, and find codes like the following:
<g id="gnuplot_plot_1" > <title>gnuplot_plot_1</title> <g style=" fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
Then change it to
<g id="gnuplot_plot_1" > <title>gnuplot_plot_1</title> <g style="stroke-dasharray: 7,2,2,2,2,2; fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
This time open your svg file, and you find the line sytle has changed. The follwing picture is a screen capture of "sin.svg".
Fig.1 Self-defined linestyle under gnuplot svg terminal |
To further understand this post, you may google "stroke-dasharray + svg".