Custom Colors for Plots
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.
Examples:
for ccc=1:15
plot(ccc*ones(1,10),'Linewidth',4,'Color', CustomColors(ccc))
end
plot(ones(1,10),'Linewidth',4,'Color', CustomColors('Coral'))
plot(ones(1,10),'Linewidth',4,'Color', CustomColors('DeepSkyBlue4'))
Cite As
Andres (2026). Custom Colors for Plots (https://uk.mathworks.com/matlabcentral/fileexchange/36514-custom-colors-for-plots), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: Maximally Distinct Color Generator
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
