0

I would like to change the label of the y-axis in my facet wrap. Normally I manage to put the exponent with the following code but it is not working. Basically, I just want to put exponent for the unit of the y-axis label for each graph.

Please find here the dataset (I am sorry I didn't manage to upload it as txt) enter image description here enter image description here

expression("Luminous capabilities with ACh stimulation"( paste('10'^{9}, "q.",paste('g'^{-1}, sep = "")))))
ggplot(datacoel,aes(x=as.factor(Day),y=coel,fill=measure))+ 
  geom_line(aes(x=Day, y=coel,group=measure,color=measure),stat="identity")+
    facet_wrap(~measure,ncol=1, strip.position = "left", scales="free_y", ***labeller = as_labeller(c(Coelenterazine = "Coelenterazine\ncontent (ng/g)", Luciferase = "Luciferase activity\n(Mq/g.s)",LightKCl= "Luminous capabilities\nwith KCl stimulation\n(Mq/g)",LightAch="Luminous capabilities\nwith acethylcholine\n(Mq/g)***")))+
   geom_bar(stat="identity",position="dodge",width =.6)+
  geom_errorbar(aes(ymin=coel-sem, ymax=coel+sem),width=.1,position=position_dodge(.60))+
  geom_vline(xintercept = 9.5, linetype="dotted", color = "black", size=1)+
  geom_vline(xintercept = 13.5, linetype="dotted", color = "black", size=1)+
  ylab(NULL) +
  labs(x="Number of days in captivity")+
  scale_x_discrete(expand = c(0,.6),limits = c("D0","D30","D60","D90","D120","D150","D180","D210","D240","D247","D254","D261","D268","D298","D328","D358","D388","D418","D448","D478"),labels=c("D0","D30","D60","D90","D120","D150","D180","D210","D240","D247","D254","D261","D268","D298","D328","D358","D388","D418","D448","D478"))+
  labs(caption = "Evolution of coelenterazine content from August 2021 to December 2022")+
  scale_color_manual(name = NULL, values = c("green4", "red4", "grey5","grey23"))+
    scale_fill_manual(values = c("Coelenterazine"="green3","Luciferase"="red2","LightKCl"="grey17","LightAch"="gray72"),
                    name = "Measurements",
                    labels = c("Coelenterazine content","Luciferase activity","Light emission with KCl","Light emission with acethylcholine"))+
  theme_bw()+
  theme(legend.position = "none", 
        panel.border = element_blank(),
        strip.background = element_blank(),
        strip.placement = "outside",
        strip.text.x = element_blank(),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        axis.line = element_line(size = 0.5, linetype = "solid", colour = "black"),
        axis.title.x = element_text(color = "black", size = 12,family = "Tahoma"),
        axis.text.x = element_text(color="black",size=10,family = "Tahoma",angle = -40, hjust=0.1),
        axis.text.y = element_text(color="black",size=10,family = "Tahoma"))
  • Be aware that faceting allows for only one shared axis title. For more help please provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. Also, please provide some information on what *is not working.* – stefan Sep 02 '23 at 10:26

0 Answers0