scale_fill_zodiac: Discrete zodiac colors

Description Usage Arguments Examples

View source: R/zodiac_sign.R

Description

Discrete zodiac colors

Usage

1
scale_fill_zodiac(..., use_factor_order = FALSE)

Arguments

...

Extra parameters to pass to ggplot2::discrete_scale() when use_factor_order is FALSE (default).

use_factor_order

A logical. If TRUE, this will assign colors based on how they match with the zodiac sign. If FALSE (default) then the colors will be used without looking for zodiac sign values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
library(dplyr)
library(ggplot2)

## Use colors that match with each zodiac sign
p <-
  sample_dates %>%
  ## Sample 100 dates from 2020 to count
  sample_n(100) %>%
  mutate(zodiac_sign = zodiac_sign(date)) %>%
  ggplot() +
  aes(
    x = zodiac_sign,
    fill = zodiac_sign
  ) +
  geom_bar() +
  ## Set use_factor_order = TRUE
  scale_fill_zodiac(use_factor_order = TRUE)

## Use the colors in the palette without zodiac signs
p2 <-
  iris %>%
  ggplot() +
  aes(
    x = Species,
    fill = Species
  ) +
  geom_bar() +
  scale_fill_zodiac()

KoderKow/kowr documentation built on July 19, 2021, 4:18 p.m.