Retrieve matlab plot colors

matlab plot line colors

I couldn’t find any documentation about where the plot line colors are stored or how to access them. Here’s a hacky way to retrieve them. Currently plot cycles through 7 colors:

p = plot(repmat(1:7,2,1)); 
plot_colors = reshape([p.Color],3,7)';

matlab plot line colors

Update:

The correct way as Daniele writes in the comments is:

get(groot,'defaultAxesColorOrder')

Tags: , , , , , ,

One Response to “Retrieve matlab plot colors”

  1. Daniele says:

    Hi,
    I know this is an old post but maybe it can be useful.
    A more straightforward way is to type:

    get(groot,’defaultAxesColorOrder’)

    Bye

Leave a Reply