Re: Aligning multiple x axes



Hi Ethan,

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...@xxxxxxxxxxxxxxxx (Ethan Merritt) wrote:
In article <95634378-a2f6-4c55-bc2d-1c5b8cc54...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Mike McTernan  <Michael.McTer...@xxxxxxxxx> wrote:

Hello,

I'm attempting to plot some data using time/date on x1 and data labels
on x2.  

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.



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

--
Ethan A Merritt

.



Relevant Pages

  • Y Axis Label is Cutoff
    ... I have made a scatter plot with a line of best fit. ... axes under the fields for Value Axis and Value Axis. ... the problem of the Y axis title getting cutoff. ...
    (microsoft.public.excel.charting)
  • X Axis alignment problem
    ... I wish to plot all this data on the same plot - the left Y axis for y1 ... The two X axes are no longer aligned and they shouldn't necessarily be - ... data to plot for x<0 in a logplot). ...
    (comp.soft-sys.matlab)
  • Aligning multiple x axes
    ... I'm attempting to plot some data using time/date on x1 and data labels ... that the autoscaling of the x1 axes is not reflected in ...
    (comp.graphics.apps.gnuplot)
  • Re: Using
    ... instruction with it to set the desired axis. ... See also AXES. ... the plot of and not. ...
    (comp.soft-sys.matlab)
  • Re: Dual x-axis chart
    ... one can create 2 axes as long as there is at least one ... So, in your case, plot the data twice. ... series and in the resulting dialog box, from the Axis tab, select Secondary. ... Single Chart Dual Axis ...
    (microsoft.public.excel.charting)