필터 지우기
필터 지우기

multiple Y axes second axes blocking/obscuring first

조회 수: 1 (최근 30일)
Eric
Eric 2011년 12월 8일
i'm not sure what's going on here. you can see the axes for both and both axes re-scale when the lines are plotted. you just can't see the line for the "first" axis. using some of the example code from http://www.mathworks.com/help/techdoc/creating_plots/f1-11215.html
x1 = [0:.1:40];
y1 = 4.*cos(x1)./(x1+2);
x2 = [1:.2:20];
y2 = x2.^2./x2.^3;
figure('position',[1 1 6*72 8*72])
ax1=axes;
ax2=axes;
set(ax2,'YAxisLocation','right');
hl1 = line(x1,y1,'Color','r','Parent',ax1);
this also does it:
figure;
hl1 = line(x1,y1,'Color','r');
ax2 = axes('Position',get(gca,'Position'),'YAxisLocation','right');
which strikes me as EXTREMELY similar to the example. it seems to be dependent upon position and that position can't be any old vector but actually grabbed from gca or ax1, etc? still confused. i need to be able to draw the axes independently of using line()
if i redo the call to line(ax1) it plots correctly. maybe it's a refresh thing? do i have to refresh ax1, somehow? i set() stuff on axes pretty rampantly in my code, i can't be re-calling the plotting stuff everytime...
ideas? i'm in 7.9.1.671 (R2009b) Service Pack 1
thanks

채택된 답변

Eric
Eric 2011년 12월 8일
OH! 'color','none'
kinda strange that that's required, but okay.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by