How to get the facecolor of each bar?

1 Ansicht (letzte 30 Tage)
Jelle
Jelle am 1 Aug. 2014
Bearbeitet: Ben11 am 1 Aug. 2014
Dear Sir/Madam,
In my horizontal bar chart MATLAB has given specific colors for each bar. I'd like to use the same colors in another graph. How can I get these facecolors?
Best regards,
Jelle

Akzeptierte Antwort

Ben11
Ben11 am 1 Aug. 2014
Bearbeitet: Ben11 am 1 Aug. 2014
Use the handles to the bar graph to retrieve its 'FaceColor' property.
Eg:
hbar1 = hbar(data,SomeColor);
Then you can get the color specifications with:
get(hbar1,'FaceColor');
and apply it to another graph:
hbar2 = hbar(data2,get(hbar1,'FaceColor'));

Weitere Antworten (0)

Kategorien

Mehr zu Discrete Data 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!

Translated by