Last active
August 6, 2017 18:22
-
-
Save tjvananne/626ce92975416d080b59585e0bb3450c to your computer and use it in GitHub Desktop.
Create a Heat Map in R using ggplot2 with viridis Color 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
# references: | |
# https://rud.is/b/2016/02/14/making-faceted-heatmaps-with-ggplot2/ | |
# This is basically the TL;DR and it also uses a built-in dataset to foster reproducibility | |
library(ggplot2) | |
library(viridis) | |
gg <- ggplot(airquality, aes(x=Day, y=Month, fill=Temp)) | |
gg <- gg + geom_tile(color='White', size=0.1) | |
gg <- gg + scale_fill_viridis(name="Temperature") | |
gg <- gg + coord_equal() + ggtitle("Sample Heat Map for Population") | |
gg | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment