how to plot side by side bar chart on the same axis?

3 visualizaciones (últimos 30 días)
Hydro
Hydro el 30 de Dic. de 2017
Comentada: James Knowles el 4 de En. de 2018
I would like to have bar side by side for M1 on the left side of the figure and then likewise for M2 on the right side. M1 has 10 columns-so the plot be constructed in such a way that column 1 is aside with column 6 of M1. similarly, column 2 of M1 in comparison with column 7 of M1. I want the same for M2 but on the right side of the figure (i.e. there should be a gap between M1 and M2 dataset) see attached image as an example (i don't want bar stacked and have only two time periods correspond to M1 and M2). I tried the following but am not getting anywhere
M1 = -5 + (5+5)*rand(1,10);
M2= -5 + (5+5)*rand(1,10);
figure()
bar([M1(:,1:5);M1(:,6:10)])
hold on
yyaxis right
bar([M2(:,1:5);M2(:,6:10)])
  1 comentario
James Knowles
James Knowles el 4 de En. de 2018
This in built function may be of some use https://au.mathworks.com/help/matlab/ref/subplot.html

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by