Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Prepare for next release
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Jun 14, 2021
1 parent 80930a6 commit 1315260
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 106 deletions.
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: khroma
Title: Colour Schemes for Scientific Data Visualization
Version: 1.5.0.9000
Version: 1.6.0
Authors@R:
c(person(given = "Nicolas",
family = "Frerebeau",
Expand Down Expand Up @@ -33,17 +33,19 @@ BugReports: https://github.com/tesselle/khroma/issues
Depends:
R (>= 3.3)
Imports:
ggplot2,
grDevices,
grid,
scales,
spacesXYZ
stats,
utils
Suggests:
covr,
crayon,
fansi,
ggplot2,
knitr,
rmarkdown,
scales,
spacesXYZ,
testthat (>= 3.0.0),
vdiffr
VignetteBuilder:
Expand Down
9 changes: 1 addition & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,10 @@ export(scale_fill_vanimo)
export(scale_fill_vibrant)
export(scale_fill_vik)
export(scale_fill_vikO)
importFrom(ggplot2,aes)
importFrom(ggplot2,continuous_scale)
importFrom(ggplot2,discrete_scale)
importFrom(ggplot2,scale_color_manual)
importFrom(ggplot2,scale_fill_manual)
importFrom(grDevices,col2rgb)
importFrom(grDevices,colorRampPalette)
importFrom(grid,gpar)
importFrom(grid,grid.newpage)
importFrom(grid,grid.rect)
importFrom(grid,grid.text)
importFrom(grid,unit)
importFrom(scales,alpha)
importFrom(scales,gradient_n_pal)
importFrom(scales,rescale_mid)
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# khroma 1.5.0.9000
# khroma 1.6.0

## New functions
* Add `info()` to get a table of all available palettes.

## Internals
* Move **ggplot2**, **scales** and **spacesXYZ** from Imports to Suggests (#8).

# khroma 1.5.0

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4723613.svg)](https://doi.org/10.5281/zenodo.4723613)
Expand Down
1 change: 1 addition & 0 deletions R/compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @export
compare <- function(x, metric = 2000, diag = FALSE, upper = FALSE) {
# Validation
check_package("spacesXYZ")
if (!is.atomic(x) || !is.character(x))
stop("x must be a character vector of colours.", call. = FALSE)

Expand Down
7 changes: 7 additions & 0 deletions R/ggplot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ NULL

scale_discrete <- function(aesthetics, scale_name, reverse = FALSE,
use_names = FALSE, lang = "en", ...) {
# Check if ggplot2 is installed
check_package("ggplot2")

# Get colour scheme
palette <- colour(scale_name, reverse = reverse, names = use_names,
lang = lang)
Expand All @@ -51,6 +54,9 @@ scale_discrete <- function(aesthetics, scale_name, reverse = FALSE,

scale_continuous <- function(aesthetics, scale_name, reverse = FALSE,
lang = "en", range = c(0, 1), midpoint = 0, ...) {
# Validation
check_package("ggplot2") # Check if ggplot2 is installed

# Get colour scheme
palette <- colour(scale_name, reverse = reverse, names = FALSE, lang = lang)
max <- attr(palette, "max")
Expand Down Expand Up @@ -79,6 +85,7 @@ scale_continuous <- function(aesthetics, scale_name, reverse = FALSE,
#' @keywords internal
#' @noRd
mid_rescaler <- function(mid) {
check_package("scales") # Check if scales is installed
function(x, to = c(0, 1), from = range(x, na.rm = TRUE)) {
scales::rescale_mid(x, to, from, mid)
}
Expand Down
22 changes: 15 additions & 7 deletions R/khroma-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
#' \tabular{ll}{
#' **Package:** \tab khroma \cr
#' **Type:** \tab Package \cr
#' **Version:** \tab 1.5.0.9000 \cr
#' **Version:** \tab 1.6.0 \cr
#' **License:** \tab GPL-3 \cr
#' **Zenodo:** \tab \doi{10.5281/zenodo.1472077} \cr
#' }
#'
#' \doi{10.5281/zenodo.1472077}
#'
#' @author
#' **Full list of authors and contributors** (alphabetic order)
#' \tabular{ll}{
Expand All @@ -32,9 +31,18 @@
#' @keywords internal
"_PACKAGE"

#' @importFrom ggplot2 aes continuous_scale discrete_scale scale_color_manual
#' scale_fill_manual
#' @importFrom scales alpha gradient_n_pal rescale_mid
#' @importFrom grDevices colorRampPalette
# @importFrom ggplot2 aes continuous_scale discrete_scale scale_color_manual
# scale_fill_manual
# @importFrom scales alpha gradient_n_pal rescale_mid
# @importFrom spacesXYZ DeltaE
#' @importFrom grDevices col2rgb colorRampPalette
#' @importFrom grid gpar grid.newpage grid.rect grid.text unit
NULL

check_package <- function(x) {
if (!requireNamespace(x, quietly = TRUE)) {
msg <- "Package %s needed for this function to work. Please install it."
stop(sprintf(msg, x), call. = FALSE)
}
invisible(NULL)
}
12 changes: 9 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ remotes::install_github("tesselle/khroma")
```

## Usage

```{r packages}
# Load packages
## Load packages
library(khroma)
library(ggplot2)
## Install extra packages (if needed)
# install.packages(c("ggplot2", "spacesXYZ"))
```

<details>
Expand Down Expand Up @@ -109,7 +112,10 @@ plot_scheme(bright(7), colours = TRUE)

```{r usage-ggplot2, fig.height=3.5, fig.width=5, fig.align='center'}
# Use with ggplot2
ggplot2::ggplot(data = mpg, mapping = aes(x = displ, y = hwy, colour = class)) +
data(mpg, package = "ggplot2")
ggplot2::ggplot(data = mpg) +
ggplot2::aes(x = displ, y = hwy, colour = class) +
ggplot2::geom_point() +
scale_colour_bright()
```
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ remotes::install_github("tesselle/khroma")
## Usage

``` r
# Load packages
## Load packages
library(khroma)
library(ggplot2)

## Install extra packages (if needed)
# install.packages(c("ggplot2", "spacesXYZ"))
```

<details>
Expand Down Expand Up @@ -173,7 +175,10 @@ plot_scheme(bright(7), colours = TRUE)

``` r
# Use with ggplot2
ggplot2::ggplot(data = mpg, mapping = aes(x = displ, y = hwy, colour = class)) +
data(mpg, package = "ggplot2")

ggplot2::ggplot(data = mpg) +
ggplot2::aes(x = displ, y = hwy, colour = class) +
ggplot2::geom_point() +
scale_colour_bright()
```
Expand Down
76 changes: 43 additions & 33 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"issueTracker": "https://github.com/tesselle/khroma/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "1.5.0.9000",
"version": "1.6.0",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down Expand Up @@ -100,6 +100,18 @@
},
"sameAs": "https://CRAN.R-project.org/package=fansi"
},
{
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggplot2"
},
{
"@type": "SoftwareApplication",
"identifier": "knitr",
Expand All @@ -124,6 +136,30 @@
},
"sameAs": "https://CRAN.R-project.org/package=rmarkdown"
},
{
"@type": "SoftwareApplication",
"identifier": "scales",
"name": "scales",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=scales"
},
{
"@type": "SoftwareApplication",
"identifier": "spacesXYZ",
"name": "spacesXYZ",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=spacesXYZ"
},
{
"@type": "SoftwareApplication",
"identifier": "testthat",
Expand Down Expand Up @@ -157,18 +193,6 @@
"name": "R",
"version": ">= 3.3"
},
{
"@type": "SoftwareApplication",
"identifier": "ggplot2",
"name": "ggplot2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=ggplot2"
},
{
"@type": "SoftwareApplication",
"identifier": "grDevices",
Expand All @@ -181,31 +205,17 @@
},
{
"@type": "SoftwareApplication",
"identifier": "scales",
"name": "scales",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=scales"
"identifier": "stats",
"name": "stats"
},
{
"@type": "SoftwareApplication",
"identifier": "spacesXYZ",
"name": "spacesXYZ",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=spacesXYZ"
"identifier": "utils",
"name": "utils"
}
],
"readme": "https://github.com/tesselle/khroma/blob/master/README.md",
"fileSize": "1326.543KB",
"fileSize": "1334.651KB",
"contIntegration": "https://codecov.io/gh/tesselle/khroma",
"developmentStatus": "https://www.repostatus.org/#active",
"keywords": [
Expand All @@ -229,7 +239,7 @@
],
"name": "khroma: Colour Schemes for Scientific Data Visualization",
"url": "https://doi.org/10.5281/zenodo.1472077",
"description": "R package version 1.5.0"
"description": "R package version 1.6.0"
}
],
"releaseNotes": "https://github.com/tesselle/khroma/blob/master/NEWS.md"
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Reverse dependencies

We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 3 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages
6 changes: 3 additions & 3 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ citEntry(
year = "2021",
organization = "Université Bordeaux Montaigne",
address = "Pessac, France",
note = "R package version 1.5.0",
note = "R package version 1.6.0",
url = "https://doi.org/10.5281/zenodo.1472077",

textVersion =
paste("Frerebeau, Nicolas (2021).",
"khroma: Colour Schemes for Scientific Data Visualization.",
"R package version 1.5.0",
"R package version 1.6.0",
"Université Bordeaux Montaigne, Pessac, France.",
"DOI 10.5281/zenodo.1472077.",
"URL https://khroma.tesselle.org.")
"URL https://packages.tesselle.org/khroma.")
)
5 changes: 2 additions & 3 deletions man/khroma-package.Rd

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

2 changes: 1 addition & 1 deletion _pkgdown.yml → pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ template:
opengraph:
twitter:
creator: "@nfrerebeau"
card: summary_large_image
card: summary

reference:
- title: Colour Palette
Expand Down
Loading

0 comments on commit 1315260

Please sign in to comment.