image thumbnail

defaultPlotColors() to get or draw the 7 default colors used by plot() function

version (138 KB) by Kouichi C. Nakamura
defaultPlotColors() allows you to get or draw the 7 default colors of plot() function since R2014b


Updated 11 Jul 2016

View License

getDefaultPlotColors returns default colors for plot function.
Every run of plot() function proceed by one row in the color array.
colors = defaultPlotColors()
colors = defaultPlotColors(k)
colors = defaultPlotColors('plot')

k If k is a scalar positive integer, you can get k th color of
default colors. If k is a vector of such integers,
defaultPlotColors returs n by 3 array of default colors, where
n is the length of vector k and colors are ordered in rows by
the vector k.

'plot' You can see all the seven default colors

out 1 by 3 vector represents a MATLAB color, or n by 3 array of
n colors

defaultPlotColors_script.mlx illustrate how defaultPlotColors.m can be used.





See also

ColorOrderIndex (Axes property)

Written by Kouichi C. Nakamura Ph.D.
MRC Brain Network Dynamics Unit
University of Oxford
10-Jul-2016 07:09:15

Cite As

Kouichi C. Nakamura (2021). defaultPlotColors() to get or draw the 7 default colors used by plot() function (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!