How to set Xcolor=none for an x-axis

조회 수: 16 (최근 30일)
Jakob Sievers
Jakob Sievers 2014년 6월 28일
댓글: Jakob Sievers 2014년 6월 28일
Hi all
I am creating a new "axes" within an existing plot. I would like to remove the x-axis line of this new "axes" completely because it crosses the y-axis ticklabels of the existing plot. All solutions I have found so far involves setting the Xcolor property equal to that of the plot in general so as to make the new x-axis invisible but this will not solve my problem. Here is a small example:
figure
set(gcf,'color','w')
plot(rand(10,1))
pos2=get(gca,'pos');
pos2b=pos2;pos2b(3)=pos2b(3)*.8;
xlim2=get(gca,'xlim');
xlim2b=[xlim2(1) xlim2(2)*(pos2(3)/pos2b(3))];
set(gca,'position',pos2b,'yaxislocation','right')
axes('Position',pos2,'box','off',...
'Color','none','XColor','k','YColor','r',...
'xtick',[],'xlim',xlim2b,'yaxislocation','right');
I thought merely setting Xcolor='none' would do the trick but that property is not allowed so how do I solve this?

답변 (1개)

the cyclist
the cyclist 2014년 6월 28일
I can't check this at the moment, but is there a "visible" property that you can set to "off"?
  댓글 수: 1
Jakob Sievers
Jakob Sievers 2014년 6월 28일
Not an x-axis specific one as far as I can see. setting "visible" to "off" removes the whole inset "axes".

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

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by