Skip to content

Commit

Permalink
add some more colors, vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Aug 19, 2024
1 parent 0c7ef79 commit 99526b8
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 25 deletions.
47 changes: 36 additions & 11 deletions R/scale_color_tate.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#' ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, colour = Species)) +
#' geom_point() +
#' theme_abyss() +
#' scale_colour_tate(palette = "fontana")
#' scale_colour_tate(palette = "light")
#' @export
scale_color_tate <- function(palette = "history",
scale_color_tate <- function(palette = "modern",
discrete = TRUE,
reverse = FALSE,
aesthetics = "color",
Expand All @@ -42,7 +42,7 @@ scale_color_tate <- function(palette = "history",

#' @rdname scale_color_tate
#' @export
scale_color_tate_d <- function(palette = "history",
scale_color_tate_d <- function(palette = "modern",
discrete = TRUE,
reverse = FALSE,
aesthetics = "color",
Expand All @@ -58,7 +58,7 @@ scale_color_tate_d <- function(palette = "history",

#' @rdname scale_color_tate
#' @export
scale_color_tate_c <- function(palette = "history",
scale_color_tate_c <- function(palette = "modern",
discrete = FALSE,
reverse = FALSE,
aesthetics = "color",
Expand Down Expand Up @@ -94,7 +94,7 @@ scale_colour_tate_d <- scale_color_tate_d

#' @rdname scale_color_tate
#' @export
scale_fill_tate <- function(palette = "history",
scale_fill_tate <- function(palette = "modern",
discrete = TRUE,
reverse = FALSE,
aesthetics = "fill",
Expand All @@ -111,7 +111,7 @@ scale_fill_tate <- function(palette = "history",

#' @rdname scale_color_tate
#' @export
scale_fill_tate_d <- function(palette = "history",
scale_fill_tate_d <- function(palette = "modern",
discrete = TRUE,
reverse = FALSE,
aesthetics = "fill",
Expand All @@ -127,7 +127,7 @@ scale_fill_tate_d <- function(palette = "history",

#' @rdname scale_color_tate
#' @export
scale_fill_tate_c <- function(palette = "history",
scale_fill_tate_c <- function(palette = "modern",
discrete = FALSE,
reverse = FALSE,
aesthetics = "fill",
Expand Down Expand Up @@ -157,7 +157,23 @@ tate_colors_list <- c(
scarlett = "#7D2D36",
red = "#A5102E",
rose = "#C97B6F",
yellow = "#C78F52"
yellow = "#C78F52",
# light palettes
`light green` = "#92901F",
`light brown` = "#844C22",
`light amber` = "#D49C02",
`light grey`= "#898765",

Check warning on line 165 in R/scale_color_tate.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/scale_color_tate.R,line=165,col=15,[infix_spaces_linter] Put spaces around all infix operators.
`light beige` = "#C4A362",
`light scarlett` = "#A73C46",
`light red` = "#C51A38",
`light rose` = "#E49B90",
`light yellow` = "#E7A963",
# other
mint = "#96FFFA",
teal = "#008080",
orange = "#FF7F00",
blue = "#6495ED",
lavender = "#DDA0DD"
)


Expand Down Expand Up @@ -188,8 +204,17 @@ tate_colors <- function(...) {

tate_palettes <- list(
full = tate_colors(),
history = tate_colors("dark green", "brown", "amber", "grey", "beige"),
fontana = tate_colors("scarlett", "red", "rose", "yellow")
modern = tate_colors("yellow", "rose", "red", "brown", "grey", "dark green"),
mix = tate_colors (

Check warning on line 208 in R/scale_color_tate.R

View workflow job for this annotation

GitHub Actions / lint-changed-files / lint-changed-files

file=R/scale_color_tate.R,line=208,col=20,[function_left_parentheses_linter] Remove spaces before the left parenthesis in a function call.
"light rose", "light scarlett", "leight beige", "light grey",
"blue", "orange", "teal", "mint"
),
history = tate_colors("dark green", "grey", "brown", "beige", "amber"),
fontana = tate_colors("scarlett", "red", "rose", "yellow"),
light = tate_colors(
"light yellow", "light rose", "light red", "light brown",
"light grey", "light green"
)
)


Expand All @@ -201,7 +226,7 @@ tate_palettes <- list(
#' [`scale_color_tate()`][scale_color_tate].
#'
#' @export
palette_tate <- function(palette = "history", reverse = FALSE, ...) {
palette_tate <- function(palette = "modern", reverse = FALSE, ...) {
.retrieve_palette(palette, tate_palettes, reverse = reverse, ...)
}

Expand Down
4 changes: 2 additions & 2 deletions man/palette_tate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions man/scale_color_tate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tate_colors.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions vignettes/seecolorscales.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,50 @@ p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = group5)) +
plots(p1, p2, n_rows = 1)
```

# Tate Colors

## Tate Colors - Three Groups

```{r}
p1 <- ggplot(d1, aes(x, y, colour = group)) +
geom_line(linewidth = 1) +
scale_color_tate()
p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
geom_point2(size = 2.5) +
scale_color_tate()
plots(p1, p2, n_rows = 1)
```

## Tate Colors - Four Groups

```{r}
p1 <- ggplot(d2, aes(x, y, colour = group)) +
geom_line(linewidth = 1) +
scale_color_tate()
p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = group4)) +
geom_point2(size = 2.5) +
scale_color_tate()
plots(p1, p2, n_rows = 1)
```

## Tate Colors - Five Groups

```{r}
p1 <- ggplot(d3, aes(x, y, colour = group)) +
geom_line(linewidth = 1) +
scale_color_tate()
p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = group5)) +
geom_point2(size = 2.5) +
scale_color_tate()
plots(p1, p2, n_rows = 1)
```

# Overview of Palette Colors

```{r fig.height=12,echo=FALSE}
Expand Down
65 changes: 64 additions & 1 deletion vignettes/seecolorscales_dark.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,50 @@ p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = group5)) +
plots(p1, p2, n_rows = 1)
```

# Tate Colors

## Tate Colors - Three Groups

```{r}
p1 <- ggplot(d1, aes(x, y, colour = group)) +
geom_line(linewidth = 1) +
scale_color_tate(palette = "light")
p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
geom_point2(size = 2.5) +
scale_color_tate(palette = "light")
plots(p1, p2, n_rows = 1)
```

## Tate Colors - Four Groups

```{r}
p1 <- ggplot(d2, aes(x, y, colour = group)) +
geom_line(linewidth = 1) +
scale_color_tate(palette = "light")
p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = group4)) +
geom_point2(size = 2.5) +
scale_color_tate(palette = "light")
plots(p1, p2, n_rows = 1)
```

## Tate Colors - Five Groups

```{r}
p1 <- ggplot(d3, aes(x, y, colour = group)) +
geom_line(linewidth = 1) +
scale_color_tate(palette = "light")
p2 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = group5)) +
geom_point2(size = 2.5) +
scale_color_tate(palette = "light")
plots(p1, p2, n_rows = 1)
```

# Overview of Palette Colors

```{r fig.height=12,echo=FALSE}
Expand Down Expand Up @@ -474,6 +518,23 @@ p7 <- ggplot(d, aes(x, fill = x)) +
)
d <- data.frame(
x = names(tate_colors())
)
p8 <- ggplot(d, aes(x, fill = x)) +
geom_bar(width = 0.9) +
scale_fill_manual(values = tate_colors()) +
scale_y_continuous(labels = NULL, expand = c(0, 0)) +
guides(fill = "none") +
ylab(NULL) +
xlab(NULL) +
theme(
axis.text.x = element_text(angle = 90),
panel.grid = element_blank()
)
plots(
p1,
p2,
Expand All @@ -482,6 +543,7 @@ plots(
p5,
p6,
p7,
p8,
n_columns = 1,
tags = c(
"Social",
Expand All @@ -490,7 +552,8 @@ plots(
"Metro",
"See",
"Pizza",
"Bluebrown"
"Bluebrown",
"Tate"
)
)
```

0 comments on commit 99526b8

Please sign in to comment.