如何改变 matlab 图的线条颜色(如颜色图)? [英] How to vary the line color of a matlab plot (like colormap)?

查看:263
本文介绍了如何改变 matlab 图的线条颜色(如颜色图)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 2D 空间,其中定义了一个函数值(您可以将其视为流形).现在我使用 contourf 绘制函数值并将颜色图更改为比 jet 更柔和的颜色.目前看来还不错.

I have a 2D space in which a function value is defined (you can think of it as a manifold). Now I plotted the function value using contourf and changed the colormap to something softer than jet. So far it looks quite good.

现在我想在我的空间中绘制一条代表随时间变化的状态的线.这也可以使用 plot 命令.但我想要更多的改进:现在隐藏了一个额外的状态(值 0...50).我希望线条颜色根据这个隐藏状态改变.因此,从某种意义上说,将单独的颜色图应用于 plot 绘制的线条,例如在瀑布图中.

Now I want to draw a line representing the state over time in my space. That is also possible using the the plot command. But I want some more improvements: There is an additional state that is hidden for now (value 0...50). I would like the line color to change according to this hidden state. So in a sense to apply a separate colormap to the line plotted by plot like for example in a waterfall plot.

这(或类似的东西)可以使用 matlab 吗?

Is this (or something similar) possible using matlab?

谢谢

推荐答案

查看 cline.m 功能来自文件交换,我认为这正是您所需要的.

Have a look into the cline.m function from file exchange, I think it is exactly what you need.

这篇关于如何改变 matlab 图的线条颜色(如颜色图)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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