MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]两个坐标轴怎么重合了? (https://www.labfans.com/bbs/showthread.php?t=6781)

豌豆花 2009-03-11 10:47

[求助]两个坐标轴怎么重合了?
 
下面的一段程序是要画两个坐标轴,可是为什么运行后第二个坐标轴还是和第一个坐标轴重合,而不是在top和right呢?哪里出错了呢?
X=1:5:50;
Y1=sin(X);
Y2=cos(X);
h1=plot(X,Y1,'r');
ax1=gca;
set(ax1,'XColor','r','YColor','r')
ax2=axes('Position',get(ax1,'Position'),...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'XColor','k','YColor','k');
h2=plot(X,Y2,'Color','k','parent',ax2);

zhyanchao 2009-03-11 22:25

回复: [求助]两个坐标轴怎么重合了?
 
在h2前面加hold on应该就可以了

豌豆花 2009-03-12 09:10

回复: [求助]两个坐标轴怎么重合了?
 
谢谢你的解答!:lol:


所有时间均为北京时间。现在的时间是 12:57

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.