1

Hy everyone

I'm plotting a cumulative plot of up to 15 lines. To make it more readable and also readable printed black and white, I want to use different line types, but have a problem with that. First of, my script:

set terminal pdf
set output "Cumulative.pdf"
set autoscale yfix
set autoscale xfix
set key bottom right
set xlabel 'Something'
set ylabel 'Something else'
set style increment user
set style line 1  lc rgb '#372101' lw 3 lt 0 pt 0 ps 1
set style line 2  lc rgb '#FF8A9A' lw 3 lt 1 pt 1 ps 1
set style line 3  lc rgb '#7A4900' lw 3 lt 2 pt 2 ps 1
stats 'file1'
num1=STATS_records
stats 'file2'
num2=STATS_records
plot 0/0 notitle,\
'file1' u 2 : ((100.0/num1)) title '1' smooth cumulative,\
'file2' u 2 : ((100.0/num2)) title '2' smooth cumulative

My data files look something like this:

1 -54
2 -54
3 -71
4 -70
5 -71
6 -70

I would expect that Gnuplot uses the style that I previously set, but it does so only for the colour. The other options are ignored. When I add a 'with linespoints' or 'with points' I get the different point types. So far so good. What does not work with 'with lines' or 'with linespoints' is the line type. It's just the standard one. When I especially use 'lt x' in the plot command, it uses the xth line style, not the line type. I am wondering, it is possible to choose the line type with that sort of plot? It would be really helpful, as the point type would get lost easily in the graph. And if it is possible, is it also possible to make the line type consistent. What I mean is, if the points are very close to each other, that the line type is still readable. So that a dotted line type does not become a smooth line type, because you can't see the spaces anymore.

Any help is appreciated, even alternatives to make it more readable in black and white then with line or point types. Thanks!

Patrick
  • 275
  • 4
  • 14
  • In 4.6 this works fine for me if I use `set termoption dashed`, with version 5.0 you must add a `dashtype`. BTW: this can be reproduced with a script as short and simple as `set style increment user; set style line 1 lt 1; set style line 2 lt 2; plot x, 2*x` which doesn't require any data files and can be run by anyone. – Christoph Dec 16 '15 at 08:30
  • Maybe I wasn't clear enough, but the simple script that you propose of course works. The problem occurs if you use smooth cumulative. Then it doesn't work anymore. – Patrick Dec 16 '15 at 09:45
  • Your script works fine for me using 4.6.6 and `set terminal pdfcairo dashed`, and using the data you provided for both files, see http://i.stack.imgur.com/Rw9NC.png (yes, this is a png file created from gnuplot's output Cumulative.pdf). – Christoph Dec 16 '15 at 12:06
  • Thanks, dashtype works indeed. If I set it in the set style line line, I don't even need to set the option in set terminal. But why is linetype not used? That is a bit confusing. By the way, I use Gnuplot 5. – Patrick Dec 17 '15 at 12:17
  • That was one of the major changes in gnuplot 5: Dashed lines are set only with the `dashtype` option, the terminal options `dashed` and `solid` are ignored, and all `linetype`s are solid by default, see http://stackoverflow.com/a/19420678/2604213 – Christoph Dec 17 '15 at 12:58

0 Answers0