2012年6月17日星期日

How to use nice colors in Matlab Plot

One major problem I always had in Matlab plotting is that other than the "default" 6-7 colors, it's hard to use different colors.

I just found a really nice solution:
http://scslin.blogspot.com/2011/09/matlab-plot-with-more-colors.html

Basically, you first download a small function "rgb" from:
http://www.mathworks.com/matlabcentral/fileexchange/24497-rgb-triple-of-color-name-version-2

Then, you can call:
plot(x,y,'color',rgb('olive'));


You will be able to draw a line using a "olive" color.
The available colors are as follows: