Created
June 4, 2020 17:40
-
-
Save necronet/b65e2e819ec1e9344a501d5681413d95 to your computer and use it in GitHub Desktop.
On Adding a custom gradient w/ background layer to ggplot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g <- rasterGrob(greens, width = unit(1, "npc"), height = unit(1, "npc"), interpolate = TRUE) | |
test <- ggplot(mtcars, aes(x = mtcars$hp, y = mtcars$mpg)) + | |
theme(plot.background = element_blank(), | |
panel.background = element_blank()) + | |
annotation_custom( | |
grob = g, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf | |
) + geom_point() | |
plot_grid(test, labels = c('A')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment