- #1
madtraveller
- 28
- 0
Homework Statement
I have a 6 x 16 data frame "y" which stands for 16 different soil types at 6 different depth as followings
Code:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0.37 0 0 0.50 0 0.03 0.03 0 0 0.02 0.05
0 0 0 0 0 0.26 0 0 0.34 0 0.02 0.02 0 0 0.33 0.03
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0.06 0 0 0 0 0 0 0 0 0.94 0
Homework Equations
I'd like to create a multi bar graph which has 16 columns (soil type) and each column has another 6 sub column(6 soil depths). But it seemed that Matlab didn't like zeros value, thus it didn't plot it and I couldn't create a proper legend for it
The Attempt at a Solution
Code:
figure;
% Legend for x-axis
soilType = {'S', 'LS', 'SL', 'SIL', 'SI', 'L', 'SCL',...
'SICL', 'CL', 'SC', 'SIC', 'C', 'OM', 'W', 'BR', 'O'};
% Characteristics for legend
soilDepth = {'0-10cm', '0-100cm', '0-150cm', '10-40cm', '40-100cm', '100-150cm'};
bar(y, 'group')
set(gca, 'XTickLabel', soilType);
xlabel('Soil Type');
ylabel('Areal Fraction')
legend(soilDepth, 'Location', 'Northwest')
Any suggestion will be very appreciated. Thx
madtraveller