如何解决有多个轴时如何从一个y轴删除值?
如何在此多轴图中从右y轴删除值? Code source.
figure
x1 = Pmax;
y1 = FuelCons;
line(x1,y1,'Color','r')
ax1 = gca; % current axes
ax1_pos = ax1.Position; % position of first axes
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
x2 = Cdrag;
y2 = FuelCons;
line(x2,y2,'Parent',ax2,'k')
解决方法
将轴的YColour
属性设置为none
可能是要考虑的一种实现。最好考虑gca
是代码中先前调用的最新轴。
figure
x1 = 0:0.1:40;
y1 = 4.*cos(x1)./(x1+2);
line(x1,y1,'Color','r')
ax1 = gca; % current axes
ax1.XColor = 'r';
ax1.YColor = 'r';
ax1_pos = ax1.Position; % position of first axes
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
set(gca,'YColor','none')
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。