How to remove a particular portion from a plot?

Hi i have generated a alpha diversity plot from using the following code and getting a plot like the following.

#plot alpha diversity index
alpha_sweden <- plot_richness(physeq_rarefied, x="type", measures="Shannon") + 
  stat_compare_means(method = "wilcox.test") +
  geom_boxplot(aes(fill = type), notch = TRUE, outlier.size = -1) + 
  scale_fill_manual(values = c("skyblue", "hotpink"))+
  labs(x= "Sample types", y= "Shannon Diversity Index", fill ="Groups") +
theme(legend.position = element_blank(), axis.text.x = element_blank())

alpha_erp002469_sweden$layers[1] <- NULL

#export alpha diversity index
tiff(filename = "alpha_diversity_plot.tiff", width = 30, height = 30, units = "cm", res = 1200)


Can you please tell me how can I remove that "Shannon" heading from the plot?


It's hard to tell for sure without a reprex (short for reproducible example), as I'm not sure where plot_richness() comes from (it's not a ggplot2 function, I imagine it's a helper function from another package).

There's a nice FAQ on how to do a minimal reprex for beginners, below:

From the look of it, "Shannon" is the label for the facet of the plot (even though you don't actually have any other panels there, the default theming for facets have the grey strip right on top of the plot). So, you'd have to work with the strip.* theme arguments in order to change the appearance of that from its default label with plot_richness().

Depending on how plot_richness() works, I don't know whether or not you'll be able to modify the labeller() arguments.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.