フィルターのクリア

bar type graph/ figure

1 回表示 (過去 30 日間)
harley
harley 2013 年 10 月 1 日
コメント済み: harley 2013 年 10 月 1 日
i have some values that i want to graph on a figure. This is for traffic signals.
example
%Road 1 Phase
Green Road 1 = 50; %sec
Yellow Road 1 = 5; %sec
Red Road 1 = 25; %sec
%Road 2 Phase
Red Road 2 = 50; %sec
Green Road 2 = 25; %sec
Yellow Road 2 = 5; %sec
i would like to show them graphically on the same figure showing both phases in relation to each other, something like a horizontal bar chart with time along the x axis, there is nothing to plot in the y direction.
Bar 1
Green Road 1 + Yellow Road 1 + Red Road 1
Bar 2
Red Road 2 + Green Road 2 + Yellow Road 2

採用された回答

Wayne King
Wayne King 2013 年 10 月 1 日
A = [50 25; 5 5 ; 25 50];
barh(A,0.75,'stacked');
xlabel('Seconds');
set(gca,'yticklabel',{'Green','Yellow','Red'});
Thanks for accepting my answer if I have helped you.
  1 件のコメント
harley
harley 2013 年 10 月 1 日
thanks

サインインしてコメントする。

その他の回答 (1 件)

Wayne King
Wayne King 2013 年 10 月 1 日
編集済み: Wayne King 2013 年 10 月 1 日
You can do something like this:
A = [50 25; 5 5 ; 25 50];
barh(A,0.75,'grouped');
xlabel('Seconds');
set(gca,'yticklabel',{'Green','Yellow','Red'});
  1 件のコメント
harley
harley 2013 年 10 月 1 日
thanks, how do i plot it so it adds all the Road 1 on one bar and same for Road 2, and colour coded.
Bar 1 Green Road 1 + Yellow Road 1 + Red Road 1 Bar 2 Red Road 2 + Green Road 2 + Yellow Road 2

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by