绘制不同颜色的时间序列 [英] Plotting time series with different colors

查看:140
本文介绍了绘制不同颜色的时间序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to plot some time series data where each data point has a label.

所以可以说我的时间序列有365点.我想用它们各自的颜色绘制这些365点.它们不是空间点.因此,我只能使用一条线,其中线段可以具有不同的颜色.

So lets say my time series has 365 points. I want to plot these 365 point with their respective colors. They are not spatial points. So I can just have a line where the segments of the line can have different color.

推荐答案

签出 3D彩色线条图和/或

check out 3D colored line plot and\or Colored line or scatter plot both from the file exchange.

,或者如果您想自己做,则可以使用surface:

or if you want to do it yourself you can use 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属性.

You can read more on surface properties here.

这篇关于绘制不同颜色的时间序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