Skip to content

Commit

Permalink
version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ErdaradunGaztea authored and cran-robot committed Nov 1, 2022
1 parent 9d220d9 commit ef667be
Show file tree
Hide file tree
Showing 26 changed files with 1,496 additions and 152 deletions.
19 changes: 11 additions & 8 deletions DESCRIPTION
@@ -1,23 +1,26 @@
Package: gglgbtq
Type: Package
Title: Show Pride on 'ggplot2' Plots
Version: 0.1.0
Date: 2022-08-06
Version: 0.1.1
Date: 2022-11-01
Authors@R: c(person("Laura", "Bakala",
email = "erdaradun.gaztea@gmail.com",
role = c("cre", "aut", "cph")))
role = c("cre", "aut", "cph"),
comment = c(ORCID = "0000-0002-3213-2484")))
Description: Provides multiple palettes based on pride flags with tailored themes.
Imports: ggplot2, graphics, grDevices
Suggests: spelling, testthat (>= 3.0.0)
Suggests: knitr, rmarkdown, spelling, testthat (>= 3.0.0)
License: GPL (>= 3)
Encoding: UTF-8
RoxygenNote: 7.1.2
Config/testthat/edition: 3
URL: https://github.com/turtletopia/gglgbtq
URL: https://github.com/turtletopia/gglgbtq,
https://turtletopia.github.io/gglgbtq/
Language: en-US
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2022-08-14 08:37:36 UTC; matib
Author: Laura Bakala [cre, aut, cph]
Packaged: 2022-11-01 10:14:44 UTC; erdar
Author: Laura Bakala [cre, aut, cph] (<https://orcid.org/0000-0002-3213-2484>)
Maintainer: Laura Bakala <erdaradun.gaztea@gmail.com>
Repository: CRAN
Date/Publication: 2022-08-16 09:00:05 UTC
Date/Publication: 2022-11-01 10:40:16 UTC
41 changes: 25 additions & 16 deletions MD5
@@ -1,20 +1,29 @@
26c9fa10252192a94c9183aa22ed7a5f *DESCRIPTION
c75b33ed5c95e80cb6c612b23547e423 *NAMESPACE
a97a1a3ea30bdfe03c66763a0d30be07 *NEWS.md
30e4a4ea31d100cb624016f739a19080 *DESCRIPTION
210abc7c362b85ca3ab5b69af8088749 *NAMESPACE
bce77161d3ea252c38a6bc429b7b7f08 *NEWS.md
d514a375879150aaa754524c707f3120 *R/palettes.R
6193cf425cf4f497ebdbe7c38c713857 *R/summary.R
00341b6226b2e8f49b605c11ffd007b2 *R/themes.R
e78e86cec5f8eff430dd4d1d692cda65 *R/summary.R
46820901c9359e3c32b9f0c391d14989 *R/themes.R
b54a9c6bb1ad01c193cb310894737908 *R/utils-docs.R
c4045648bf2b8f5c25bde6b11fbe09f8 *R/utils.R
c515940a0607ada359c4899255f1434f *R/zzz.R
3b317558f7de67c3dac752af4125205b *R/zzz_data.R
87f7d3538bfb305dff87d11dc5788789 *R/utils.R
7845ce67e09447e07ab7c60eb6c91a27 *R/zzz.R
c97d845628a5dd3892ae291849212ec7 *R/zzz_data.R
72876005ed82662e299d737aa8d8967a *build/vignette.rds
aac602f1c98de02b008f1ad985c39d80 *inst/WORDLIST
ae4fe8f714cb3bb1ecc4c376701a4dcf *man/palette_lgbtq.Rd
a45957995d18e08351c7248c68936475 *man/roxygen/templates/name.R
75731936cf31d8b4f0f8fb890f0acf40 *man/show_pride.Rd
7ac4799f0ad741cd13a5fe347254cbcb *man/theme_lgbtq.Rd
6d045301088f527473dd67cf50db7120 *inst/doc/gallery.R
6b02e628dccf6fd1eb77f79dbd4227b0 *inst/doc/gallery.Rmd
99e6f84b8d915b544e47b560799d24cf *inst/doc/gallery.html
89885693413847e1041f23ce8085355c *inst/doc/palette_history.R
f0330d55b18e7c98068ae6a2d1b30975 *inst/doc/palette_history.Rmd
bbccfb8b98db4a3159b46391214fb285 *inst/doc/palette_history.html
b3ae5b8429f1998ebadee13311223f89 *man/palette_lgbtq.Rd
0c6ae0c85796de909a5470ce414d82bb *man/roxygen/templates/name.R
f32644214988221145a27ff4c6ed712d *man/show_pride.Rd
6acf40434e3c923bd72eb382373c1d6f *man/theme_lgbtq.Rd
332173f20d20942c02019350ea4dcadc *tests/spelling.R
a4aef5431209f47ce8487f4f6e9cda15 *tests/testthat.R
227b2a6f06642c2f7041a59f59707ee3 *tests/testthat/test-palettes.R
439f5dc17e2b86c687957797dd03b856 *tests/testthat/test-summary.R
41d36fe309cd5964501e3bd84389ebbb *tests/testthat/test-themes.R
46349e2359fcba7a7bf6902bf1f5d29d *tests/testthat.R
fd22651f54c8e3a3eb35bfaa80573728 *tests/testthat/test-palettes.R
4d527e4ae7f18865db291383bf97d58e *tests/testthat/test-summary.R
f7ca981cd8976bc22b682740c1a8c8c0 *tests/testthat/test-themes.R
6b02e628dccf6fd1eb77f79dbd4227b0 *vignettes/gallery.Rmd
f0330d55b18e7c98068ae6a2d1b30975 *vignettes/palette_history.Rmd
30 changes: 15 additions & 15 deletions NAMESPACE
@@ -1,15 +1,15 @@
# Generated by roxygen2: do not edit by hand
S3method(print,lgbtq_palette)
export(palette_lgbtq)
export(show_pride)
export(theme_lgbtq)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_rect)
importFrom(ggplot2,rel)
importFrom(ggplot2,theme)
importFrom(grDevices,rgb)
importFrom(graphics,image)
importFrom(graphics,par)
importFrom(graphics,rect)
importFrom(graphics,text)
# Generated by roxygen2: do not edit by hand

