Created
February 12, 2023 15:51
-
-
Save rafapereirabr/d44d4aa02b8a481fe4c2b65bb8acf036 to your computer and use it in GitHub Desktop.
heat map with pseudo_log scale
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
# 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() |
Author
rafapereirabr
commented
Feb 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment