Lilly
Lilly

Reputation: 49

How to put the bin labels in italic using gggenomes package?

Good evening, I am building an R shiny app in which I use gggenomes package which plots genes alignments. It works using the ggplot2 package but has his own properties such as geom_bin_label which is causing me a lot of trouble now...

The geom_bin_label is use to specify the legend of the sequences that appears on the plot. In my case, it's nematodes species names.

I would like to put them in italic.

So far my code :

p1 <- gggenomes(seqs = seqs, genes = genes, links = links) +
    geom_seq() +
    geom_gene(aes(fill = ifelse(is.na(Orthogroup) & nrow(genes) == 1, "NA", Orthogroup)), stroke = 0.5) +
    geom_bin_label(size = 4.5)+
    geom_link()+
    scale_x_continuous(labels = function(x) { 
      x <- x + region$start 
      round(x)}) +
    labs(fill = "Orthogroups") +
    scale_fill_manual(values = setNames(genes$color, genes$Orthogroup))+
    theme(legend.text=element_text(size=13),
          legend.title = element_text(size=15),
          axis.text.x=element_text(size=12),
          axis.text.y = element_text(face = "italic"))

What it does : enter image description here

As you can see, the species names at the left are not in italic... I tried several things such as expression(paste(italic())) or element_text(face = "italic")) but not working as well...It's not working the same as ggplot for this one it seems...

If someone knows gggenomes and can help, it would be great! Thanks

Upvotes: 0

Views: 74

Answers (0)

Related Questions