joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
581 stars 187 forks source link

plot_tree: Added ggplot code to fix ugly legend "a"s #1748

Open stephanbitterwolf opened 5 months ago

stephanbitterwolf commented 5 months ago

When using plot_tree with tip labels and a color, the legend is altered and colored "a"s appear. I tried removing these after executing the plot_tree command but was not able to. Instead I needed to edit the plot_tree function itself to add "show.legend = FALSE" in the final section.

This removes the geom_text "a" from the legend.

This image shows the "a"s in the legend: image

Here is what a similar tree looks like with "show.legend=FALSE" added for the tip labels:

image

p <- p + geom_text(labelMap, tiplabDT, size = I(text.size), hjust = -0.1, na.rm = TRUE, show.legend = FALSE) #added show.legend=FALSE so that the legend does not show colored "a"s when using plot_tree.