1 year ago

#307567

test-img

Sara Henderson

Making part of legend text italics e.g. y::x where only the x would be italics

I am trying to generate a line chart where different genes have been introduced via plasmids into a strain.

The plasmid name needs to be in standard text but the gene in italics for example I would like my legend to read ""pALC2073::clfA.

I have the genes italicised correctly in excel but the formatting is lost on input into Rstudio. My basic script is:

ggplot(subset(Fg1, Strain %in% c("pALC2073", "pALC2073::clfA")), 
       aes(x=conc, y=A570, colour=Strain, shape=Strain))+
  geom_line(cex=1)+
  geom_point(cex=4)+
  theme_classic(base_size = 22)+
  theme(legend.position="right")+
  scale_colour_brewer(palette = "Set1", labels=c("pALC2073", "pALC2073::clfA"))

I also want only one legend for shape and colour.

An example dataset would look like: Example Data

Thank you for helping!

r

ggplot2

legend

typography

0 Answers

Your Answer

Accepted video resources