Skip to content

Commit

Permalink
Merge pull request #6 from katelyndiaz/CRAN
Browse files Browse the repository at this point in the history
cran
  • Loading branch information
katelyndiaz committed Sep 14, 2023
2 parents f1a317e + d7be590 commit 87c95f6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, master, CRAN]
pull_request:
branches: [main, master]
branches: [main, master, CRAN]

name: R-CMD-check

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ name: R

on:
push:
branches: [ main ]
branches: [ main, CRAN ]
pull_request:
branches: [ main ]
branches: [ main, CRAN ]

permissions:
contents: read
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
r-version: ['3.6.3', '4.1.1']
r-version: ['4.1.1']

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggRtsy
Type: Package
Title: Add Some Van Gogh Colors and Overlay Colors on Your `ggplot()`
Title: Add Some Van Gogh Colors and Overlay Colors on Your 'ggplot()'
Version: 0.1.0
Authors@R: c(
person("Katelyn", "Diaz", email = "katndiaz@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-6108-1682")),
Expand All @@ -9,14 +9,14 @@ Authors@R: c(
person("Aushanae", "Haller", email = "aushanaenhaller@gmail.com", role = "edt", comment = c(ORCID = "0000-0002-2090-1952"))
)
Maintainer: Katelyn Diaz <katndiaz@gmail.com>
Description: Works with `ggplot2()` to add a Van Gogh color palette to the user’s repertoire.
It also has a function that work alongside `ggplot2()` to create more interesting data visualizations and add contextual information to the user’s plots.
Description: Works with 'ggplot2()' to add a Van Gogh color palette to the user’s repertoire.
It also has a function that work alongside 'ggplot2()' to create more interesting data visualizations and add contextual information to the user’s plots.
License: CC0
Encoding: UTF-8
LazyData: true
Depends:
R (>= 2.10)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Imports:
purrr,
stringr,
Expand Down
23 changes: 11 additions & 12 deletions R/PaletteColors.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ gogh_interpolate <- function(palette = "starryNight", reverse = FALSE, ...) {
#' @param reverse Boolean, will be TRUE if the user wants the palette reversed
#' @param discrete Boolean if color aesthetic is discrete
#' @param ... further arguments passed to [ggRtsy::scale_color_gogh()]
#' @examples
#' if (require(ggplot2)) {
#' data <- data.frame(c = LETTERS[1:3],x = c(1,5,7),y = c(5,9,13))
#' ggplot(data, aes(x,y,color = c))+geom_point()+scale_color_gogh()
#' }
#' @export
#' @return A ggplot2 color scale.
#' If `discrete` is TRUE, it returns a discrete color scale; otherwise, a continuous color scale.
Expand All @@ -43,7 +48,7 @@ scale_color_gogh <- function(palette = "starryNight",
if (discrete == TRUE) {
ggplot2::discrete_scale("colour", paste0("gogh_", palette), palette = pal, ...)
} else {
ggplot2::scale_colour_gradientn(colours = pal(256), ...)
ggplot2::scale_colour_gradientn(colours = pal(256), ...) # gradient is the default for continuous
}
}

Expand All @@ -53,6 +58,11 @@ scale_color_gogh <- function(palette = "starryNight",
#' @param reverse Boolean if the palette should be reversed
#' @param ... Additional arguments used to discrete_scale() or scale_fill_gradientn()
#' to automatically interpolate between colors.
#' @examples
#' if (require(ggplot2)) {
#' data <- data.frame(c = LETTERS[1:3],x = c(1,5,7),y = c(5,9,13))
#' ggplot(data, aes(x,fill=c))+geom_bar()+scale_fill_gogh()
#' }
#' @export
#' @return No return value. Called for side effects.
scale_fill_gogh <- function(palette = "sunflowers", discrete = TRUE, reverse = FALSE, ...) {
Expand All @@ -64,14 +74,3 @@ scale_fill_gogh <- function(palette = "sunflowers", discrete = TRUE, reverse = F
}
}

#' @examples
#' if (require(ggplot2)) {
#' data <- data.frame(c = LETTERS[1:3],x = c(1,5,7),y = c(5,9,13))
#' ggplot(data, aes(x,y,color = c))+geom_point()+scale_color_gogh()
#' }

#' @examples
#' if (require(ggplot2)) {
#' data <- data.frame(c = LETTERS[1:3],x = c(1,5,7),y = c(5,9,13))
#' ggplot(data, aes(x,fill=c))+geom_bar()+scale_fill_gogh()
#' }
6 changes: 5 additions & 1 deletion man/gogh_interpolate.Rd

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

6 changes: 5 additions & 1 deletion man/scale_color_gogh.Rd

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

6 changes: 3 additions & 3 deletions man/scale_fill_gogh.Rd

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

0 comments on commit 87c95f6

Please sign in to comment.