[R] Error in percentage stacked barplot
Maria Lathouri
m|@thour| @end|ng |rom y@hoo@gr
Tue May 2 21:23:04 CEST 2023
Dear all,
I am trying to plot the following table in stacked barplot in percentages and also horizontal.
Component Sample 1 Sample 2 Sample 3CaO 45 52 48SiO2 25 22 18Al2O3 15 11 14TiO2 6 5 6 Na2O 5 4 5CuO 3 3 5 Cl 1 3 4
When I tried the following functionbarplot(data,
+ main = "Stacked bar chart",
+ sub = "Subtitle",
+ xlab = "X-lab",
+ ylab = "Y-lab",
+ axes = TRUE, horiz = TRUE)
I got the following error
Error in barplot.default(hellisheidi, main = "Stacked bar chart", sub = "Subtitle", :
'height' must be a vector or a matrix
I also tried barplot(as.matrix(hellisheidi)) but what I was getting was the three stacked columns for Samples 1, 2 and 3 but I was getting an empty column for Component, instead of being the variable in the Samples.
I was hoping if you could help me on that.
Thank you very much in advance.
Kind regards,Maria
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1683055323500blob.jpg
Type: image/png
Size: 11610 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20230502/e508c126/attachment.png>
More information about the R-help
mailing list