Add another label that groups the bars in a bar plot together
Afficher commentaires plus anciens
Hi,
I have created a bar plot that plots four groups of bars with four bars in each group. All bars with the same color, one bar in each group, represent a measurement from a test with the same material. Each group of bars is one test where two groups are measurements from an even surface and two groups are measurements from uneven surfaces.
Now, I'd like to add another row below the below the ‘Even’ and ‘Uneven’ labels, pairing the two left groups together and the two right two groups together since the tests are performed at two different locations. On this second row I want to add labels showing the test location. I have a screenshot from excel showing what I want to do. The test locations in this plot are named 'KER-50' and 'BUT-70'
Is there anyone out there who has experience about this?
clear all, close all, clc
Homepath = cd;
A = [80,74,84,78
49,44,53,48
-8.9,-9.2,-6.9,-7.2
-9.1,-10,-8.1,-8.3];
figure1 = figure;
width = 4;
height = width*0.8;
axes1 = axes('Parent',figure1);
hold(axes1,'on');
bar(A,'Parent',axes1);
ylim(axes1,[-20,100])
set(axes1,'XTick',[1 2 3 4],...
'XTickLabel',{'Even','Uneven','Even','Uneven'},...
'YTick',[-20,0,20,40,60,80,100],...
'YTickLabel',{'-20','0','20','40','60','80','100'});
legend(axes1,'HMA 3%','HMA 0%','RHMA 3%','RHMA 0%')
box(axes1,'on')
ylabel(axes1,'Energy savings (10^6 MJ)')
cd([Homepath '\PICS'])
print EnergySavings_5years -djpeg -r600
cd(Homepath)


Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
