I'd like to plot 3 functions in gnuplot while one of them has a higher sampling rate. The reason is that with that high sampling rate, dashed lines look somewhat compressed and become less distinguishable from each other. The function with the high sampling rate should be plotted with a solid line, the other 2 with dashed lines. Here's a working example:
set term postscript dashed
set out 'test1.ps'
iu = {0.,1.}
kmax = 1.e1
lami = 1.e-2
lamf = 1.e2
lmax = lamf
tau = 5.
fun(x) = (exp(-2. * iu * x * pi * kmax) * (-1. + exp(2. * iu * x * pi * (1. + kmax)))**2 * (atan(lamf / (2. * x * pi)) - atan(lami / (2. * x * pi)))) / (2. * (-1. + exp(2. * iu * x * pi))**2 * x * pi * kmax**0 * (lamf - lami))
funSimp(x) = (2. * tau)/(4. * x**2 * pi**2 + tau**2)
funSimpler(x) = atan(lmax / (2. * x * pi)) / (2. * x * pi)
set xr [1e-4:500]
set yr [1e-6:10]
set logscale x
set logscale y
set samples 10000
plot \
fun(x) / 20. t 'f' w l, \
funSimp(x) t 'fs' w l, \
funSimpler(x) / 20. t 'fss' w l
The dashed lines of 'fs' and 'fss' look different from the ones displayed on the legend. I tried to do
set samples 10000
plot \
fun(x) / 20. t 'f' w l
set samples 50
plot \
funSimp(x) t 'fs' w l ls 2, \
funSimpler(x) / 20. t 'fss' w l ls 3
but this doesn't work out, as only the first plot gets printed to the file. replot
also didn't help.
gnuplot 4.6.5, Win 7 64
This is a problem with the postscript terminal. It uses relative coordinates when drawing the lines representing function. Since this may give rounding errors, a moveto
is issued every 100 points. This interrupts the path, which becomes visible when using dash patterns. The patch in the sources is a one-liner.
As workaround I would suggest you to use the pdfcairo
which doesn't have this problems. Then you can convert the pdf to eps if you need that as output format. Or you could use the cairolatex eps
terminal.