Skip to content

Commit

Permalink
Replace sysdata.rda with code
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Jun 9, 2024
1 parent 2061426 commit 69bef01
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 62 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
^pkgdown$
^docs$

^data-raw$
^CONTRIBUTING\.md$
^CODE_OF_CONDUCT\.md$
^LICENSE\.md$
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ggsci
Type: Package
Title: Scientific Journal and Sci-Fi Themed Color Palettes for 'ggplot2'
Version: 3.1.0
Version: 3.1.0.9000
Authors@R: c(
person("Nan", "Xiao", email = "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0250-5673")),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# ggsci 3.1.0.9000

## Improvements

- Move internal color palette data from `R/sysdata.rda` to `R/palettes.R`.
This change enhances package development transparency, reduces unnecessary
indirection, and simplifies contributions by avoiding the construction
of the palette data using the R script in `data-raw/` (#42).

# ggsci 3.1.0

## New features
Expand Down
64 changes: 4 additions & 60 deletions data-raw/data-generator.R → R/palettes.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generate internal color palettes data `R/sysdata.rda`:
# - R Packages - Internal data. <https://r-pkgs.org/data.html#sec-data-sysdata>
# - Name that Color. <http://chir.ag/projects/name-that-color/>
# Construct color palettes data
#
# If not available, the color names are generated by "Name that Color" at
# <http://chir.ag/projects/name-that-color/>.

ggsci_db <- vector("list")

Expand Down Expand Up @@ -487,60 +488,3 @@ ggsci_db$"material"$"blue-grey" <- c(
"BlueGrey600" = "#546E7A", "BlueGrey700" = "#455A64",
"BlueGrey800" = "#37474F", "BlueGrey900" = "#263238"
)

save(ggsci_db, file = "R/sysdata.rda")

test_barplot <- function(palette, type) {
pal <- ggsci_db[[palette]][[type]]
barplot(rep(1, length(pal)), col = pal)
}

test_barplot("npg", "nrc")
test_barplot("aaas", "default")
test_barplot("nejm", "default")
test_barplot("lancet", "lanonc")
test_barplot("jama", "default")
test_barplot("bmj", "default")
test_barplot("jco", "default")
test_barplot("ucscgb", "default")
test_barplot("d3", "category10")
test_barplot("d3", "category20")
test_barplot("d3", "category20b")
test_barplot("d3", "category20c")
test_barplot("locuszoom", "default")
test_barplot("igv", "default")
test_barplot("igv", "alternating")
test_barplot("uchicago", "default")
test_barplot("uchicago", "light")
test_barplot("uchicago", "dark")
test_barplot("cosmic", "hallmarks_dark")
test_barplot("cosmic", "hallmarks_light")
test_barplot("cosmic", "signature_substitutions")
test_barplot("startrek", "uniform")
test_barplot("tron", "legacy")
test_barplot("futurama", "planetexpress")
test_barplot("rickandmorty", "schwifty")
test_barplot("simpsons", "springfield")
test_barplot("gsea", "default")
test_barplot("flatui", "default")
test_barplot("flatui", "flattastic")
test_barplot("flatui", "aussie")
test_barplot("material", "red")
test_barplot("material", "pink")
test_barplot("material", "purple")
test_barplot("material", "deep-purple")
test_barplot("material", "indigo")
test_barplot("material", "blue")
test_barplot("material", "light-blue")
test_barplot("material", "cyan")
test_barplot("material", "teal")
test_barplot("material", "green")
test_barplot("material", "light-green")
test_barplot("material", "lime")
test_barplot("material", "yellow")
test_barplot("material", "amber")
test_barplot("material", "orange")
test_barplot("material", "deep-orange")
test_barplot("material", "brown")
test_barplot("material", "grey")
test_barplot("material", "blue-grey")
Binary file removed R/sysdata.rda
Binary file not shown.

0 comments on commit 69bef01

Please sign in to comment.