The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
The DOYPAColors
package offers a variety of color
palettes designed to enhance your data visualizations in R. These
palettes are compatible with ggplot2
and are categorized
into three main types: sequential,
diverging, and qualitative. The
package also includes a section of colorblind-friendly palettes. This
vignette provides a quick guide on how to use the package, including how
to list available palettes, preview them, and apply them to your
plots.
To get started with DOYPAColors
, you can install the
package from CRAN:
Or you can install the development version from GitHub:
DOYPAColors
is designed to simplify the process of
selecting color palettes for your plots. You can quickly apply a palette
without overthinking the details by using the doypa()
function to automatically choose a palette that fits the type you need,
and then use scale_fill_doypa()
or
scale_color_doypa()
in your ggplot2
plots.
Simply specify the type of palette you want (seq
,
div
, qual
) and let DOYPAColors
handle the rest. For example:
library(ggplot2)
# Plot using automatic palette selection
ggplot(mtcars, aes(x = factor(cyl), fill = factor(cyl))) +
geom_bar() +
scale_fill_doypa(type = "qual", discrete = TRUE) +
theme_minimal() +
labs(title = "Bar Plot with Automatic DOYPAColors Palette")
#> Look what the palette fairy brought - it's the 'retro' palette! Now, let's get creative!
In this example, scale_fill_doypa(type = "qual")
automatically selects a qualitative palette suitable for the number of
categories in your data.
For additional options and customization, refer to the rest of this vignette.
To view all available palettes, use the
list_doypa_pals()
function:
# List all available DOYPAColors palettes
list_doypa_pals()
#> $sequential
#> [1] "blue" "deep" "blue_purple" "purple" "yellow_green"
#> [6] "doypa_qual" "regal_blue" "blue_red" "red" "orange"
#> [11] "pink" "gray"
#>
#> $diverging
#> [1] "blue2red" "purple2green" "mir"
#>
#> $qualitative
#> [1] "astro" "buzz" "cyberpunk" "earth"
#> [5] "goofy" "google" "doypa" "high_contrast"
#> [9] "nature" "retro" "rookie" "snack"
#> [13] "sunset" "tidy" "vaporwave"
You can preview all available palettes using the
preview_doypa_pals()
function:
To preview a single palette with multiple plots, use the
preview_pal()
function:
To retrieve a vector of colors from a specific palette, use the
doypa()
function. You can specify the palette you want by
name, or simply call the function without arguments to get a default
palette. If you’re unsure which palette to use, let
DOYPAColors
choose one for you:
# Retrieve colors from a specific palette
doypa_colors <- doypa(palette = "retro")
print(doypa_colors)
#> [1] "#D54751" "#EF9A48" "#FFFCC7" "#4DA394" "#59322B"
# Retrieve a default palette if no palette name is provided
default_palette_colors <- doypa()
#> We've selected a random palette for you: sunset
print(default_palette_colors)
#> [1] "#FF4500" "#FF2400" "#FF007F" "#800080"
In the first example, replace "retro"
with the name of
the palette you want to use. If you omit the palette
argument, doypa()
will return the colors of a default
palette.
Integrate DOYPAColors palettes into your ggplot2
plots
using scale_fill_doypa()
for fill aesthetics and
scale_color_doypa()
for color aesthetics. Here’s an example
of how to apply a qualitative palette (type = "qual"
) to a
bar plot:
library(ggplot2)
# Create a bar plot with a DOYPAColors palette
ggplot(mtcars, aes(x = factor(cyl), fill = factor(cyl))) +
geom_bar() +
scale_fill_doypa(type = "qual", discrete = TRUE) +
theme_minimal() +
labs(title = "Bar Plot with DOYPAColors")
#> Ready to splash some color? Today's choice is the 'tidy' palette. Enjoy!
n
)Specify the number of colors to use from the palette with the
n
argument:
reverse
)Reverse the color order with the reverse
argument:
ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
geom_boxplot() +
scale_fill_doypa(palette = "buzz", reverse = TRUE, discrete = TRUE) +
theme_classic() +
ggtitle("Palette Reversed")
ggplot(iris, aes(x = Species, y = Sepal.Length, fill = Species)) +
geom_boxplot() +
scale_fill_doypa(palette = "buzz", n = 3, reverse = TRUE, discrete = TRUE) +
theme_classic() +
ggtitle("Palette Reversed (n = 3)")
The DOYPAColors
package makes it easy to apply diverse
and visually appealing color palettes to your data visualizations. With
options to list, preview, and customize palettes, you have the
flexibility to enhance your plots and make them more engaging. Explore
the various palettes and options to find the perfect fit for your
data.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.