Is it possible to change the level of interpolation (e.g. smoothing, blur) in geom_raster
?
library(tidyverse)
mtcars %>%
group_by(carb, hp = cut(mtcars$hp, 3, labels = c("low", "med", "hi"))) %>%
summarise(mean_mpg = mean(mpg)) %>%
ggplot(aes(carb, hp)) +
geom_raster(aes(fill = mean_mpg), interpolate = FALSE) +
scale_fill_viridis_c(option = "inferno")
I'd like to have control over how much blurring takes place in the following graph:
mtcars %>%
group_by(carb, hp = cut(mtcars$hp, 3, labels = c("low", "med", "hi"))) %>%
summarise(mean_mpg = mean(mpg)) %>%
ggplot(aes(carb, hp)) +
geom_raster(aes(fill = mean_mpg), interpolate = TRUE) +
scale_fill_viridis_c(option = "inferno")
I know how to do this with stat_density_2d
-- see this post -- but I would like to pass fill a calculated value and not to calculate a density.