I'm attempting to plot some data using time/date on x1 and data labels
on x2. Here's what I'm up to, using GNUplot 4.2.2:
set datafile separator ","
set ylabel "RAM" tc lt 1
set y2tics
set x2label "Subversion"
set xtics nomirror 86400
set ytics nomirror
set x2tics rotate 90
set xdata time
set timefmt "%s"
set format x "%d %b"
set xlabel "Build date"
set style data linespoints
plot 'data.csv' using 1:3:x2ticlabel(2) title 'RAM'
Sample data:
# UTC, SVN, RAM, ROM
1202988898,3940,5362,12076,
1202990644,3941,5320,11960,
1202995353,3943,5337,12019,
1202998851,3950,5287,11992,
1203000370,3963,5287,11992,
1203001115,3970,5287,11992,
1203002472,3980,5287,11992,
1203003949,3944,5282,11981,
1203005685,3944:3980M,5280,11976,
1203008653,3944:3985M,5326,17344
The plot is almost brilliant, showing the size of a build over time,
labelled with subversion versions at the top. The only problem is
that the autoscaling of the x1 axes (time/date) is not reflected in
the x2 axes such that the data labels are in the wrong places, that
is, in the correct order, but with a slightly different scale.
Does anyone know of a way lock the axes together such that the x2
labels align with the data points? Or should the use of x2ticlabel
imply this already?
Any suggestions greatly received,
Kind Regards,
Mike
The basic problem is that you didn't actually plot anything using the
x2 axis, so autoscaling doesn't mean anything because there are no
actual data points to scale. I'm surprised that it came out even half-way
reasonable.
The behaviour you want is requested frequently enough that it probably
should have its own entry in the FAQ, and maybe a new program feature to
support it more conveniently.
But in the interim, you could try something like:
set yrange [0:*]
set border front
plot 'data.csv' using 1:3 axes x1y1 title 'RAM', \
'' using 1:(0):x2ticlabel(2) axes x2y1 notitle
The second plot will consist of a line along y=0, but it will be
hidden behind the border. Because you use the same data points to
auto-scale the x1 plot and the x2 plot, the axis ranges should
line up.
--
Ethan A Merritt
Thanks for your prompt reply.
> The basic problem is that you didn't actually plot anything using the
> x2 axis... I'm surprised that it came out even half-way reasonable.
Because it came out so well, I overlooked this mistake - whoops!
I'll play around with adding data to both axes so that their alignment
matches, as per your suggestion.
Thanks,
Mike
On Feb 14, 7:11 pm, merr...@u.washington.edu (Ethan Merritt) wrote:
> In article <95634378-a2f6-4c55-bc2d-1c5b8cc54...@q21g2000hsa.googlegroups.com>,