Can I use colormap to set color of my cumulative area chart in area()?
2 views (last 30 days)
Show older comments
If so, how should I use it?
I tried to put something like colormap(map) on some different places but they just didn't work.
Answers (1)
Voss
on 1 Dec 2022
Edited: Voss
on 1 Dec 2022
area dioesn''t use the figure's colormap directly, but it does use the axes' ''ColorOrder' by default, so maybe something like this is what you want to do:
a = [1;2;3;4;5];
b = 2*a;
c = 3*a;
data = [a,b,c];
x_axis = 1:size(a,1);
area(x_axis,data,0);
set(gca(),'ColorOrder',summer(size(data,2)));
legend('a','b','c')
0 Comments
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!