## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 5, dpi = 96 ) ## ----load--------------------------------------------------------------------- library(prakriti) library(ggplot2) ## ----discover----------------------------------------------------------------- prakriti_names() prakriti_info() ## ----filter------------------------------------------------------------------- info <- prakriti_info() info[info$type == "diverging", ] ## ----pull--------------------------------------------------------------------- prakriti_palette("thar") prakriti_palette("himalaya", n = 3) ## ----reverse------------------------------------------------------------------ prakriti_palette("chinar", direction = -1) ## ----continuous--------------------------------------------------------------- prakriti_palette("nilgiri", n = 15, type = "continuous") ## ----display-one, fig.height = 1.5-------------------------------------------- display_prakriti("valley_of_flowers") ## ----display-all, fig.height = 14--------------------------------------------- display_prakriti() ## ----scatter, fig.height = 4-------------------------------------------------- ggplot(iris, aes(Sepal.Length, Petal.Length, color = Species, shape = Species)) + geom_point(size = 3, alpha = 0.85) + scale_color_prakriti("valley_of_flowers") + labs(title = "Iris measurements", x = "Sepal length (cm)", y = "Petal length (cm)") + theme_minimal() ## ----heatmap------------------------------------------------------------------ ggplot(faithfuld, aes(waiting, eruptions, fill = density)) + geom_raster(interpolate = TRUE) + scale_fill_prakriti("himalaya") + coord_cartesian(expand = FALSE) + labs(title = "Old Faithful eruption density") + theme_minimal() ## ----boxplot, fig.height = 4-------------------------------------------------- ggplot(mtcars, aes(factor(cyl), mpg, fill = factor(cyl))) + geom_boxplot() + scale_fill_prakriti("thar", discrete = TRUE) + labs(title = "MPG by cylinder count", x = "Cylinders", y = "MPG") + theme_minimal() + theme(legend.position = "none")