我有一些要更改的数字:
这是我通常的做法:
title('new title ');
xlhand = get(gca,'xlabel');
set(xlhand,'string','xlabel','fontsize',13);
ylhand = get(gca,'ylabel');
set(ylhand,'string','ylabel','fontsize',13);
set(gca,'FontSize',13);
它通常可以正常工作。但是,当我要编辑使用ploty函数制作的图时,它不起作用。唯一的影响是我正确的ylabel发生了变化。
我知道,由于我现在有两个ylabel,因此更改它们不会像正常绘制那样容易。但是,令我惊讶的是我无法更改xlabels和标题。这是为什么?
上面与plotxy函数相关的代码有什么问题?我该如何运作?该文档不包含任何相关信息。
我正在使用Matlab R2015a。
编辑:是的,我的意思是阴谋(我的问题有错别字)。以下是文档中的示例代码:
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
figure % new figure
plotyy(x,y1,x,y2)
从文档中不使用get
,set
:
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
figure % new figure
hAx = plotyy(x,y1,x,y2);
title('Multiple Decay Rates')
xlabel('Time (\musec)')
ylabel(hAx(1),'Slow Decay') % left y-axis
ylabel(hAx(2),'Fast Decay') % right y-axis
然后通过更改值
xlabel('New label','fontsize',10)
title('New Title','fontsize',10)
ylabel(hAx(2),'Fast Decay','fontsize',20)
hAx(1).FontSize=5
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句