Gnuplot seems to scale a plot to nice even numbers. So a plot that goes from x=0 to x=1030 as the right edge at x=1200 or so.
Which is great, so when I plot a simple graph from x=0 to x=1030 there's a bit of space on the right edge.
The same plot using "axis x2y2" assumes the right edge = 1030. Thus the plot is scaled by a factor of 1.15x or so.
My terminal type is qt.
To be clear the commands I used (after launching gnupot):
gnuplot> plot 'fs1.log' using 1:3 with lines
gnuplot> plot 'fs1.log' using 1:3 axis x2y2 with lines
The first is exactly correct, the second assumes that the right edge of the screen is x=1030 instead of x=1200.
Not really. What actually happens is that you failed to display what gnuplot assumes the right edge of the graph to be. That made you confuse the mirror of the unused left-side axis, y1, with the actually used axis, y2. To see what's actually happened, do
before your second 'plot' command.
Last edit: Hans-Bernhard Broeker 2017-03-26
I dug further and got some help on the #gnuplot irc channel.
I have a completely default gnuplot configuration. No customization by me. Just download gnuplot source, ./configure; make; make install.
So I launch gnuplot and:
gnuplot> show xrange
set xrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
gnuplot> show x2range
set x2range [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
Exactly what I expect. Now:
gnuplot> plot 'fs1.log' using 1:3
gnuplot> show xrange
set xrange [ * : * ] noreverse nowriteback # (currently [0.00000:2500.00] )
Now the EXACT same data plotted with axis x2y2:
gnuplot> plot 'fs1.log' using 1:3 axis x2y2
gnuplot> show x2range
set x2range [ * : * ] noreverse nowriteback # (currently [1.00000:2386.00] )
So presented with exactly the same data (columns 1 and 3 from fs1.log) I get fairly different graphs and ranges. Seems like a bug. I can force the xaxis, but it's somewhat annoying I can't autorange.
I don't have your data, but everything looks fine here (also 5.0pl6):
Grid lines match up on all axes, ranges are [0:2500] on both x and x2.
There something odd in "fs1.log"? Perhaps you can strip the file down to a few lines that reproduce the problem.
bill@left:~/tmp/migrate$ cat fs3.log
1 25348763
2 25348771
3 25358380
4 25375125
5 25382468
6 25385411
7 25390387
8 25399115
9 25400565
10 25402865
11 25407756
gnuplot> plot 'fs3.log' using 1:2 with lines
gnuplot> show xrange
set xrange [ * : * ] noreverse nowriteback # (currently [0.00000:12.0000] )
gnuplot> plot 'fs3.log' using 1:2 with lines axis x2y2
gnuplot> show x2range
set x2range [ * : * ] noreverse nowriteback # (currently [1.00000:11.0000] )
gnuplot>
That's 5.0.4 that comes with ubuntu, but same thing happens with a 5.0.6 I compiled myself.
Hm. The range changes if you set the x2tics/y2tics after plotting. They are then the same as x1/y1.
However the same happens to x1 / y1 if you unset them before plotting. The autoranging does not extend the range to the next "even" value for axes that have not tics. I guess this is indended behaviour. Makes some sense to me, at least.
The range is extended to the next major tic. If there are no tics then there is no extension.
Ah, so I get it, by default xtics and ytics is on, and x2tics and y2tics is off, thus the different in behavior. Makes sense I guess.
Seems a bit less surprising to have them both set if plotted against, but I can see it either way.
Thanks for the help, I guess the ticket should be closed.