Skip to content

Instantly share code, notes, and snippets.

@rafapereirabr
Created February 12, 2023 15:51
Show Gist options
  • Save rafapereirabr/d44d4aa02b8a481fe4c2b65bb8acf036 to your computer and use it in GitHub Desktop.
Save rafapereirabr/d44d4aa02b8a481fe4c2b65bb8acf036 to your computer and use it in GitHub Desktop.
heat map with pseudo_log scale
# Library
library(ggplot2)
library(viridis)
# Dummy data
set.seed(42)
x <- LETTERS[1:20]
y <- paste0("var", seq(1,20))
data <- expand.grid(X=x, Y=y)
data$Z <- runif(400, 0, 10000)
# plot
ggplot(data, aes(X, Y, fill= Z)) +
geom_tile() +
scale_fill_viridis_c(
name = "Number of jobs",
option = "viridis",
breaks = c(0, 10, 100, 1e3, 1e4),
labels = scales::number_format(),
trans = "pseudo_log",
na.value = "#F8F7F7",
aesthetics = c("fill", "color")
) +
theme_minimal()
@rafapereirabr
Copy link
Author

Screenshot 2023-02-12 125052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment