如何在此多轴绘图中删除右侧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,'Color','k')发布于 2020-09-20 01:01:48
将轴的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')https://stackoverflow.com/questions/63969147
复制相似问题