S3method(print,lgbtq_palette)
export(palette_lgbtq)
export(show_pride)
export(theme_lgbtq)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_rect)
importFrom(ggplot2,rel)
importFrom(ggplot2,theme)
importFrom(grDevices,rgb)
importFrom(graphics,image)
importFrom(graphics,par)
importFrom(graphics,rect)
importFrom(graphics,text)
7 changes: 7 additions & 0 deletions NEWS.md
@@ -1,3 +1,10 @@
# gglgbtq 0.1.1

* Fixed potential error due to directly accessing `ggplot2::theme()`.
* Implemented the following palettes: `agender`, `alloace`, `aroallo`, `bigender`, `demiboy`, `demigirl`.
* Changed `gay_man` to `gay` (and, analogously, `gay_7`).
* Moved palettes to the "Gallery" vignette.

# gglgbtq 0.1.0

* Initial version of the package.
Expand Down
36 changes: 18 additions & 18 deletions R/summary.R
@@ -1,18 +1,18 @@
#' List available palettes
#'
#' @description Shows the names of available LGBTQ palettes and their metadata.
#'
#' @return A `data.frame` with palette names and numbers of colors.
#'
#' @examples
#' show_pride()
#'
#' @export
show_pride <- function() {
data.frame(
palettes = names(pride_data),
lengths = vapply(pride_data, function(p) length(p[["colors"]]),
integer(1), USE.NAMES = FALSE),
stringsAsFactors = FALSE
)
}
#' List available palettes
#'
#' @description Shows the names of available LGBTQ palettes and their metadata.
#'
#' @return A `data.frame` with palette names and numbers of colors.
#'
#' @examples
#' show_pride()
#'
#' @export
show_pride <- function() {
data.frame(
palettes = names(pride_data),
lengths = vapply(pride_data, function(p) length(p[["colors"]]),
integer(1), USE.NAMES = FALSE),
stringsAsFactors = FALSE
)
}
33 changes: 31 additions & 2 deletions R/themes.R
Expand Up @@ -53,5 +53,34 @@ theme_lgbtq_white <- function(...) {
)
}

# Default settings are fine
theme_bisexual <- ggplot2::theme
theme_agender <- function(...) {
ggplot2::theme(
panel.background = element_rect(fill = "#DDE3D8", color = NA),
panel.grid.minor = element_line(size = rel(0.5)),
legend.key = element_rect(fill = "#DDE3D8", color = NA),
...
)
}

theme_demiboy <- function(...) {
ggplot2::theme(
panel.background = element_rect(fill = "#D8E0E3", color = NA),
panel.grid.minor = element_line(size = rel(0.5)),
legend.key = element_rect(fill = "#D8E0E3", color = NA),
...
)
}

theme_demigirl <- function(...) {
ggplot2::theme(
panel.background = element_rect(fill = "#E3DADD", color = NA),
panel.grid.minor = element_line(size = rel(0.5)),
legend.key = element_rect(fill = "#E3DADD", color = NA),
...
)
}

# Default settings are fine too
theme_ggplot2 <- function(...) {
ggplot2::theme(...)
}
22 changes: 11 additions & 11 deletions R/utils.R
@@ -1,11 +1,11 @@
extract_colors <- function(palette) {
pride_data[[palette]][["colors"]]
}

extract_theme <- function(palette) {
pride_data[[palette]][["theme"]] %||% theme_lgbtq_default
}

`%||%` <- function(object, default) {
if (is.null(object)) default else object
}
extract_colors <- function(palette) {
pride_data[[palette]][["colors"]]
}

extract_theme <- function(palette) {
pride_data[[palette]][["theme"]] %||% theme_lgbtq_default
}

