是否可以更改 Matlab 绘图函数中的标记?

Is it possible to change markers in Matlab plot function?

我正在尝试使用 matlab plot 函数来创建绘图。然而,可用的标记是有限的。例如:

plot(x,y,'-o')

将使用圆形标记绘制。

但是,如果我想要带有箭头符号或字母的标记,这是不可能的。有谁知道有什么办法可以做到这一点?谢谢!

简答:如果你想要自定义标记,在其他绘图软件中制作绘图很方便,比如 tikz

长答案:

  1. 如果你想要一个简单的文本标记,例如字母 'A',则可能如下 (source)

    font = 'Lucida Sans Typewriter';  % choose a font
    
    m = 'A';  % choose desired character
    
    x = 0:.5:2*pi;    
    
    y = sin(x);    
    
    % Use TEXT to plot the character along the data    
    
    text(x,y,m,'fontname',font,'color','red')    
    
    % Manually set axis limits, since TEXT does not do this for you    
    
    xlim([min(x) max(x)])    
    
    ylim([min(y) max(y)])
    
  2. 如果你想要更复杂的标记,那么我在Whosebug上找到了一个例子