-1

I want to track the seven observations' performances on seven assessments using sparklines, so I thought that I could just melt my data frame then do a facet wrap by observation in ggplot. Now, I really need to label the maxima and minima for each facet. Is this possible in my current set up or do I need to graph each facet separately and add on indictors via geom_annotate? I'm sorry if this is a very rookie question. I am very new to R.

  ggplot(test,aes(x=variable,y=value,group=1))+
           facet_wrap("student",nrow=7)+
           geom_point()+
           geom_line()+
           mytheme
user20650
  • 24,654
  • 5
  • 56
  • 91
  • 1
    It would be great if you could edit your question with some example data that would make it easier to help. Please see this on [how to ask a question](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – user20650 Jul 09 '14 at 15:58

1 Answers1

0

It is possible. You have to add the max to your data frame, or make a new one to hold them and then add it to the plot. Can't reproduce, so the following code may contain errors, but something like this:

maxd <- aggregate(test$value, list(student = test$student), max)
names(maxd)[length(maxd)] <- "maxvalue"

ggplot(..) + ... + 
    geom_text(data = maxd, aes(label = maxvalue, x = X0, y = Y0)) 
    #substitute X0, Y0 with your desired position of text
konvas
  • 14,126
  • 2
  • 40
  • 46