I have the following data frame:
Parameter<-c("As","Hg","Pb")
Loc1<-c("1","10","12")
Loc2<-c("3","14","9")
Loc3<-c("5","12","8")
Loc4<-c("9","20","6")
x<-data.frame(Parameter,Loc1,Loc2,Loc3,Loc4)
x$Loc1<-as.numeric(x$Loc1)
x$Loc2<-as.numeric(x$Loc2)
x$Loc3<-as.numeric(x$Loc3)
x$Loc4<-as.numeric(x$Loc4)
I set up a plot with 4 facets, one for each location, to show the different heavy metal concentrations at each location.
melt<-melt(x, id=c("Parameter"))
ggplot(melt, aes(x = Parameter, y = value, fill = variable)) +
geom_bar(stat = "identity", position = "dodge")+
facet_grid(. ~ variable)
However, I would like to write text into each of the 4 facets. I tried geom_text
but couldn´t figure out how to get different text into each of the facet and place it at a specific location.