Skip to content

Instantly share code, notes, and snippets.

@gkaramanis
Created August 11, 2020 16:22
Show Gist options
  • Save gkaramanis/9e5076cfd0c0a117e8151244389f98e9 to your computer and use it in GitHub Desktop.
Save gkaramanis/9e5076cfd0c0a117e8151244389f98e9 to your computer and use it in GitHub Desktop.
library(ggplot2)
library(tidyr)
library(viridis)
df <- data.frame(x = 1:10, y = 1:10) %>% expand(x, y) %>% mutate(n = as.integer(runif(min = 0, max = 26, n = 100)))
pal <- c(viridis(n = 23), "black", "purple", "pink")
ggplot(df, aes(x, y, fill = factor(n))) +
geom_tile() +
scale_fill_manual(values = pal, breaks = 0:25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment