Combine three different set bar graphs in one graph
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have three sets of bar graphs. How can I just place them on one graph with some spacing between each set and with each set having a different colour? three sets are: 1) vector_22=[000,001,010,011,100,101,110,111] leak_22=[5.33,5.46,4.45,4.47,4.41,3.90,4.36,3.71]; bar(leak_22); set(gca, 'xticklabel',{'000','001','010','011','100','101','110','111'}); text(1:length(leak_22),leak_22,num2str(leak_22'),'vert','bottom','horiz','center'); xlabel('Input Vector Applied'); ylabel('Leakage in nW');
2) vector_32=[000,001,010,011,100,101,110,111] leak_32=[4.46,4.50,3.69,3.67,3.63,3.24,3.63,3.17]; bar(leak_32); set(gca, 'xticklabel',{'000','001','010','011','100','101','110','111'}); text(1:length(leak_32),leak_32,num2str(leak_32'),'vert','bottom','horiz','center'); xlabel('Input Vector Applied'); ylabel('Leakage in nW');
3) vector_45=[000,001,010,011,100,101,110,111] leak_45=[3.65,3.69,3.04,3.0,2.98,2.69,2.99,2.66]; bar(leak_45); set(gca, 'xticklabel',{'000','001','010','011','100','101','110','111'}); text(1:length(leak_45),leak_45,num2str(leak_45'),'vert','bottom','horiz','center'); xlabel('Input Vector Applied') ylabel('Leakage in nW')
0 comentarios
Respuestas (1)
M
el 27 de Mzo. de 2018
You can group your 3 bar graphs using something like this:
b=bar([leak_22;leak_32;leak_45]);
For your example, you will have 3 groups of 8 bars.
If you want 8 groups of 3 bars, use the transpose of your vectors.
You can then change the color of specific bar using:
b(1).FaceColor='blue';
You can also change the line style and others properties.
4 comentarios
M
el 28 de Mzo. de 2018
Try
leak_32=[4.46,4.50,3.69,3.67,3.63,3.24,3.63,3.17]'; leak_22=[5.33,5.46,4.45,4.47,4.41,3.90,4.36,3.71]'; leak_45=[3.65,3.69,3.04,3.0,2.98,2.69,2.99,2.66]'; b=bar3([leak_22 leak_32 leak_45]);
And see if it corresponds to your needs.
Ver también
Categorías
Más información sobre Graph and Network Algorithms 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!