View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Custom Colors for Plots

5.0 | 2 ratings Rate this file 8 Downloads (last 30 days) File Size: 1.88 KB File ID: #36514 Version: 1.0
image thumbnail

Custom Colors for Plots


Andres (view profile)


This function provides a selection of colors easy to differentiate for plotting graphics.

| Watch this File

File Information

In plot graphs, often it's needed to use a several colors that can be easily differentiated on a first look on the graphic. With this function you can call easily (by name or by code) a selection of 15 colors.
It's very simple and there are more elegant ways to do it, but I think it's a very functional solution.

for ccc=1:15
plot(ccc*ones(1,10),'Linewidth',4,'Color', CustomColors(ccc))

plot(ones(1,10),'Linewidth',4,'Color', CustomColors('Coral'))
plot(ones(1,10),'Linewidth',4,'Color', CustomColors('DeepSkyBlue4'))

MATLAB release MATLAB 7.12 (R2011a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
20 May 2016 Jessica77

14 Jan 2013 Julian

Julian (view profile)

Sweet! thanks

04 May 2012 Jan Simon

Jan Simon (view profile)

I cannot really distinguish the colors magenta4 and darkorchid on my screen.
The "for ct2" loop to find a matching name is inefficient. Better: "ct2 = find(strcmpi(NColors, ct1));"
fprintf() is more efficient than disp(sprintf()) as recommended by MLINT.
There is no need to enclose vectors in double square brackets.

Comment only

Contact us