How to keep different colors for stacked bars in a multiple plot?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marco Piantini
am 14 Mär. 2019
Kommentiert: Adam Danz
am 15 Mär. 2019
I've combined two different plots in the same axes with "hold on": a normal graph and a bar graph with stacked bars. I would like to mantain different colors for each part of the single bars, but when I plot the figure the bars turn into the same color, even if still separated in different parts. For example:
x=1:10
y1=rand(1,10)
y2=rand(10)
figure
yyaxis left
plot(x,y1)
hold on
yyaxis right
bar(x,y2,'stacked')
How can I keep different colors for each part?
Thanks so much
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!