Easy Copy and Paste Viridis Color Palette Gradient For R

Viridis is a great palette to use because it shows contrast between low and high values very well, and is color-blind friendly. Below, I've written code that can be copy and pasted into R to change the color palette of your visualization to Viridis:

c(" #440154 ", " #414487 ", " #2A788E ", " #22A884 ", " #7ad151 "," #fde725 ")


Here's how to add the viridis color palette to R using scale_fill_gradientn:

scale_fill_gradientn(colors = c("#440154", "#414487", "#2A788E", "#22A884", "#7ad151","#fde725"), breaks = c("1,2,3,4,5,6"))


scale_fill_gradientn lets you use any colors you specify in your gradient. In this case, we specifies the colors of the viridis gradient!

26 views0 comments