Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't the gnuplot grid extend over this whole plot?

Tags:

gnuplot

Using gnuplot 4.6 patchlevel 1, with the following commands,

set grid linewidth 1 linecolor rgb"#888888"
set datafile separator ","
plot for [n=2:100] "data.csv" using 1:(column(n)) with lines linewidth 2

and the following example data in the file "data.csv",

time,S1,S2
0,0.00015,0
0.1,0.0001357256127053939,1.427438729460607e-005
0.2,0.0001228096129616973,2.719038703830272e-005
0.3,0.0001111227331022577,3.887726689774233e-005
0.4,0.0001005480069053459,4.945199309465411e-005
0.5,9.097959895689501e-005,5.902040104310499e-005
0.6,8.232174541410396e-005,6.767825458589604e-005
0.7,7.448779556871142e-005,7.551220443128858e-005
0.8,6.739934461758323e-005,8.260065538241677e-005
0.9,6.098544896108986e-005,8.901455103891014e-005
1,5.518191617571635e-005,9.481808382428365e-005

the resulting plot looks this:

enter image description here

Question: why does the grid only extend partway from the bottom, and not cover the whole plot? I tried a considerable amount of experimentation with the set xtics and ytics commands, arguments to grid, and more, and have not been able to get the grid to cover the whole plot. What am I missing?

like image 765
mhucka Avatar asked Nov 04 '22 08:11

mhucka


1 Answers

Great question! In fact, the answer is that the grid does cover the whole plot. The problem is that the key is taking over. Try it again, but with an unset key in there before your plot command.

What's happening is that gnuplot is reserving space in the key for all of the columns which have no data. Nothing gets put in the space that was reserved since no reasonable data was found. Ultimately, this pushes the 2 lines that were visible out of the viewable canvas area as well.

I've reproduced this using the x11, png, postscript and pngcairo terminals.

Note that this behavior seems to be version dependent:

With gnuplot 4.4.2 (OS-X, png terminal)

enter image description here

With gnuplot 4.6.0 (OS-X, png terminal)

enter image description here

For those using gnuplot 4.4.4, perhaps there was a bug fix which made it work for gnuplot 4.4.4 and then a regression. It seems to persist into gnuplot 4.7.0 as well. I might file a bug report.

like image 123
mgilson Avatar answered Dec 03 '22 03:12

mgilson