我想設計一個函式,可以根據用戶的輸入引數('UpperLeft','UpperRight','LowerLeft','LowerRight')在圖形的右上角添加文字。我是這樣實作的:如果我想在左上角添加文字,我先得到圖中軸的最小x和最大y,然后用text(min_x, max_y, 'text')它來繪制。但我不知道什么函式可以得到最小 x 和最大 y。如果還有其他方法可以實作我想要的功能?
uj5u.com熱心網友回復:
x = 3*sin(linspace(0,10,100));
figure
plot(x)
xl = xlim
yl = ylim
% upper left (ish), you'll want to position the text a little down and to
% the right depending on the dimensions of the plot
text(xl(1), yl(2), 'text')

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/440853.html
