How to get the facecolor of each bar?

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

 採用された回答

Ben11
Ben11 2014 年 8 月 1 日
編集済み: Ben11 2014 年 8 月 1 日

0 投票

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'));

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDiscrete Data Plots についてさらに検索

質問済み:

2014 年 8 月 1 日

編集済み:

2014 年 8 月 1 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by