Re: How to plot graphs using secondary axis (plotyy does not zoom properly)



Hi John,

The issues you raise with PLOTYY have been addressed in R2008a. For versions
of MATLAB prior, there is no clean work around for getting ZOOM to work
properly, though there are MATLAB Central File Exchange postings which may
be able to point you in the right direction.

-I hope this helps.
Dan

---
Dan Sternberg
The MathWorks, Inc.

"John Lintern" <john.lintern@xxxxxxxxxxxxx> wrote in message
news:fsquh2$nja$1@xxxxxxxxxxxxxxxxxxxxx
I am trying to plot a single graph which has:

- 3 traces against a primary y axis
- 2 traces against a secondary y axis

I have been using plotyy only to find that when I zoom into
the plot, only one of the traces will zoom.

The other traces stay fully zoomed out at 100% - this is
useless to me !

I need to be able to zoom into the graph and have all
traces zoom at the same time and at the same scale, all
relative to one another.

Theres also a problem when using the 'Data Cursor' tool to
mark data points - the tool will only work on one trace.

Am I doing something wrong or is this the limitation of
plotyy ?

For info, my code for plotyy is shown below:

[AX,H1,H2] = plotyy
(timetrace,InputSpeed,timetrace,ThrottlePedal,'plot');
%AX(1) is primary y axis
%AX(2) is secondary y axis
%H1 is plot against primary y axis
%H2 is plot against secondary y axis
set(H1,'Color','k')
set(H2,'Color','b')
set(get(AX(2),'Ylabel'),'String','Throttle Position (%) /
CSC Position (mm)')
hold;
%plot(timetrace,OutputSpeed,'m','LineWidth',2);
[BX,H3,H4] = plotyy
(timetrace,OutputSpeed,timetrace,CSCPosition,'plot');
%BX(1) is primary y axis
%BX(2) is secondary y axis
%H3 is plot against primary y axis
%H4 is plot against secondary y axis
set(H3,'Color','m')
set(H4,'Color',[0 0.5 0])
set(BX(2),'YColor','b')
set(get(AX(2),'Ylabel'),'String','CSC Position')
plot(timetrace,EngineSpeed,'r','LineWidth',2);
set(AX(1),'YColor','k')
set(AX(2),'YColor','k')
set(BX(1),'YColor','k')
set(BX(2),'YColor','k')

yscale=get(AX(2),'YLim');
set(BX(2),'YLim',yscale);
ytick=get(AX(2),'YTick');
set(BX(2),'YTick',ytick);

Another issue is that when I use plotyy for the second time
(to plot CSCPosition), the secondary y axis becomes
different to the secondary y plotted the first time
(ThrottlePedal).

This is why I have to make the YLim and YTick settings for
the first trace equal to that of the second trace.

But even then the y tick marks are wrong.

There must be an easier and better method of plotting
multiple traces on primary and secondary y axis?

Even excel can do better than this !


.



Relevant Pages

  • Re: How to plot graphs using secondary axis (plotyy does not zoom properly)
    ... - 3 traces against a primary y axis ... I have been using plotyy only to find that when I zoom ... powerful and better documented tool (called plt) available ...
    (comp.soft-sys.matlab)
  • How to plot graphs using secondary axis (plotyy does not zoom properly)
    ... I am trying to plot a single graph which has: ... traces against a secondary y axis ... I have been using plotyy only to find that when I zoom into ...
    (comp.soft-sys.matlab)
  • Re: image to signal conversion
    ... seismic section there are large of traces side by sided ... i mean y axis represent timeand x ... shot refer to the number of traces" ... this mean each row pixel represent the sample per unit time and each ...
    (comp.soft-sys.matlab)
  • Re: plotting
    ... I think I tried plotyy before, it didn't help, it gave me 2 y-axis ... You can then use axis w/ the desired handle to modify either axis at will. ... with the same scale and a 3rd Y axis with a bigger scale. ... If having the two numerically the same y axes as one w/ an extra label or labeled jointly isn't adequate then I'm pretty sure there's a contribution at the File Exchange that adds more or you can look at ...
    (comp.soft-sys.matlab)
  • Re: image to signal conversion
    ... muhammad yafid wrote: ... seismic section there are large of traces side by sided ... i mean y axis represent time ... pixel in columnwise represent the shot instead of the real sample ...
    (comp.soft-sys.matlab)