-
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Just wondering if the following approach was possible in tidyterra.
I have a spatraster with a layer for prediction value and another layer for standard error, and I want to plot using one layer to scale fill and the other to scale alpha. The current approach uses geom_tile after converting spatraster to a dataframe.
library(tidyterra)
library(ggplot2)
x <- rast(array(data = rnorm(120, 0, 1), dim = c(5, 5, 2)))
names(x) = c("prediction", "se")
xdf <- as.data.frame(x, xy = T)
ggplot() +
geom_tile(data = xdf, aes(x = x, y = y, fill = se, alpha = prediction)) +
scale_alpha_continuous(range = c(0, 1)) +
scale_fill_gradient(low = "white", high = "deeppink3") +
theme_minimal()
Metadata
Metadata
Assignees
Labels
No labels