PlotYY X axis doubled

Hello,
Can someone please let me know how can avoid to have the X axis doubled when i use the command PlotYY ?
I use PlotYY to plot two curves that have a different Y axis for each one, and the same X axis.
So my problem, is that the X axis appears twice in the graph, and then it is hard to read the X graduation.
Best,
Anas

답변 (3개)

Zhongxian pan
Zhongxian pan 2013년 8월 19일

1 개 추천

linkaxes(AX,'x');
set(AX(2),'XTickLabel',[]);
Leah
Leah 2013년 6월 25일

0 개 추천

you can turn it off by then you won't know if your xaxis consistent for each y axis. it's best to make them match
turn off (not advised)
[AX,H1,H2] = plotyy(...);
set(AX(2),'xticklab',[],'xtick',[])
make match
set(AX(2),'xtick',get(AX(1),'xtick'),'xticklab',get(AX(1),'xticklab'))

댓글 수: 3

ACHOURI ANAS
ACHOURI ANAS 2013년 6월 25일
Thank you very much, is it possible to move out the line axis too ? because even if the graduation is not doubled anymore, the X axis line is still doubled.
Leah
Leah 2013년 6월 25일
the horizontal line or the tick marks?
ACHOURI ANAS
ACHOURI ANAS 2013년 6월 26일
the tick marks are not doubled anymore, but the horizontal line is still doubled at the bottom of the plot.

댓글을 달려면 로그인하십시오.

Tom
Tom 2013년 6월 25일

0 개 추천

Moving one x axis to the top might make things clearer
AX = plotyy(...);
set(AX(2),'XAxisLocation','Top')

댓글 수: 3

ACHOURI ANAS
ACHOURI ANAS 2013년 6월 25일
thank you very much, it is a great idea, but the title become hidden by the x axis label on the top. is it possible to move the title label above the second X axis ?
Tom
Tom 2013년 6월 25일
You can, though it might start to go off the top of the figure, so then you'd need to move the axes down (basically, it might get messy).
Try:
set(AX(2),'XAxisLocation','Top')
hTitle = title(AX(2),'Title String');
Pos = get(hTitle,'Position');
Pos(2) = Pos(2)*1.02; %increase the height by 2%
set(hTitle,'Position',Pos)
ACHOURI ANAS
ACHOURI ANAS 2013년 6월 26일
ok, thank you very much

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Axis Labels에 대해 자세히 알아보기

질문:

2013년 6월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by