MATLAB Answers

How to plot a line of a certian color

4,032 views (last 30 days)
Hail
Hail on 15 Aug 2014
Answered: Image Analyst on 15 Aug 2014
I have 7 lines on a single plot. I dont want to use the 'y' color code. How can I make my own color? I also want this line to have astericks along it. So currently I have 'y*-' but again I dont want to use yellow

  0 Comments

Sign in to comment.

Accepted Answer

Chad Greene
Chad Greene on 15 Aug 2014
plot(x,y,'*','color','blue') plots in blue. plot(x,y,'*','color',[.5 .4 .7]) plots the RGB value [.5 .4 .7]. If you want lots of color names, you could use the rgb function to return the RGB values of just about any color. For example, plot(x,y,'*','color',rgb('blood red'))

  0 Comments

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 15 Aug 2014
Of course Chad's answer is best . But I just thought I'd show people how to change the default color order that you get when you plot lines without specifying the color. Ever wonder how it plots blue first, then dark green, then red, then cyan, etc.? Ever want to change the default order so that it plots curves with the color order you want instead of the default color order, and without having to specify the color in every single call to plot()? If so, run the attached demo.

  0 Comments

Sign in to comment.