Title: | 'Okabe-Ito' Scales for 'ggplot2' and 'ggraph' |
Version: | 0.1.0 |
Description: | Discrete scales for the colorblind-friendly 'Okabe-Ito' palette, including 'color', 'fill', and 'edge_colour'. 'ggokabeito' provides 'ggplot2' and 'ggraph' scales to easily use the 'Okabe-Ito' palette in your data visualizations. |
License: | MIT + file LICENSE |
URL: | https://github.com/malcolmbarrett/ggokabeito, https://malcolmbarrett.github.io/ggokabeito/ |
BugReports: | https://github.com/malcolmbarrett/ggokabeito/issues |
Depends: | R (≥ 4.0.0) |
Imports: | ggplot2, grDevices |
Suggests: | covr, ggraph, igraph, spelling, testthat (≥ 3.0.0), vdiffr |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
RoxygenNote: | 7.1.2 |
NeedsCompilation: | no |
Packaged: | 2021-10-15 19:30:07 UTC; malcolmbarrett |
Author: | Malcolm Barrett |
Maintainer: | Malcolm Barrett <malcolmbarrett@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2021-10-18 14:40:04 UTC |
ggokabeito: 'Okabe-Ito' Scales for 'ggplot2' and 'ggraph'
Description
Discrete scales for the colorblind-friendly 'Okabe-Ito' palette, including 'color', 'fill', and 'edge_colour'. 'ggokabeito' provides 'ggplot2' and 'ggraph' scales to easily use the 'Okabe-Ito' palette in your data visualizations.
Author(s)
Maintainer: Malcolm Barrett malcolmbarrett@gmail.com (ORCID)
See Also
Useful links:
Report bugs at https://github.com/malcolmbarrett/ggokabeito/issues
Okabe-Ito Palette
Description
palette_okabe_ito()
is a wrapper around palette.colors()
that returns the
Okabe-Ito palette in R 4.0.0 or greater. palette_okabe_ito()
returns an
unnamed vector of colors for better use with ggplot2. Additionally, black is
the last color returned by palette_okabe_ito()
when 9 colors are needed
instead of the first, as in palette.colors()
.
Usage
palette_okabe_ito(order = 1:9, alpha = NULL, recycle = FALSE)
Arguments
order |
A numeric vector, the order of the colors |
alpha |
an alpha-transparency level in the range [0,1] (0 means transparent and 1 means opaque). |
recycle |
logical indicating what happens in case |
Value
A character vector of hex codes
Examples
palette_okabe_ito()
palette_okabe_ito(order = c(2, 3, 5), alpha = 0.9)
Okabe-Ito Scales for ggplot2 and ggraph
Description
Discrete scales for the colorblind-friendly Okabe-Ito palette, including
color
, fill
, and edge_colour
. See palette_okabe_ito for
details.
Usage
scale_okabe_ito(aesthetics, order = 1:9, alpha = 1, ...)
scale_colour_okabe_ito(aesthetics = "colour", order = 1:9, alpha = NULL, ...)
scale_color_okabe_ito(aesthetics = "colour", order = 1:9, alpha = NULL, ...)
scale_fill_okabe_ito(aesthetics = "fill", order = 1:9, alpha = NULL, ...)
scale_edge_colour_okabe_ito(
aesthetics = "edge_colour",
order = 1:9,
alpha = NULL,
...
)
scale_edge_color_okabe_ito(
aesthetics = "edge_colour",
order = 1:9,
alpha = NULL,
...
)
Arguments
aesthetics |
The names of the aesthetics that this scale works with. |
order |
A numeric vector, the order of the colors |
alpha |
an alpha-transparency level in the range [0,1] (0 means transparent and 1 means opaque). |
... |
Additonal arguments passed to |
Value
A ggplot or ggraph scale
Examples
library(ggplot2)
ggplot(mpg, aes(cty, hwy, color = class)) +
geom_point() +
scale_color_okabe_ito()
ggplot(mpg, aes(cty, hwy, color = factor(cyl))) +
geom_point(alpha = 0.7) +
scale_color_okabe_ito(name = "Cylinders", alpha = .9)
ggplot(mpg, aes(hwy, color = class, fill = class)) +
geom_density() +
scale_fill_okabe_ito(name = "Class", alpha = .9) +
scale_color_okabe_ito(name = "Class")