View source: R/theme_helpers.R
expand0 | R Documentation |
expand0()
and expand1()
are a convenience functions that call
expansion(mult = c(0,0))
and expansion(mult = c(0,0.1))
,
respectively, to remove space between the plot and the axes. See
expansion()
for more information on setting the space
between the plotted data and the axes.
expand0()
expand1()
library(ggplot2)
p <- ggplot(faithfuld, aes(waiting, eruptions, fill = density)) +
geom_raster() +
scale_fill_distiller(palette = "YlGn") +
scale_x_continuous(expand = expand0()) +
scale_y_continuous(expand = expand0())
df <- data.frame(
x = factor(c("IL6R", "IL8R", "IL6R-Ab", "IL8R-Ab", "IL6R-Ab-IL8R"),
levels = c("IL6R", "IL8R", "IL6R-Ab", "IL8R-Ab", "IL6R-Ab-IL8R")),
y = c(0.45, 0.78, 0.61, 0.31, 0.72))
p <- ggplot(df, aes(x, y, fill = x)) +
geom_col() +
scale_y_continuous(expand = expand1())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.