Skip to content

Commit

Permalink
add check, badges and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vidonne committed Sep 26, 2023
1 parent 4be36ff commit 2747e31
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^cccmthemes\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
.httr-oauth
.DS_Store
.quarto

*.html
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Package: cccmthemes
Title: What the Package Does (One Line, Title Case)
Title: CCCM `ggplot2` Theme and Colour Palettes
Version: 0.0.0.9000
Authors@R:
c(person("Cédric", "Vidonne",
email = "cedric@vidonne.me",
role = c("aut", "cre")),
person("UNHCR",
role = "cph"))
Description: What the package does (one paragraph).
Description: `ggplot2` theme and color palettes following
the CCCM Design Guide.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
78 changes: 78 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
output: github_document
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# cccmthemes

<!-- badges: start -->
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![R-CMD-check](https://github.com/unhcr-dataviz/cccmthemes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/unhcr-dataviz/cccmthemes/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/cccmthemes)](https://CRAN.R-project.org/package=cccmthemes)
<!-- badges: end -->

Simplify the creation of your data visualizations with the `{cccmthemes}` R package. It is designed to align your plots with [CCCM's Design Guide](https://www.cccmcluster.org/branding-collection) recommendations. This package offers a comprehensive `{ggplot2}` theme, including built-in customizations and thoughtfully crafted color palettes.

## Installation

Get started by installing the `{cccmthemes}` package from GitHub using the `{pak}` library:

```{r install, eval=FALSE}
# If pak is not yet installed, uncomment the following line:
# install.packages("pak")
pak::pkg_install("unhcr-dataviz/cccmthemes")
```

## Usage

```{r load, message = FALSE, warning = FALSE, eval=FALSE}
# Load required packages
library(ggplot2)
library(cccmthemes)
```

### Base `{ggplot2}` theme

```{r base-plot, message = FALSE, warning = FALSE, out.width="90%", fig.align="center", eval=FALSE}
# Apply the theme_unhcr() to your plot
ggplot(
mtcars,
aes(x = hp, y = mpg)
) +
geom_point() +
labs(
title = "Simple scatterplot with ggplot",
subtitle = "This plot shows the default style of theme_cccm()",
x = "Horsepower (hp)",
y = "Fuel efficiency (mpg)",
caption = "Source: mtcars"
) +
theme_cccm()
```

### Font

The officially recommended font is [`Inter`](https://fonts.google.com/specimen/Inter). To ensure optimal functionality of the `{cccmthemes}` package, please make sure that the `Inter` font is installed on your device prior to usage.

## Acknowledgements

We extend our gratitude to the creators of the [`{hrbrthemes}`](https://github.com/hrbrmstr/hrbrthemes), [`{cowplot}`](https://github.com/wilkelab/cowplot/) and [`{unhcrthemes}`](https://github.com/unhcr-dataviz/unhcrthemes) packages that influenced the development of `{cccmthemes}`.

## Contribution

Contributions to `{cccmthemes}` are highly valued. If you have suggestions, uncover bugs, or envision new features, kindly submit an [issue on GitHub](https://github.com/unhcr-dataviz/cccmthemes/issues). To contribute code, don't hesitate to fork the repository and create a pull request.

## License

This package is distributed under the [MIT License](https://github.com/unhcr-dataviz/cccmthemes/blob/master/LICENSE.md).
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# cccmthemes

<!-- badges: start -->

[![Project Status: WIP – Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![R-CMD-check](https://github.com/unhcr-dataviz/cccmthemes/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/unhcr-dataviz/cccmthemes/actions/workflows/R-CMD-check.yaml)
[![CRAN
status](https://www.r-pkg.org/badges/version/cccmthemes)](https://CRAN.R-project.org/package=cccmthemes)
<!-- badges: end -->

Simplify the creation of your data visualizations with the
`{cccmthemes}` R package. It is designed to align your plots with
[CCCM’s Design Guide](https://www.cccmcluster.org/branding-collection)
recommendations. This package offers a comprehensive `{ggplot2}` theme,
including built-in customizations and thoughtfully crafted color
palettes.

## Installation

Get started by installing the `{cccmthemes}` package from GitHub using
the `{pak}` library:

``` r
# If pak is not yet installed, uncomment the following line:
# install.packages("pak")

pak::pkg_install("unhcr-dataviz/cccmthemes")
```

## Usage

``` r
# Load required packages
library(ggplot2)
library(cccmthemes)
```

### Base `{ggplot2}` theme

``` r
# Apply the theme_unhcr() to your plot
ggplot(
mtcars,
aes(x = hp, y = mpg)
) +
geom_point() +
labs(
title = "Simple scatterplot with ggplot",
subtitle = "This plot shows the default style of theme_cccm()",
x = "Horsepower (hp)",
y = "Fuel efficiency (mpg)",
caption = "Source: mtcars"
) +
theme_cccm()
```

### Font

The officially recommended font is
[`Inter`](https://fonts.google.com/specimen/Inter). To ensure optimal
functionality of the `{cccmthemes}` package, please make sure that the
`Inter` font is installed on your device prior to usage.

## Acknowledgements

We extend our gratitude to the creators of the
[`{hrbrthemes}`](https://github.com/hrbrmstr/hrbrthemes),
[`{cowplot}`](https://github.com/wilkelab/cowplot/) and
[`{unhcrthemes}`](https://github.com/unhcr-dataviz/unhcrthemes) packages
that influenced the development of `{cccmthemes}`.

## Contribution

Contributions to `{cccmthemes}` are highly valued. If you have
suggestions, uncover bugs, or envision new features, kindly submit an
[issue on GitHub](https://github.com/unhcr-dataviz/cccmthemes/issues).
To contribute code, don’t hesitate to fork the repository and create a
pull request.

## License

This package is distributed under the [MIT
License](https://github.com/unhcr-dataviz/cccmthemes/blob/master/LICENSE.md).

0 comments on commit 2747e31

Please sign in to comment.