-
A wrapper function around viridis
to
+
A wrapper function around viridis
to
turn it into a palette function compatible with
discrete_scale
.
diff --git a/docs/search.json b/docs/search.json
deleted file mode 100644
index 786ec82..0000000
--- a/docs/search.json
+++ /dev/null
@@ -1 +0,0 @@
-[{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"tldr","dir":"Articles","previous_headings":"","what":"tl;dr","title":"Introduction to the viridis color maps","text":"Use color scales package make plots pretty, better represent data, easier read colorblindness, print well gray scale. Install viridis like R package: base plots, use viridis() function generate palette: ggplot, use scale_color_viridis() scale_fill_viridis():","code":"install.packages(\"viridis\") library(viridis) x <- y <- seq(-8*pi, 8*pi, len = 40) r <- sqrt(outer(x^2, y^2, \"+\")) filled.contour(cos(r^2)*exp(-r/(2*pi)), axes=FALSE, color.palette=viridis, asp=1) library(ggplot2) ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) + geom_hex() + coord_fixed() + scale_fill_viridis() + theme_bw()"},{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Introduction to the viridis color maps","text":"viridis, companion package viridisLite provide series color maps designed improve graph readability readers common forms color blindness /color vision deficiency. color maps also perceptually-uniform, regular form also converted black--white printing. color maps designed : Colorful, spanning wide palette possible make differences easy see, Perceptually uniform, meaning values close similar-appearing colors values far away different-appearing colors, consistently across range values, Robust colorblindness, properties hold true people common forms colorblindness, well grey scale printing, Pretty, oh pretty viridisLite provides base functions generating color maps base R. package meant lightweight dependency-free possible maximum compatibility R ecosystem. viridis provides additional functionalities, particular bindings ggplot2.","code":""},{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"the-color-scales","dir":"Articles","previous_headings":"","what":"The Color Scales","title":"Introduction to the viridis color maps","text":"package contains eight color scales: “viridis”, primary choice, five alternatives similar properties - “magma”, “plasma”, “inferno”, “civids”, “mako”, “rocket” -, rainbow color map - “turbo”. color maps viridis, magma, inferno, plasma created Stéfan van der Walt (@stefanv) Nathaniel Smith (@njsmith). want know science behind creation color maps, can watch presentation viridis authors SciPy 2015. color map cividis corrected version ‘viridis’, developed Jamie R. Nuñez, Christopher R. Anderton, Ryan S. Renslow, originally ported R Marco Sciaini (@msciain). info cividis can found paper. color maps mako rocket originally created Seaborn statistical data visualization package Python. info mako rocket can found Seaborn website. color map turbo developed Anton Mikhailov address shortcomings Jet rainbow color map false detail, banding color blindness ambiguity. infor turbo can found .","code":""},{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"comparison","dir":"Articles","previous_headings":"","what":"Comparison","title":"Introduction to the viridis color maps","text":"Let’s compare viridis magma scales commonly used sequential color palettes R: Base R palettes: rainbow.colors, heat.colors, cm.colors default ggplot2 palette Sequential colorbrewer palettes, default blues viridis-like yellow-green-blue immediately clear “rainbow” palette perceptually uniform; several “kinks” apparent color changes quickly short range values. also true, though less , “heat” colors. scales perceptually uniform, “viridis” stands large perceptual range. makes much use available color space possible maintaining uniformity. Now, let’s compare might appear various forms colorblindness, can simulated using dichromat package:","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"desaturated","dir":"Articles","previous_headings":"Comparison","what":"Desaturated","title":"Introduction to the viridis color maps","text":"can see cases, “rainbow” quite problematic - perceptually consistent across range. “Heat” washes bright colors, brewer scales lesser extent. ggplot scale wash , low perceptual range - ’s much contrast low high values. “viridis” “magma” scales better - cover wide perceptual range brightness brightness blue-yellow, rely much red-green contrast. less well tritanopia (blue-blindness), extrememly rare form colorblindness.","code":""},{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"usage","dir":"Articles","previous_headings":"","what":"Usage","title":"Introduction to the viridis color maps","text":"viridis() function produces viridis color scale. can choose color scale options using option parameter convenience functions magma(), plasma(), inferno(), cividis(), mako(), rocket(), andturbo()`. inferno() scale used raster U.S. max temperature: package also contains color scale functions ggplot plots: scale_color_viridis() scale_fill_viridis(). viridis(), can use scales option argument ggplot scales. “magma” scale used cloropleth map U.S. unemployment: ggplot functions also can used discrete scales argument discrete=TRUE.","code":"library(terra) library(httr) par(mfrow=c(1,1), mar=rep(0.5, 4)) temp_raster <- \"http://ftp.cpc.ncep.noaa.gov/GIS/GRADS_GIS/GeoTIFF/TEMP/us_tmax/us.tmax_nohads_ll_20150219_float.tif\" try(GET(temp_raster, write_disk(\"us.tmax_nohads_ll_20150219_float.tif\")), silent=TRUE) us <- rast(\"us.tmax_nohads_ll_20150219_float.tif\") us <- project(us, y=\"+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs\") image(us, col=inferno(256), asp=1, axes=FALSE, xaxs=\"i\", xaxt='n', yaxt='n', ann=FALSE) library(maps) ## ## Attaching package: 'maps' ## The following object is masked from 'package:viridis': ## ## unemp library(mapproj) data(unemp, package = \"viridis\") county_df <- map_data(\"county\", projection = \"albers\", parameters = c(39, 45)) names(county_df) <- c(\"long\", \"lat\", \"group\", \"order\", \"state_name\", \"county\") county_df$state <- state.abb[match(county_df$state_name, tolower(state.name))] county_df$state_name <- NULL state_df <- map_data(\"state\", projection = \"albers\", parameters = c(39, 45)) choropleth <- merge(county_df, unemp, by = c(\"state\", \"county\")) choropleth <- choropleth[order(choropleth$order), ] ggplot(choropleth, aes(long, lat, group = group)) + geom_polygon(aes(fill = rate), colour = alpha(\"white\", 1 / 2), linewidth = 0.2) + geom_polygon(data = state_df, colour = \"white\", fill = NA) + coord_fixed() + theme_minimal() + ggtitle(\"US unemployment rate by county\") + theme(axis.line = element_blank(), axis.text = element_blank(), axis.ticks = element_blank(), axis.title = element_blank()) + scale_fill_viridis(option=\"magma\") p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(size=4, aes(colour = factor(cyl))) + scale_color_viridis(discrete=TRUE) + theme_bw()"},{"path":"https://sjmgarnier.github.io/viridis/articles/intro-to-viridis.html","id":"gallery","dir":"Articles","previous_headings":"","what":"Gallery","title":"Introduction to the viridis color maps","text":"examples viridis used wild: James Curley uses viridis matrix plots (Code): Christopher Moore created contour plots potential dynamic plankton-consumer model:","code":""},{"path":"https://sjmgarnier.github.io/viridis/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Simon Garnier. Author, maintainer. Noam Ross. Contributor, copyright holder. Bob Rudis. Contributor, copyright holder. Marco Sciaini. Contributor, copyright holder. Antônio Pedro Camargo. Contributor, copyright holder. Cédric Scherer. Contributor, copyright holder.","code":""},{"path":"https://sjmgarnier.github.io/viridis/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Simon Garnier, Noam Ross, Robert Rudis, Antônio P. Camargo, Marco Sciaini, Cédric Scherer (2023). viridis(Lite) - Colorblind-Friendly Color Maps R. viridis package version 0.6.3.","code":"@Manual{, title = {{viridis(Lite)} - Colorblind-Friendly Color Maps for R}, author = {{Garnier} and {Simon} and {Ross} and {Noam} and {Rudis} and {Robert} and {Camargo} and Antônio Pedro and {Sciaini} and {Marco} and {Scherer} and {Cédric}}, year = {2023}, note = {viridis package version 0.6.3}, url = {https://sjmgarnier.github.io/viridis/}, doi = {10.5281/zenodo.4679424}, }"},{"path":[]},{"path":"https://sjmgarnier.github.io/viridis/index.html","id":"description","dir":"","previous_headings":"","what":"Description","title":"Colorblind-Friendly Color Maps for R","text":"viridis, companion package viridisLite provide series color maps designed improve graph readability readers common forms color blindness /color vision deficiency. color maps also perceptually-uniform, regular form also converted black--white printing. viridisLite provides base functions generating color maps base R. package meant lightweight dependency-free possible maximum compatibility R ecosystem. viridis provides additional functionalities, particular bindings ggplot2.","code":""},{"path":"https://sjmgarnier.github.io/viridis/index.html","id":"the-color-maps","dir":"","previous_headings":"","what":"The color maps","title":"Colorblind-Friendly Color Maps for R","text":"latest version viridis comes 8 different color maps, pretty!!!","code":""},{"path":"https://sjmgarnier.github.io/viridis/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Colorblind-Friendly Color Maps for R","text":"can install viridis CRAN typing following line R console: {r} install.packages(\"viridis\") library(viridis) prefer install development version GitHub repository, simply copy following lines code R terminal install everything need use viridisLite computer: ```{r} (!require(“devtools”)) install.packages(“devtools”) devtools::install_github(“sjmgarnier/viridis”) library(viridis) ```","code":""},{"path":"https://sjmgarnier.github.io/viridis/index.html","id":"references","dir":"","previous_headings":"","what":"References","title":"Colorblind-Friendly Color Maps for R","text":"color maps viridis, magma, inferno, plasma created Stéfan van der Walt (@stefanv) Nathaniel Smith (@njsmith). want know science behind creation color maps, can watch presentation viridis authors SciPy 2015. color map cividis corrected version ‘viridis’, developed Jamie R. Nuñez, Christopher R. Anderton, Ryan S. Renslow, originally ported R Marco Sciaini (@msciain). info cividis can found paper. color maps mako rocket originally created Seaborn statistical data visualization package Python. info mako rocket can found Seaborn website. color map turbo developed Anton Mikhailov address shortcomings Jet rainbow color map false detail, banding color blindness ambiguity. infor turbo can found .","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. viridisLite cividis, inferno, magma, mako, plasma, rocket, turbo, viridis, viridis.map","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/scale_viridis.html","id":null,"dir":"Reference","previous_headings":"","what":"Viridis Color Scales for ggplot2 — scale_fill_viridis","title":"Viridis Color Scales for ggplot2 — scale_fill_viridis","text":"Scale functions (fill colour/color) ggplot2. discrete == FALSE (default) arguments scale_fill_gradientn scale_color_gradientn. Otherwise function return discrete_scale plot-computed number colors. See viridis viridis.map information color palettes.","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/scale_viridis.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Viridis Color Scales for ggplot2 — scale_fill_viridis","text":"","code":"scale_fill_viridis( ..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, option = \"D\", aesthetics = \"fill\" ) scale_color_viridis( ..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, option = \"D\", aesthetics = \"color\" ) scale_colour_viridis( ..., alpha = 1, begin = 0, end = 1, direction = 1, discrete = FALSE, option = \"D\", aesthetics = \"color\" )"},{"path":"https://sjmgarnier.github.io/viridis/reference/scale_viridis.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Viridis Color Scales for ggplot2 — scale_fill_viridis","text":"... Parameters discrete_scale discrete == TRUE, scale_fill_gradientn/ scale_color_gradientn discrete == FALSE. alpha alpha transparency, number [0,1], see argument alpha hsv. begin (corrected) hue [0,1] color map begins. end (corrected) hue [0,1] color map ends. direction Sets order colors scale. 1, default, colors output viridis_pal. -1, order colors reversed. discrete Generate discrete palette? (default: FALSE - generate continuous palette). option character string indicating color map option use. Eight options available: \"magma\" (\"\") \"inferno\" (\"B\") \"plasma\" (\"C\") \"viridis\" (\"D\") \"cividis\" (\"E\") \"rocket\" (\"F\") \"mako\" (\"G\") \"turbo\" (\"H\") aesthetics Character string vector character strings listing name(s) aesthetic(s) scale works . can useful, example, apply colour settings colour fill aesthetics time, via aesthetics = c(\"colour\", \"fill\").","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/scale_viridis.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Viridis Color Scales for ggplot2 — scale_fill_viridis","text":"Noam Ross noam.ross@gmail.com / @noamross Bob Rudis bob@rud./ @hrbrmstr Simon Garnier: garnier@njit.edu / @sjmgarnier","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/scale_viridis.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Viridis Color Scales for ggplot2 — scale_fill_viridis","text":"","code":"library(ggplot2) # Ripped from the pages of ggplot2 p <- ggplot(mtcars, aes(wt, mpg)) p + geom_point(size = 4, aes(colour = factor(cyl))) + scale_color_viridis(discrete = TRUE) + theme_bw() # Ripped from the pages of ggplot2 dsub <- subset(diamonds, x > 5 & x < 6 & y > 5 & y < 6) dsub$diff <- with(dsub, sqrt(abs(x - y)) * sign(x - y)) d <- ggplot(dsub, aes(x, y, colour = diff)) + geom_point() d + scale_color_viridis() + theme_bw() # From the main viridis example dat <- data.frame(x = rnorm(10000), y = rnorm(10000)) ggplot(dat, aes(x = x, y = y)) + geom_hex() + coord_fixed() + scale_fill_viridis() + theme_bw() library(ggplot2) library(MASS) library(gridExtra) data(\"geyser\", package=\"MASS\") ggplot(geyser, aes(x = duration, y = waiting)) + xlim(0.5, 6) + ylim(40, 110) + stat_density2d(aes(fill = ..level..), geom = \"polygon\") + theme_bw() + theme(panel.grid = element_blank()) -> gg grid.arrange( gg + scale_fill_viridis(option = \"A\") + labs(x = \"Viridis A\", y = NULL), gg + scale_fill_viridis(option = \"B\") + labs(x = \"Viridis B\", y = NULL), gg + scale_fill_viridis(option = \"C\") + labs(x = \"Viridis C\", y = NULL), gg + scale_fill_viridis(option = \"D\") + labs(x = \"Viridis D\", y = NULL), gg + scale_fill_viridis(option = \"E\") + labs(x = \"Viridis E\", y = NULL), gg + scale_fill_viridis(option = \"F\") + labs(x = \"Viridis F\", y = NULL), gg + scale_fill_viridis(option = \"G\") + labs(x = \"Viridis G\", y = NULL), gg + scale_fill_viridis(option = \"H\") + labs(x = \"Viridis H\", y = NULL), ncol = 4, nrow = 2 )"},{"path":"https://sjmgarnier.github.io/viridis/reference/unemp.html","id":null,"dir":"Reference","previous_headings":"","what":"USA Unemployment in 2009 — unemp","title":"USA Unemployment in 2009 — unemp","text":"data set containing 2009 unemployment data USA county.","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/unemp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"USA Unemployment in 2009 — unemp","text":"","code":"unemp"},{"path":"https://sjmgarnier.github.io/viridis/reference/unemp.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"USA Unemployment in 2009 — unemp","text":"data frame 3218 rows 8 variables: id county ID number state_fips state FIPS number county_fips county FIPS number name county name year year rate unemployment rate county county abbreviated name state state acronym","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/unemp.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"USA Unemployment in 2009 — unemp","text":"http://datasets.flowingdata.com/unemployment09.csv","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/viridis_pal.html","id":null,"dir":"Reference","previous_headings":"","what":"Viridis Color Palettes — viridis_pal","title":"Viridis Color Palettes — viridis_pal","text":"wrapper function around viridis turn palette function compatible discrete_scale.","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/viridis_pal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Viridis Color Palettes — viridis_pal","text":"","code":"viridis_pal(alpha = 1, begin = 0, end = 1, direction = 1, option = \"D\")"},{"path":"https://sjmgarnier.github.io/viridis/reference/viridis_pal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Viridis Color Palettes — viridis_pal","text":"alpha alpha transparency, number [0,1], see argument alpha hsv. begin (corrected) hue [0,1] color map begins. end (corrected) hue [0,1] color map ends. direction Sets order colors scale. 1, default, colors ordered darkest lightest. -1, order colors reversed. option character string indicating color map option use. Eight options available: \"magma\" (\"\") \"inferno\" (\"B\") \"plasma\" (\"C\") \"viridis\" (\"D\") \"cividis\" (\"E\") \"rocket\" (\"F\") \"mako\" (\"G\") \"turbo\" (\"H\")","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/viridis_pal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Viridis Color Palettes — viridis_pal","text":"See viridis viridis.map information color palettes.","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/viridis_pal.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Viridis Color Palettes — viridis_pal","text":"Bob Rudis: bob@rud./ @hrbrmstr Simon Garnier: garnier@njit.edu / @sjmgarnier","code":""},{"path":"https://sjmgarnier.github.io/viridis/reference/viridis_pal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Viridis Color Palettes — viridis_pal","text":"","code":"library(scales) show_col(viridis_pal()(12))"},{"path":[]},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"new-features-0-6-3","dir":"Changelog","previous_headings":"","what":"New features","title":"viridis 0.6.3","text":"N/.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"minor-improvements-and-fixes-0-6-3","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"viridis 0.6.3","text":"Fix scale functions aesthetics specified (thanks Alan O’Callaghan, https://github.com/Alanocallaghan) Remove deprecated dependencies. Fix CITATION issues. Fix check issues.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"viridis-062","dir":"Changelog","previous_headings":"","what":"viridis 0.6.2","title":"viridis 0.6.2","text":"CRAN release: 2021-10-13","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"new-features-0-6-2","dir":"Changelog","previous_headings":"","what":"New features","title":"viridis 0.6.2","text":"N/.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"minor-improvements-and-fixes-0-6-2","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"viridis 0.6.2","text":"Fix minor check warnings requested CRAN.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"viridis-061","dir":"Changelog","previous_headings":"","what":"viridis 0.6.1","title":"viridis 0.6.1","text":"CRAN release: 2021-05-11","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"new-features-0-6-1","dir":"Changelog","previous_headings":"","what":"New features","title":"viridis 0.6.1","text":"N/.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"minor-improvements-and-fixes-0-6-1","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"viridis 0.6.1","text":"Include unemployment data package avoid CRAN check errors original data accessible.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"viridis-060","dir":"Changelog","previous_headings":"","what":"viridis 0.6.0","title":"viridis 0.6.0","text":"CRAN release: 2021-04-15","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"new-features-0-6-0","dir":"Changelog","previous_headings":"","what":"New features","title":"viridis 0.6.0","text":"Add 3 color maps: mako, rocket, turbo.","code":""},{"path":"https://sjmgarnier.github.io/viridis/news/index.html","id":"minor-improvements-and-fixes-0-6-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"viridis 0.6.0","text":"Minor bug fixes improvements .","code":""}]
diff --git a/docs/sitemap.xml b/docs/sitemap.xml
deleted file mode 100644
index 6c268f3..0000000
--- a/docs/sitemap.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-