【问题标题】:Plotting time series with different colors绘制不同颜色的时间序列
【发布时间】:2013-09-12 02:15:56
【问题描述】:

我想绘制一些时间序列数据,其中每个数据点都有一个标签。

假设我的时间序列有 365 个点。我想用它们各自的颜色绘制这些 365 点。它们不是空间点。所以我可以有一条线,线段可以有不同的颜色。

【问题讨论】:

    标签: matlab plot


    【解决方案1】:

    从文件交换中签出3D colored line plot 和\或Colored line or scatter plot

    或者如果你想自己做,你可以使用surface

    x=linspace(-10,10,256);
    y=sin(x);
    c=1:numel(x);
    colormap(jet(256)); % or whatever colormap you want
    surface('XData',  [x(:) x(:)],'YData',[y(:) y(:)],...
            'ZData',0*[x(:) x(:)],'CData',[c(:) c(:)],'EdgeColor','flat');
    

    您可以在surface 属性here 上阅读更多信息。

    【讨论】:

    • 抱歉跑题了,但想不到this image哈哈哈。不错的情节 +1!
    猜你喜欢
    • 2016-07-27
    • 2021-03-24
    • 2018-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多