Skip to content

Commit

Permalink
Merge pull request #45 from mccarthy-m-g/housekeeping
Browse files Browse the repository at this point in the history
Housekeeping
  • Loading branch information
mccarthy-m-g authored Sep 19, 2024
2 parents 14c17fc + 491dca2 commit 329a872
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Included five new colour palette sets with the package: Cartography palettes (`discrete_palettes`, `sequential_palettes`, `diverging_palettes`), Performance palettes (`performance_palettes`), and Palmer penguins palettes (`penguin_palettes`).

- When plotting colour palettes with `plot()`, the order of facets now matches the order of palettes in `pal_palette()` objects.

# palettes 0.2.1

This is a small patch release that applies some internal fixes for the `scale_()` functions, due to a breaking change in ggplot2 v3.5.0 that deprecated the `scale_name` argument in `ggplot2::continuous_scale()`, `ggplot2::discrete_scale()` and `ggplot2::binned_scale()`. The "gt" vignette has also been updated to reflect changes to the `gt::data_color()` function in gt v0.9.0.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ plot_colour <- function(

x <- pal_ramp(x, n, direction, space, interpolate)
x <- tibble::as_tibble(x)
# The order of palettes in pal_palette() objects should be preserved.
if ("palette" %in% colnames(x)) {
x$palette <- factor(x$palette, levels = unique(x$palette))
}
# When the same colour is repeated in a pal_colour() or pal_palette() object
# it needs a unique position identifier in order to be plotted in the same
# order as it appears in the vector.
Expand Down
27 changes: 20 additions & 7 deletions vignettes/articles/made-with-palettes.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ library(gt)
library(fontawesome)
palettes:::made_with_palettes |>
rename(description = title) |>
rename(description = title, links = gh_url) |>
gt(id = "one") |>
cols_label(
package = md("**Package**"),
links = md("**Links**"),
description = md("**Description**"),
authors = md("**Author**")
) |>
fmt_url(
columns = gh_url,
columns = links,
label = html(fontawesome::fa("github")),
color = "#0d6efd",
show_underline = FALSE
Expand All @@ -34,30 +35,42 @@ palettes:::made_with_palettes |>
) |>
sub_missing() |>
cols_merge(
columns = c(package, gh_url, cran_url),
pattern = "{2} \u2002 {3} \u2002 {1}"
columns = c(links, cran_url),
pattern = "{1} \u2006 {2}"
) |>
# cols_width(
# package ~ pct(25),
# title ~ pct(40),
# authors ~ pct(35)
# ) |>
tab_style(
style = cell_text(whitespace = "nowrap"),
locations = cells_body(columns = links)
) |>
tab_options(
table.width = pct(100),
table.font.size = "100%"
) |>
opt_css(
css = "
table {
hyphens: none !important;
}
#one [id='<strong>Package</strong>'] {
width: 25%;
width: 20%;
}
#one [id='<strong>Description</strong>'] {
width: 50%;
width: 40%;
}
#one [id='<strong>Author</strong>'] {
width: 25%;
width: 20%;
}
#one [id='<strong>Links</strong>'] {
width: 20%;
}
#one svg {
Expand Down

0 comments on commit 329a872

Please sign in to comment.