webelo
webelo

Reputation: 1903

Changing the RGB for longname/shortname to default colors in Matlab

When using plot() in Matlab the default colors differ from what the docs call the longnames/shortnames, which can be supplied in lieu of RGB triples. For example:

n = 10;
a = rand(n,1);
b = rand(n,1);
w = 1e-1;
p = 1:n;

plot(p,a,p,b,p,a+w,'b',p,b+w,'r','LineWidth',3);

I'd like to know if there was a way to setting these longnames/shortnames to the default (2015b) colors.

EDIT

@Geoff provided the easiest way to do what I asked originally. Let me try to sharpen up my question. I was hoping to keep the default color order but assign the new default blue (rgb = [0 0.4470 0.7410]) to the 'b' shortname. I know this may seem sort of fussy but I prefer the new default blue to the "canonical" blue (rgb = [0 0 1]).

Upvotes: 0

Views: 279

Answers (1)

Geoff
Geoff

Reputation: 1212

The default "blue" and "red" you are seeing come from the colormap lines, which by default are the colors used by plot . You can edit the default plotting colormap like this.

Upvotes: 1

Related Questions