How to avoid color repetition in plotting lines
145 views (last 30 days)
Show older comments
I have a plot of about 30 lines and i want every color to be unique in identification, please how can i do this?
0 Comments
Accepted Answer
DGM
on 29 Apr 2022
Edited: DGM
on 29 Apr 2022
The colors used by line plots are drawn from the 'colororder' property of the parent axes. By default, this is set to lines(7), so you'll only have 7 unique colors before it repeats.
You can set the colororder to any valid colormap:
set(gca,'colororder',parula(32))
... though you may find that it's difficult to distinguish between the lines due to the linearity of the colormap.
There are many colormaps available on the File Exchange that may be suitable for your needs, or you might try something like this:
0 Comments
More Answers (0)
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!