I have a plot where the bottom tick has a label of 'mean'. I want this to be in italics, but its not working. Any ideas?
I get the error:Vectorized input to element_text() is not officially supported.
ℹ Results may be unexpected or may change in future versions of ggplot2.
However, even if I change the code to:
....theme(axis.text.y=element_text(face='italic')....
nothing happens either and all labels on the y axis stay 'plain'. The vector form works for the colour so I don't understand why face isn't working.
example code
stacked <- ggplot(tally, aes(fill=Ellenberg, y=n, x=Quadrat)) +
    geom_bar(position='stack', stat='identity', show.legend=FALSE) +
    scale_x_discrete(labels=labels) +
    scale_fill_manual(values = colLegend) +
    theme_classic() +
    facet_wrap(~ Q, nrow=1, scales='free_x') +
    expand_limits(y=-3) +
    geom_text(
      label=tally$values, y=-3, color='red', fontface='italic', size=4.5, family="Calibri") +
    labs(x='Year', 
         y='    Number of Plants\n\n',
         title=plotTitles[[j]],
         subtitle = plotSubTitles[[j]]) +
    scale_y_continuous(breaks = c(-3, 0, 5, 10, 15, 20, 25),
                       labels=expression("Mean", "0", "5", "10", "15", "20", "25")) +
    theme(axis.text.y=element_text(face=c("italic", "plain", "plain", "plain", "plain", "plain", "plain"), 
                                   colour=c('red','black','black','black','black','black','black'))) +
    theme(axis.ticks=element_line(colour=c('white','black','black','black','black','black','black'))) + 
    theme(plot.title = element_text(size=20, face="bold", family="Calibri"),
        plot.subtitle = element_text(size=20, family="Calibri")) +
    theme(text=element_text(size=20, family="Calibri")) +
    theme(axis.title.y=element_text(margin=margin(l=20)))
  
  plot(stacked)
  plotList[[dfName]] <- stacked
  
  j = j + 1