`%||%` <- function(object, default) {
if (is.null(object)) default else object
}
30 changes: 15 additions & 15 deletions R/zzz.R
@@ -1,15 +1,15 @@
.onLoad <- function(libname, pkgname) {
prev_options <- options()

new_options <- list(
gglgbtq_bg = "white",
gglgbtq_font_size = 2.5
)

unset_inds <- !(names(new_options) %in% names(prev_options))
if (any(unset_inds)) {
options(new_options[unset_inds])
}

invisible()
}
.onLoad <- function(libname, pkgname) {
prev_options <- options()

new_options <- list(
gglgbtq_bg = "white",
gglgbtq_font_size = 2.5
)

unset_inds <- !(names(new_options) %in% names(prev_options))
if (any(unset_inds)) {
options(new_options[unset_inds])
}

invisible()
}
28 changes: 25 additions & 3 deletions R/zzz_data.R
Expand Up @@ -13,7 +13,7 @@ pride_data <- list(
),
bisexual = list(
colors = c("#D00070", "#8C4799", "#0032A0"),
theme = theme_bisexual
theme = theme_ggplot2
),
asexual = list(
colors = c("#000000", "#A4A4A4", "#FFFFFF", "#810081")
Expand All @@ -31,7 +31,7 @@ pride_data <- list(
lesbian = list(
colors = c("#D62900", "#FF9B55", "#FFFFFF", "#D461A6", "#A50062")
),
gay_man = list(
gay = list(
colors = c("#078D70", "#98E8C1", "#FFFFFF", "#7BADE2", "#3D1A78")
),
intersex = list(
Expand All @@ -50,7 +50,29 @@ pride_data <- list(
lesbian_7 = list(
colors = c("#A60061", "#B95594", "#D162A8", "#FFFFFF", "#E5ADD1", "#C64D53", "#8C1801")
),
gay_man_7 = list(
gay_7 = list(
colors = c("#078D70", "#26CEAA", "#98E8C1", "#FFFFFF", "#7BADE2", "#5049CC", "#3D1A78")
),
agender = list(
colors = c("#000000", "#BCC4C7", "#FFFFFF", "#B7F684"),
theme = theme_agender
),
demiboy = list(
colors = c("#7F7F7F", "#C4C4C4", "#9DD7EA", "#FFFFFF"),
theme = theme_demiboy
),
demigirl = list(
colors = c("#7F7F7F", "#C4C4C4", "#FDADC8", "#FFFFFF"),
theme = theme_demigirl
),
bigender = list(
colors = c("#C479A2", "#EDA5CD", "#D6C7E8", "#FFFFFF", "#9AC7E8", "#6D82D1"),
theme = theme_ggplot2
),
alloace = list(
colors = c("#D50100", "#F85858", "#FFFFFF", "#81007F")
),
aroallo = list(
colors = c("#3DA542", "#A8D379", "#FFFFFF", "#FBE34B", "#E8BB00")
)
)
Binary file added build/vignette.rds
Binary file not shown.
76 changes: 76 additions & 0 deletions inst/doc/gallery.R
@@ -0,0 +1,76 @@
## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.height = 1.6,
fig.width = 5
)
library(gglgbtq)
options(gglgbtq_font_size = 1.7)

## ----rainbow------------------------------------------------------------------
palette_lgbtq("rainbow")

## ----lesbian------------------------------------------------------------------
palette_lgbtq("lesbian")

## ----gay----------------------------------------------------------------------
palette_lgbtq("gay")

## ----bisexual-----------------------------------------------------------------
palette_lgbtq("bisexual")

## ----transgender--------------------------------------------------------------
palette_lgbtq("transgender")

## ----asexual------------------------------------------------------------------
palette_lgbtq("asexual")

## ----intersex-----------------------------------------------------------------
palette_lgbtq("intersex")

## ----nonbinary----------------------------------------------------------------
palette_lgbtq("nonbinary")

## ----philadelphia-------------------------------------------------------------
palette_lgbtq("philadelphia")

## ----progress-----------------------------------------------------------------
palette_lgbtq("progress")

## ----aromantic----------------------------------------------------------------
palette_lgbtq("aromantic")

## ----alloace------------------------------------------------------------------
palette_lgbtq("alloace")

## ----aroallo------------------------------------------------------------------
palette_lgbtq("aroallo")

## ----pansexual----------------------------------------------------------------
palette_lgbtq("pansexual")

## ----lesbian_7----------------------------------------------------------------
palette_lgbtq("lesbian_7")

## ----gay_7--------------------------------------------------------------------
palette_lgbtq("gay_7")

## ----demiboy------------------------------------------------------------------
palette_lgbtq("demiboy")

## ----demigirl-----------------------------------------------------------------
palette_lgbtq("demigirl")

## ----genderfluid--------------------------------------------------------------
palette_lgbtq("genderfluid")

## ----genderqueer--------------------------------------------------------------
palette_lgbtq("genderqueer")

## ----agender------------------------------------------------------------------
palette_lgbtq("agender")

## ----bigender-----------------------------------------------------------------
palette_lgbtq("bigender")

0 comments on commit ef667be

Please sign in to comment.