Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Zooming with multiple axes

Subject: Zooming with multiple axes

From: Henrik

Date: 10 Aug, 2012 14:59:17

Message: 1 of 2

I have 3 different plots in a subplot with two different y-axes.
1. The left y-axis has a lot of data plotted with the style 'b.' (blue dots).
2. The right y-axis has a stem with a histogram with all the occurences of the left y-axis data.
3. The right y-axis also has a black line that goes through all the stem points to make it more visible.
they all share the same x-axis and have been linked with "linkaxes" with 'x' only
The left scale is about 0-250, while the right scale is about 0-140.

I've managed to plot it all very nicely so that all three plots have correct limits and are easily viewed, but the problems start when I want to zoom in the subplot. Sometimes only the left y-axis scales, sometimes only the right y-axis, depending on where in the subplot I click. It seems that there is a clickable layer on top of the data plots and when I click on the data that belongs to the right axis, it only zooms the right axis data, and vice versa for the left axis.

If i use linkaxes to link BOTH the y and x axes, the scale for the right y-axis is wrong (well it does look ok if I have enough data to make occurences reach over 100-ish, because then it's in the same order of magnitude as the left y-axis, but it could very well be much lower, and the stem+line for the histogram would be very flat at the bottom).
And really, what's the use of having two different y-axes if you link them togheter to the same max/min limits?

What I want now is some way of making the data in the plots 'un-targettable' or something, so that wherever I click in the subplot (be it click-zoom or drag-zoom) both y-axis scales are scaled with the same amount while still having different max/min limits from one another.

I hope this all makes sense. =)

Subject: Zooming with multiple axes

From: Bruno Luong

Date: 10 Aug, 2012 22:28:18

Message: 2 of 2

You can customize the zooming behavior 'ActionPostCallback' of zoom object (set the limit of the second axe in your specific case).

Bruno

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us