【问题标题】:Different colors for error bars Matlab 2014b误差线的不同颜色 Matlab 2014b
【发布时间】:2015-07-03 22:41:58
【问题描述】:

我正在绘制误差线,并想用不同的颜色为每个误差线着色,以使绘图更易于解释。但是,由于我使用的是 matlab2014b,因此在线上的所有内容都已过时,因为错误栏系列不再有孩子。这是我正在使用的代码:

x=[1 2 3 4]
y=[0.5 0.3 0.45 0.36]
upperbound=y.*0.25
lowerbound=y.*0.15

fig1=figure  
e1=errorbar(x,y,lowerbound,upperbound,'x')

如果可能的话,我也想给中心点上色,在此先感谢。

【问题讨论】:

    标签: matlab colors


    【解决方案1】:

    也许您可以单独绘制每个误差线,例如:

    hold on
    for k = 1:length(x)
        e1 = errorbar(x(k),y(k),lowerbound(k),upperbound(k),'x');
        set(e1,'Color',rand(1,3))
        set(e1,'MarkerEdgeColor',rand(1,3))
    end
    

    有关如何更改线条样式、颜色等的更多信息,请参阅Errorbar Series Properties

    【讨论】:

      猜你喜欢
      • 2023-03-14
      • 1970-01-01
      • 2020-06-17
      • 2021-07-15
      • 2016-01-17
      • 2014-03-21
      • 2016-10-19
      • 1970-01-01
      相关资源
      最近更新 更多