フィルターのクリア

如何设置bar图中的颜色(how to set the color of bar chart)

6 ビュー (過去 30 日間)
Jun Zhang
Jun Zhang 2019 年 2 月 11 日
回答済み: Alok Nimrani 2019 年 2 月 19 日
如上图,这个颜色我很喜欢,但是后面生成的bar图 如何设置成这2种颜色,具体参数是什么?
How to set the color like the above chart? what's the color parameters?
谢谢!(我的系统显示的问题区域是英文界面)

採用された回答

Alok Nimrani
Alok Nimrani 2019 年 2 月 19 日
Hi Jun Zhang,
You can store the face color of each bar in the above figure and then use these color in future plots. As an example, you can use the 'FaceColor' property to extract the color of each bar as follows:
>> y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
>> h = bar(y);
>> colors = get(h, 'FaceColor');
And then you can set these colors as the FaceColor property of future bar plots.
Hope this helps.

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange图形对象编程 についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!