I have the following data frame:> algaedata year DIV cellsperml2001 BAC 72.808 2001 CHL 3.273 2002 BAC 14.002 2002 CYA 220.896 2002 UNI 464.699 2003 BAP 0 2003 BAC 1.782 2004 CYA 315.799 2005 UNI 222.532 2005 BAP 0.2 2005 CYA 163.627 2005 BAC 324.949 2006 CHL 1.636 2006 BAC 199.145 2007 CHL 19.635 2007 CYA 134.174 2007 BAC 485.405 2007 CHL 11.454 2007 CYA 104.721 ...which makes a fine stacked bar plot using:> qplot(year, data=algaedata, binwidth=1, weight=cellsperml, fill = DIV)Now I want to annotate along the X-axis with the text "numb" from the following data frame:> labelstouse x y numb2001 0 45 2002 0 77 2003 0 2 2004 0 44 2005 0 98 2006 0 55 2007 0 1 For instance, the following did not work:> qplot(year, data=algaedata, binwidth=1, weight=cellsperml,fill = DIV) + > grid.text(x = labelstouse$x, y = labelstouse$y, label = labelstouse$numb)I get the error "Don't know how to add o to a plot." I also attempted to use multiple configurations of annotate (which only allows one label) and geom_text but the latter seems to be better suited for ggplot. Any help would be appreciated in getting these annotations to work with qplot. Best - Euan Reavie. U. Minnesota.
Thank you for the many replies on this issue. I turns out qplot is not suited to multiple annotations, so the best suggestions were to use ggplot. The following worked for making an annotated stacked bar plot: ggplot(algaedata) + geom_bar(aes(x = year, y = cellsperml, colour = DIV, group = DIV)) + geom_text(data = labelstouse, aes(x = x, y = y, label = numb)) Dennis Murphy additionally suggested using a combined line and point plot by using the following instead: geom_point(aes(x = year, y = cellsperml, colour = DIV, group = DIV)) + geom_line(aes(x = year, y = cellsperml, colour = DIV, group = DIV)) All the best - Euan.