remove_axis | R Documentation |
ggplot2
plotA helper function to set axis.line, axis.ticks, axis.text and axis.title
elements to element_blank()
for the specified axis.
remove_axis(axis = "y")
axis |
Specifies the axis to remove. One of "x", "y", "xy". Default is "y" because my most common use case is for density plots. |
library(ggplot2) library(dplyr) library(palmerpenguins) p <- penguins %>% filter(!is.na(flipper_length_mm)) %>% ggplot(aes(x = flipper_length_mm)) + geom_density(aes(fill = species), alpha = 0.5) + scale_fill_brewer(palette = "Set1") + scale_y_continuous(expand = expansion(c(0, 0.1))) + labs(x = "Flipper length (mm)") p + theme_td() + remove_axis("y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.