JerryYe的个人博客分享 http://blog.sciencenet.cn/u/JerryYe

博文

【Matlab】有关plot画颜色渐变曲线的设置

已有 18516 次阅读 2017-4-27 11:21 |个人分类:Matlab|系统分类:科研笔记| MATLAB, plot, 颜色渐变

1. 参考 http://www.thesis123.com/plotting-in-matlab/

dc=hsv(18);           % 18 colours are generated
x = 0:pi/100:2*pi;
hold on                  % you much write this before the plot
i=1;
for d=0:0.2:2,   % 11 lines in plot are taken
 plot(x,sin(x-d),'color',dc(i,:),'linewidth',2)
 i=i+1;
end


2.参考http://stackoverflow.com/questions/37111362/matlab-plot-and-color-samples-based-on-data

nlines=length(concentrations);cmap=hsv(nlines)

c=concentrations-min(concentrations);

c=ceil(c/max(c)*nlines);

for ii=1:nlines

plot(wavelength,dataMatrix(ii,:),'Color',cmap(c(ii),:))

hold on;

end

hold off;






https://blog.sciencenet.cn/blog-2824237-1051498.html

上一篇:【MATLAB】有关quiver的几个设置(不定期更新)
下一篇:【MATLAB】定点画圆
收藏 IP: 219.146.245.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-26 11:37

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部