Skip to content

Commit

Permalink
Merge pull request #114 from katilingban:dev
Browse files Browse the repository at this point in the history
add brewer palettes to ACDC and NHS vignettes; fix #110; fix #113
  • Loading branch information
ernestguevarra authored Jan 2, 2025
2 parents 310ad84 + 7cf629f commit a659e82
Show file tree
Hide file tree
Showing 4 changed files with 480 additions and 35 deletions.
41 changes: 20 additions & 21 deletions R/theme_acdc.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,32 @@ acdc_palettes <- list(
#'
acdc_brewer_palettes <- list(
blues = rev(c(acdc_blue, acdc_blue_grey, acdc_palettes$acdc_blues[2])),
bugn = c(acdc_blue, acdc_lime, acdc_teal),
bugn = c(acdc_blue, acdc_lime),
bupu = c(acdc_blue, acdc_blue_grey, acdc_purple),
gnbu = c(acdc_teal, acdc_lime, acdc_blue),
gnbu = c(acdc_lime, acdc_blue),
pubu = c(acdc_purple, acdc_blue_grey, acdc_blue),
pubugn = c(acdc_purple, acdc_blue, acdc_lime),
purd = c(acdc_purple, acdc_plum, acdc_pink),
rdpu = c(acdc_red, acdc_pink, acdc_purple),
ylgn = c(acdc_amber, acdc_teal, acdc_green),
ylgnbu = c(acdc_amber, acdc_lime, acdc_blue),
pubugn = c(acdc_purple, acdc_blue, acdc_green),
ylgn = c(acdc_amber, acdc_green),
ylgnbu = c(acdc_amber, acdc_green, acdc_blue),
ylorrd = c(acdc_amber, acdc_deep_orange, acdc_red),
piylgn = c(acdc_pink, acdc_amber, acdc_lime),
piylgn = c(acdc_pink, acdc_amber, acdc_green),
prgn = c(acdc_purple, acdc_mauve, acdc_green),
puor = c(acdc_purple, acdc_amber, acdc_deep_orange),
rdbu = c(acdc_red, acdc_plum, acdc_blue),
rdbu = c(acdc_red, acdc_blue),
rdylbu = c(acdc_red, acdc_amber, acdc_blue),
rdylgn = c(acdc_red, acdc_amber, acdc_lime),
rdylgn = c(acdc_red, acdc_amber, acdc_green),
pastel1 = c(
acdc_palettes$acdc_blues[3],
acdc_palettes$acdc_plums[3],
acdc_palettes$acdc_blue_grey[3],
acdc_palettes$acdc_amber[3],
acdc_palettes$acdc_cyan[3],
acdc_palettes$acdc_deep_orange[3],
acdc_palettes$acdc_purple[3],
acdc_palettes$acdc_lime[3],
acdc_palettes$acdc_mauve[3],
acdc_palettes$acdc_pink[3],
acdc_palettes$acdc_teal[3]
acdc_palettes$acdc_blues[4],
acdc_palettes$acdc_plums[4],
acdc_palettes$acdc_blue_grey[4],
acdc_palettes$acdc_amber[4],
acdc_palettes$acdc_cyan[4],
acdc_palettes$acdc_deep_orange[4],
acdc_palettes$acdc_purple[4],
acdc_palettes$acdc_lime[4],
acdc_palettes$acdc_mauve[4],
acdc_palettes$acdc_pink[4],
acdc_palettes$acdc_teal[4]
),
pastel2 = c(
acdc_palettes$acdc_blues[2],
Expand Down Expand Up @@ -178,6 +176,7 @@ acdc_fonts <- list(
acdc_arial = "Arial"
)


#'
#' Set ACDC font to use based on what is available from the system
#'
Expand Down
28 changes: 14 additions & 14 deletions R/theme_nhs.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,27 +145,27 @@ nhs_palettes <- list(
#'

nhs_brewer_palettes <- list(
blues = c(nhs_light_blue, nhs_blue, nhs_bright_blue),
bugn = c(nhs_light_blue, nhs_aqua_green, nhs_green),
blues = c(nhs_light_blue, nhs_bright_blue, nhs_dark_blue),
bugn = c(nhs_dark_blue, nhs_dark_green),
bupu = c(nhs_dark_blue, nhs_dark_pink, nhs_purple),
gnbu = c(nhs_aqua_green, nhs_aqua_blue, nhs_bright_blue),
gnbu = c(nhs_dark_green, nhs_dark_blue),
greens = c(nhs_light_green, nhs_green, nhs_dark_green),
greys = c(nhs_pale_grey, nhs_mid_grey, nhs_dark_grey),
pubu = c(nhs_purple, nhs_dark_pink, nhs_dark_blue),
pubugn = c(nhs_purple, nhs_blue, nhs_green),
purd = c(nhs_purple, nhs_dark_pink, nhs_dark_red),
rdpu = c(nhs_dark_red, nhs_dark_pink, nhs_purple),
reds = c(nhs_emergency_red, nhs_pink, nhs_dark_red),
ylgn = c(nhs_yellow, nhs_aqua_green, nhs_dark_green),
ylgnbu = c(nhs_yellow, nhs_aqua_blue, nhs_dark_blue),
pubu = c(nhs_purple, nhs_dark_blue),
pubugn = c(nhs_purple, nhs_dark_blue, nhs_dark_green),
purd = c(nhs_purple, nhs_emergency_red),
rdpu = c(nhs_emergency_red, nhs_purple),
reds = c(nhs_emergency_red, nhs_dark_red),
ylgn = c(nhs_yellow, nhs_dark_green),
ylgnbu = c(nhs_yellow, nhs_dark_green, nhs_dark_blue),
ylorrd = c(nhs_yellow, nhs_orange, nhs_dark_red),
piylgn = c(nhs_pink, nhs_yellow, nhs_green),
prgn = c(nhs_purple, nhs_pink, nhs_dark_green),
puor = c(nhs_purple, nhs_emergency_red, nhs_orange),
rdbu = c(nhs_dark_red, nhs_purple, nhs_dark_blue),
rdgy = c(nhs_dark_red, nhs_emergency_red, nhs_mid_grey),
rdylbu = c(nhs_emergency_red, nhs_yellow, nhs_bright_blue),
rdylgn = c(nhs_emergency_red, nhs_yellow, nhs_green),
rdbu = c(nhs_dark_red, nhs_emergency_red, nhs_dark_blue),
rdgy = c(nhs_dark_red, nhs_mid_grey, nhs_dark_grey),
rdylbu = c(nhs_dark_red, nhs_yellow, nhs_dark_blue),
rdylgn = c(nhs_dark_red, nhs_yellow, nhs_dark_green),
pastel1 = c(
nhs_palettes$nhs_light_blues[3], nhs_palettes$nhs_bright_blues[3],
nhs_palettes$nhs_greens[3], nhs_palettes$nhs_light_greens[3],
Expand Down
192 changes: 192 additions & 0 deletions vignettes/africa-cdc.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,198 @@ structure(acdc_palettes$acdc_pinks, class = "palette", name = "Africa CDC Pinks"
structure(acdc_palettes$acdc_teals, class = "palette", name = "Africa CDC Teals")
```

## Africa CDC sequential brewer palettes

### Blues

```{r acdc-blues-sequential, echo = FALSE, fig.alt = "Africa CDC sequential blues palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "blues", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Blues"
)
```

### Blue to green

```{r acdc-blue-green-sequential, echo = FALSE, fig.alt = "Africa CDC sequential blue to green palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "bugn", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Blue to Green"
)
```

### Blue to purple

```{r acdc-blue-purple-sequential, echo = FALSE, fig.alt = "Africa CDC sequential blue to purple palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "bupu", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Blue to Purple"
)
```

### Green to blue

```{r acdc-green-blue-sequential, echo = FALSE, fig.alt = "Africa CDC sequential green to blue palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "gnbu", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Green to Blue"
)
```

### Purple to blue

```{r acdc-purple-blue-sequential, echo = FALSE, fig.alt = "Africa CDC sequential purple to blue palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "pubu", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Purple to Blue"
)
```

### Purple to blue to green

```{r acdc-purple-blue-green-sequential, echo = FALSE, fig.alt = "Africa CDC sequential purple to blue to green palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "pubugn", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Purple to Blue to Green"
)
```

### Yellow to green

```{r acdc-yellow-green-sequential, echo = FALSE, fig.alt = "Africa CDC sequential yellow to green palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "ylgn", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Yellow to Green"
)
```

### Yellow to green to blue

```{r acdc-yellow-green-blue-sequential, echo = FALSE, fig.alt = "Africa CDC sequential yellow to green to blue palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "ylgnbu", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Yellow to Green to Blue"
)
```

### Yellow to orange to red

```{r acdc-yellow-orange-red-sequential, echo = FALSE, fig.alt = "Africa CDC sequential yellow to orange to red palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(n = 9, name = "ylorrd", org = "acdc"),
class = "palette",
name = "Africa CDC Sequential Yellow to Orange to Red"
)
```

## Africa CDC divergent brewer palettes

### Pink to yellow to green

```{r acdc-pink-yellow-green-sequential, echo = FALSE, fig.alt = "Africa CDC sequential pink to yellow to green palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "piylgn", org = "acdc", type = "divergent"
),
class = "palette",
name = "Africa CDC Sequential Pink to Yellow to Green"
)
```

### Purple to green

```{r acdc-purple-green-sequential, echo = FALSE, fig.alt = "Africa CDC sequential purple to green palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "prgn", org = "acdc", type = "divergent"
),
class = "palette",
name = "Africa CDC Sequential Purple to Green"
)
```

### Purple to orange

```{r acdc-purple-orange-sequential, echo = FALSE, fig.alt = "Africa CDC sequential purple to orange palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "puor", org = "acdc", type = "divergent"
),
class = "palette",
name = "Africa CDC Sequential Purple to Orange"
)
```

### Red to blue

```{r acdc-red-blue-sequential, echo = FALSE, fig.alt = "Africa CDC sequential red to blue palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "rdbu", org = "acdc", type = "divergent"
),
class = "palette",
name = "Africa CDC Sequential Red to Blue"
)
```

### Red to yellow to blue

```{r acdc-red-yellow-blue-sequential, echo = FALSE, fig.alt = "Africa CDC sequential red to yellow to blue palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "rdylbu", org = "acdc", type = "divergent"
),
class = "palette",
name = "Africa CDC Sequential Red to Yellow to Blue"
)
```

### Red to yellow to green

```{r acdc-red-yellow-green-sequential, echo = FALSE, fig.alt = "Africa CDC sequential red to yellow to green palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "rdylgn", org = "acdc", type = "divergent"
),
class = "palette",
name = "Africa CDC Sequential Red to Yellow to Green"
)
```

## Africa CDC qualitative palettes

### Pastel set 1

```{r acdc-pastel1-qualitative, echo = FALSE, fig.alt = "Africa CDC qualitative pastel set 1 palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "pastel1", org = "acdc", type = "qualitative"
),
class = "palette",
name = "Africa CDC Qualitative Pastel Set 1"
)
```

### Pastel set 2

```{r acdc-pastel2-qualitative, echo = FALSE, fig.alt = "Africa CDC qualitative pastel set 2 palette", fig.align = "center", fig.height = 1}
structure(
paleta_create_brewer(
n = 11, name = "pastel2", org = "acdc", type = "qualitative"
),
class = "palette",
name = "Africa CDC Qualitative Pastel Set 2"
)
```

## Africa CDC `ggplot2` theme

### Africa CDC light theme
Expand Down
Loading

0 comments on commit a659e82

Please sign in to comment.