bar graph grouped with custom x-axis

4 visualizaciones (últimos 30 días)
Nick
Nick el 2 de Dic. de 2013
Comentada: Nick el 9 de Dic. de 2013
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?

Respuesta aceptada

dpb
dpb el 2 de Dic. de 2013
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 comentario
Nick
Nick el 9 de Dic. de 2013
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Discrete Data Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by