欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Matlab tricks---plot color

程序员文章站 2023-12-30 16:03:58
...

[1]

reddit

[3]

The default color of MATLAB is not ugly but sometimes not convenient. I found an easy way to plot beautiful lines [1].

You just need to generate NN distinguishiable colors by ‘‘C = linspecer(N)’’.
`` C’’ contains the RGB values of these colors by rows.

Then you can even use the inherit function of MATLAB [3] to set color oder and line order, which is fantastic. Here is an simple example

x = linspace(0,7);
y = ones(length(x),9);
for i = 1:9
    y(:,i) = sin(x-i/5)';
end
plot(x,y)
C = linspecer(3);  %% generate 3 colors
ax = gca;
ax.ColorOrder = C;
ax.LineStyleOrder = {'-','--',':'}; 
相关标签: Matlab tricks

上一篇:

下一篇: