title: ggplot renaming facet labels in facet_wrap
body: <p>I've hit a stumbling block in writing a ggplot function. I'm trying to change the facet labels in a ggplot facet_wrap plot.... but its proving trickier than I though it would be....</p>
  <p>The data I am using can be accessed here</p>
  <pre><code>str(ggdata)
  'data.frame':   72 obs. of  8 variables:
   $ Season : Factor w/ 3 levels &quot;Autumn&quot;,&quot;Spring&quot;,..: 2 2 2 2 2 2 2 2 2 2 ...
   $ Site   : Factor w/ 27 levels &quot;Afon Cadnant&quot;,..: 13 13 13 13 13 13 13 13 13 13 ...
   $ Isotope: Factor w/ 4 levels &quot;14CAA&quot;,&quot;14CGlu&quot;,..: 1 1 1 1 1 1 2 2 2 2 ...
   $ Time   : int  0 2 5 24 48 72 0 2 5 24 ...
   $ n      : int  3 3 3 3 3 3 3 3 3 3 ...
   $ mean   : num  100 88.4 80.7 40.5 27.6 ...
   $ sd     : num  0 1.74 2.85 2.58 2.55 ...
   $ se     : num  0 1 1.65 1.49 1.47 ...
  </code></pre>
  <p>I have written the following function to create the ggplot which uses the Isotope factor levels to label the facets:</p>
  <pre><code>plot_func &lt;- function(T) {site_plots &lt;- ggplot(data = T) + geom_point(aes(Time, mean, colour = Season, shape = Season)) + 
    geom_line(aes(Time, mean, colour = Season, linetype = Season)) +
    geom_errorbar(aes(Time, mean, ymax = (mean + se), ymin = (mean - se)), width = 2) +
    labs(title = T$Site[1], y = &quot;Percentage of isotope remaining in solution&quot;, x = &quot;Time (h)&quot;) +
    scale_x_continuous(breaks=c(0, 24, 48, 72)) +
    scale_y_continuous(limits=c(0,115), breaks = c(0,25,50,75,100)) +  
    theme(axis.title.y = element_text(vjust = 5)) +
    theme(axis.title.x = element_text(vjust = -5)) + theme(plot.title =  element_text(vjust = -10)) +
    theme_bw() + facet_wrap(~Isotope, ncol =2) 
    print(site_plots)
    ggsave(plot = site_plots, filename = paste(T$Site[1], &quot;.pdf&quot;), 
       path = &quot;C:/Users/afs61d/Dropbox/Academic/R/Practice datasets/Helens_data/Site_Isotope_Season_plots/&quot;, 
       width = 9, height = 7, dpi = 300)}
  </code></pre>
  <p>Resulting in this lovely graph:</p>
  <p><a href="https://i.stack.imgur.com/2PHGX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2PHGX.png" alt="enter image description here" /></a></p>
  <p>Which is nice but I want to change the facet labels now...
  Having done some poking around google I thought I might be able to use the <code>labeller</code> function as an argument to pass to <code>facet_wrap</code>. After a frustrating hour I discovered that this only works with <code>facet_grid</code>!!!???
  So, an alternative method was to change the Factor level names so give me the facet labels that I want::</p>
  <pre><code> gdata$Isotope &lt;- revalue(x = ggdata$Isotope, 
  c(&quot;14CAA&quot; = &quot; 14C Amino Acids&quot;, &quot;14CGlu&quot; = &quot;14C Glucose&quot;, 
    &quot;14cGlu6P&quot; = &quot;14C Glucose-6-phosphate&quot;, &quot;33P&quot; = &quot;33P Phosphate&quot;))
  </code></pre>
  <p>This works, but the problem I have now is that I want the numbers in the labels to be super-scripted. Can anyone suggest the best way to achieve this?
  Thanks</p>