Plot multiple axis in same plot (not plotyy)

16 views (last 30 days)
a
a on 25 Dec 2011
I want to plot only one vector with two Y axes. One axe will indicate "samples" and the other "time" (since each sample is actually some instant). I mean, the two axes are just proportional. I need both information in the same plot.
With plotyy (or creating "child" axes for a "parent figure") you then have to plot twice the same vector. One time for each axe.
But I wonder if there's an easier way, beacuse I want to use mesh and imagesc plotts and is inefficient to plot same vector twice in same figure.
thanks in advance

Answers (1)

Walter Roberson
Walter Roberson on 25 Dec 2011
You will still need multiple axis, as the tick labels apply to the whole axis. You should, however, not need to actually plot anything in the second axis, as you can set the axis ylim to the range you need.
It is probably easiest to still use plotyy() to set things up. You can plot just the min y to the max y but in "time" units. Then you can set set the ylim for that axis, and then you can remove the line object of the two points.

Categories

Find more on Two y-axis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!