フィルターのクリア

bar graph grouped with custom x-axis

4 ビュー (過去 30 日間)
Nick
Nick 2013 年 12 月 2 日
コメント済み: Nick 2013 年 12 月 9 日
I need a bar graph containing 3 sets of Y values and I'd like to apply the 'grouped' style. (i.e. y1 = round(rand(1,49)*10); y2 = round(rand(1,49)*10); y3 = round(rand(1,49)*10);) (See http://www.mathworks.de/de/help/matlab/ref/bar.html, "Bar Graph Styles".)
On top of that, I have a custom x-axis. (i.e. x = -24:1:24) (See http://www.mathworks.de/de/help/matlab/ref/bar.html, "X-Axis Tick Labels".)
Can I combine these two functions in one bar graph?

採用された回答

dpb
dpb 2013 年 12 月 2 日
Sure, just set the 'xticklabel' property as desired. You may also want to set 'xtick' to an appropriate number of values. Just remember the tick values must be in range of the axes limits to display; the tick labels can then be anything on a 1:1 correspondence to the tick marks.
There are examples in the 2D graphics for customizing graphics...
  1 件のコメント
Nick
Nick 2013 年 12 月 9 日
Thanks for your answer! I finally got round to trying this again...
Basically I just had to define for the x axis an array (1,n), and for the y axis an array (n,m).
As for my example: Grid = xGridOut; % 1x202 double Freq = [xFreqOut; xFreqIn1; xFreqIn2]'; % 202x3 double bar(Grid, Freq, 'grouped')
My next challenge will be a 3d bar graph.

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

その他の回答 (0 件)

カテゴリ

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