help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting two y ranges


From: Quentin Spencer
Subject: Re: Plotting two y ranges
Date: Wed, 24 Oct 2007 14:10:07 -0500
User-agent: Thunderbird 2.0.0.5 (X11/20070727)

John W. Eaton wrote:
On 24-Oct-2007, Klaus Schneider wrote:

| Hello,
| | On Nov 24, 2004; 02:41am, Paul Kienzle wrote:
| > Use the gplot command and add "axes x1y2" to plot on the second y axis.
| >
| > - Paul
| >
| > On Nov 23, 2004, at 3:51 PM, Shaun Jackman wrote:
| >
| > > If I have, for example, time, distance, and veolicty vectors, how can
| > > I plot distance vs time on one y range (the axis on the left side) and
| > > velocity vs time on the other y range (the axis on the right side)?
| > > Currently I'm putting each in it's own sublot, but I'd like the two
| > > plots to be overlayed.
| | How to do this nowadays, since gplot is obsolete now? | | I think it must be something with property-value stuff, but there is no | property-value list in the documentation. I found something with | axis_obj.xaxislocation in __go_draw_axes__.m, and I checked get and | found "xaxislocation", but I cannot set it in a plot as | plot(x, y1, ";graph1;", x, y2, ";graph2;", "xaxislocation", "right"): | warning: set: invalid property `xaxislocation' | | Also,
| h1=axes()
| h2=axes()
| set(h2, "xaxislocation", "right")
| plot(h1, x, y1)
| plot(h2, x, y2)
| does not work.

I'm not sure what the proper way is to do this with just axes and line
or plot commands, but whatever it is, it is not completely implemented
in Octave yet, at least with the gnuplot backend.  One problem is that
Octave treats multiple plot objects as a gnuplot "multiplot", and then
the axes do not line up in gnuplot.  I think the fix for this would be
to somehow gather up the multiple axes that all have the same position
in the figure window and handle them simultaneously, but at the moment
I don't see a simple way to do that.  I think fixing this will have to
wait until after 3.0.  For now, I recommend that you write the data to
a file and plot it directly with gnuplot.


For what it's worth, the matlab equivalent function that we would need to implement for this is called "plotyy", and is documented here:

http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/plotyy.html

Quentin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]