I would like to group boxplots for data from two columns of my table (az and iz), plotting the data of both columns side by side and grouped by habitat
My dataset looks like this:
habitat az iz
Gi 2,8 3,0
We 1,3 2,0
Mw 11,3 9,0
Htr 4,0 7,0
Gi 1,4 8,0
Mw 3,3 5,0
Mw 23,6 12,0
Gi 3,8 12,0
Gi 0,0 0,0
We 1,0 5,0
We 0,6 3,0
We 0,9 3,0
Mw 13,1 6,0
Mw 13,4 13,0
Mw 12,7 10,0
Htr 14,1 9,0
Htr 18,1 13,0
Htr 19,8 19,0
I only manage it to plot the data from one column (iz) and I don't see how to add the data from the second column (az)?
data$habitat <- factor(data$habitat , levels=c("We","Gi","Mw","Htr"))
ggplot(data, aes(x=habitat, y=iz, colour=habitat)) +
geom_boxplot()
This gives me the boxplot for the (iz) data
I don't know how to add a second boxplot for the az data to the corresponding groups? I found solutions to group boxplots by data of a second column, but I didn't find an example that explained how to add data from a second column in the same group.

