offset between 2 axes when using plotyy

3 views (last 30 days)
Win co
Win co on 10 Jun 2014
Edited: dpb on 10 Jun 2014
Hi everyone, I have a problem of plotyy display. In fullscreen mode, 2 axes are superimposed correctly, when I try to modify some details with "plot tools and dock figure" (eg: label size) and re-display the figure in fullscreen mode, there is an offset between 2 axes (cf. fig). I would like to know how to re-fix axes position?
Kind regards, Winn

Accepted Answer

dpb
dpb on 10 Jun 2014
Edited: dpb on 10 Jun 2014
Never seen that symptom before; then again I don't use the plot tools menu much.
It looks like somehow dragged the RH axes lower position or perhaps there's an automated adjustment of spacing when change the font size drastically.
In modifying plotyy properties, one needs must remember there are two independent axes overlaid so have to make sure whatever happens to change the position or properties of one are reflected on the other relative to positions, x-ticks, etc., ...
To fix this, retrieve the 'position' coordinates of each axes and reset the bottom and height values (2nd and 4th entries) of the RH axes to those of the left. I'll assume you have the two axes handles as hA --
p1=get(hA(1),'position'); % LH axes position
p2=get(hA(2),'position'); % and RH...
p2(2)=p1(2); p2(4)=p1(4); % fixup the RH bottom, height
set(hA(2),'position',p2) % and reset
ADDENDUM
Actually, the above is far more complex than needs be--simply reset the RH to the LH values (or vice versa, depending on which one wants to keep)--
set(hA(2),'position',get(hA(1),'position'))
  1 Comment
Win co
Win co on 10 Jun 2014
Big thank for your attention to my problem. I've tried this tip and it seems to work correctly by now.

Sign in to comment.

More Answers (0)

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!