bar plot color issues

1 回表示 (過去 30 日間)
Mini Me
Mini Me 2014 年 9 月 17 日
回答済み: Radha Krishna Maddukuri 2014 年 9 月 29 日
h=bar((1:2),xData_dump(2:3), 0.4,'grouped','r');hold on
I am trying to bar plot a data. but each bar shows up with the same color. is there anyway I can have each data inside xdata_dump to have diff color without breaking it in this format:
h=bar(1,xData_dump(2),0.4,'g');hold on;
h=bar(2,xData_dump(3),0.4,'m');hold on;

回答 (1 件)

Radha Krishna Maddukuri
Radha Krishna Maddukuri 2014 年 9 月 29 日
The script that you have used is accurate for the most part. I would suggest using
>> hold all
in place of 'hold on'. Using the HOLD ALL command once, ensures that all the bars of the bar plot have different colors.
As a sample script, you could try the following:
>> y = [75.995,91.972,105.711];
>> figure;
>> hold all;
>> bar(1,y(1),0.4,'g');
bar(2,y(2),0.4,'m');
bar(3,y(3),0.4,'b');

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by