Plot a grouped bar chart

2 views (last 30 days)
Nora Lindell
Nora Lindell on 22 Dec 2019
Commented: dpb on 22 Dec 2019
Hi,
I have a script and for some reason I cannot plot a grouped bar chart, or any other plot. This is my script, I ave tried to make other plots with different datasets myt nothing works. Am I missing something obvious?
clc;
concentration = readtable('concentration_metal.xlsx'); %Metal concentrations in the soil samples in mg/kg
conf_interval = readtable('confidence_interval.xlsx'); %95 percent confidence interval for the metal concentration
soil_1=concentration(4,4:21);
soil_2=concentration(8,4:21);
soil_3=concentration(12,4:21);
soil_4=concentration(16,4:21);
soils=[soil_1 ; soil_2 ; soil_3 ; soil_4]; %combining the average soil concentrations
%transpose rows to colomns
xc=table2cell(soils);
soils_sec=xc';
soils_tree=cell2table(soils_sec);
soils_final=table2array(soils_tree);
%soils_final=cell2mat(soils_sec);
x={'50 Cr' '52 Cr' '56 Fe' '57 Fe' '60 Ni' '62 Ni' '63 Cu' '65 Cu' '66 Zn' '68 Zn' '75 As' '78 Se' '82 Se' '111 Cd' '114 Cd' '206 Pb' '207 Pb' '208 Pb'};
%x=x';
figure()
bar(soils_final)
  1 Comment
dpb
dpb on 22 Dec 2019
Well, we can't try to duplicate because you forgot to attach the data files to go with it...what symptoms do you have--errors, unexpected plot appearance, ...???
Not much to go on here.

Sign in to comment.

Answers (0)

Categories

Find more on Agriculture in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!