Thanks in advance.
Davide
- -
[[[[ to unsubscribe from info-gnuplot, send an email with body
unsubscribe info-gnuplot
to majo...@dartmouth.edu
]]]]
There are two things you could be meaning with this:
1) a single y axis, but ticked and labelled both on the left and right
side of the graph
2) two independent y axes with different ranges and properties.
gnuplot can do both, but for 1), there are some surprises and
limitations hidden in the corners. Check out commands:
set y2tics
set y2range
set ytics nomirror
plot 'datafile' axes x1y2
--
Hans-Bernhard Broeker (bro...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
gnuplot 3.7 allows you to use both the left and right sides of the plot as y
axes. This is done by means of a duplicate set of commands and options --
for each "set y..." command, there is also a "set y2..." command, and each
command that accepts "y" as an option also accepts "y2". (The "y" axis is
drawn on the left, the "y2" on the right.) There is also an "axes" option
on the "plot" command that lets you plot data against the y2 axis; "help
plot axes" gives you the details. (One thing to note: The tics on the y
axis are also drawn on the right by default. When you have a different
scale on the right, these "mirrored" tics can lead to confusion. You can
prevent this with "set ytics nomirror".)
The top "x2" axis can similarly be used independently of the bottom "x"
axis.
However you may not want to use the y2 axis, or you may want to use more
than two axes. In these cases you can create additional axes by using the
"multiplot" feature, overlaying a "y-axis-only" plot on the plot with the
data. You have to worry about spacing and alignment, and you have to turn
off a lot of things -- particularly labels drawn on the first "plot" that
you don't want repeated on the second. For example:
set multiplot
set bmargin 4
set tmargin 3
set size .9,1
set origin .1,0
set ylabel 'y label' 1
set xlabel 'x label'
set title 'Example of Second Y Axis'
plot x
set origin 0,0
set border 2
set noxtics
set xlabel
set ylabel 'y3 label' 0
set title
set ytics nomirror
set yrange [0:50]
set nokey
plot -10
set nomultiplot
The final "plot -10" just plots the function "y=-10". Since the specified
y-range doesn't include that value, nothing is plotted (which is what we
want for the axis-only plot).
Rather than explaining what all commands and options do, I'll let you read
about them in the on-line "help" :-)
One other comment: With this scheme, all data must be plotted with the
first "plot" command -- this means that if you have data that really should
be plotted against the extra y-axis, you'll have to work out the
transformation between the axes and plot the second data using that
transformation. This can be done in the "using" option for the "plot"
command. In the above example, the transformation would be y = .4 * y3 - 10
(where "y3" is the value on the "extra" axis). This could be implemented as
f(y) = .4 * y - 10
plot 'data1' title 'uses y axis', 'data2' using 1:(f($2)) title 'uses y3
axis'
[You can in fact plot data with the second "plot" command, but now an
additional problem must be solved: how to align the x axes of the two
plots. This is possible, but quite tricky. It's easier to plot all the
data in a single "plot".]
I hope this isn't too much more than you wanted to know :-)
Dick Crawford, aka craw...@arete.com