bar graph grouped with custom x-axis

4 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by