offset between 2 axes when using plotyy

1 Ansicht (letzte 30 Tage)
Win co
Win co am 10 Jun. 2014
Bearbeitet: dpb am 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

Akzeptierte Antwort

dpb
dpb am 10 Jun. 2014
Bearbeitet: dpb am 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 Kommentar
Win co
Win co am 10 Jun. 2014
Big thank for your attention to my problem. I've tried this tip and it seems to work correctly by now.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Two y-axis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by