Most constrasting colormap for multi-line plots
173 views (last 30 days)
Show older comments
Leo Simon
on 19 Dec 2013
Commented: Image Analyst
on 18 Jan 2014
Hi everyone
I'm having a very frustrating time trying to get constrating colormaps for multiline plots.
For people with poor eyesight like me, it's very hard to tell the difference between the lines.
Here's an example using a very boring default scheme
x = linspace(0,1,101);
y(1,:) = x.^2;
y(2,:) = x.^2.2;
y(3,:) = x.^2.4;
h = plot(x,y)
Colors = get(h,'Color');
Colors{:}
What I'd really like, ideally, is an algorithm that delivers, for given n, a list of n colors that will have in some sense maximum pairwise contrast between colors. Doubt if this is possible, but any recommendations for something better than what I have would be most appreciated
Thanks for any advise
2 Comments
Jana
on 18 Jan 2014
Hi guys, My question may seem stupid, but how do I set ANY colortable to this kind of plot? I have a matrix which I plot in lines (like the example of Bjorn). I keep failing in set ANY different colortable - probably one of the default ones would do. Thanks a lot for an answer. Jana
Image Analyst
on 18 Jan 2014
Did you see my color order demo I attached in my answer? Wouldn't that do what you want?
Accepted Answer
Bjorn Gustavsson
on 19 Dec 2013
Have a look at these file exchange contributions: beautiful-and-distinguishable-line-colors, and generate-maximally-perceptually-distinct-colors
(Always search the file exchange before doing any work of your own, and way before asking others)
HTH
More Answers (1)
Image Analyst
on 21 Dec 2013
Did you look at the colormap function in the help? The "lines" colormap is the built in colormap with the highest contrast between colors.
2 Comments
Image Analyst
on 21 Dec 2013
Edited: Image Analyst
on 21 Dec 2013
If you had used the full documentation with "doc colormap" instead of the limited command window version of it with "help colormap" you would have seen the built in colormaps as little pictures. Of course you're free to use whatever colormap you want, just make up something custom in a Nx3 2D array with values between 0 and 1, and use it.
plot(x,y, 'Color', myCustomColorMap(colorIndex, :));
You may also want to change the default color order. In that case, see my attached demo.
See Also
Categories
Find more on Blue 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!