MATLAB: Graphing colors

plot

this is the code i have:
plot(all_conflims_mult, 'linestyle', '–', 'color', [0.00 0.00 1.00], 'linewidth', thick)
instead of having 'color', [0.00 0.00 1.00]
i would like to just 'g' or 'r' (For green and red) instead of the 3 numbers, how would i do that? THanks

Best Answer

You can use the few matlab built in colors ('red','green,'blue,'black','white','cyan','magenta','yellow'),
plot(...,'color','green',...)
but you could also just declare a variable that is that vector, i.e.
g = [0 0 1]
plot(...,'color',g,...)