gpt4 book ai didi

matlab - 在 MATLAB 中将文本放入非事件轴

转载 作者:太空宇宙 更新时间:2023-11-03 19:26:59 30 4
gpt4 key购买 nike

例如,大多数 MATLAB 绘图命令允许您指定作用于哪些轴

plot (x,y) 

在当前轴上绘图,但是

plot(Ax, x, y) 

将在轴 Ax 中绘制。

同样,您可以标记非事件轴的 x 轴或 y 轴

xlabel(Ax, 'this label goes on the x-axis of Ax whether or not Ax == gca')

但文本命令似乎不支持此功能。有没有办法将文本放入非事件轴?

我问是因为这个顺序:

currentAxes = gca;
axes(Ax); %MLINT warning here
text(x,y,'this text ends up on axes Ax now');
axes(currentAxes); %MLINT warning here

将抛出 MLINT 警告,指出在脚本函数中调用 axes(axes_handle) 速度很慢。

最佳答案

在调用文本命令时使用'Parent'属性

text(x,y,'text','Parent', Ax)

关于matlab - 在 MATLAB 中将文本放入非事件轴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3760515/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com