Skip to content

Commit

Permalink
Merge pull request #16 from OxfordIHTM/dev
Browse files Browse the repository at this point in the history
add codefactor badget; lint palette functions
  • Loading branch information
ernestguevarra authored Feb 27, 2024
2 parents aae06b7 + c6bc268 commit ef249c1
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 29 deletions.
12 changes: 6 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Bugs

* Submit an issue on the [issues page](https://github.com/OxfordIHTM/icd/issues)
* Submit an issue on the [issues page](https://github.com/OxfordIHTM/oxfordtheme/issues)

## Code contributions

Expand All @@ -11,14 +11,14 @@
* Clone your version on your account down to your machine from your account

```
git clone https://github.com/<yourgithubusername>/icd.git
git clone https://github.com/<yourgithubusername>/oxfordtheme.git
```

* Make sure to track progress upstream i.e., on our version of `icd`
at `OxfordIHTM/icd`, by doing
* Make sure to track progress upstream i.e., on our version of `oxfordtheme`
at `OxfordIHTM/oxfordtheme`, by doing

```
git remote add upstream https://github.com/OxfordIHTM/icd.git
git remote add upstream https://github.com/OxfordIHTM/oxfordtheme.git
```

* Before making changes make sure to pull changes in from `upstream` by doing
Expand All @@ -32,4 +32,4 @@ documentation

* Push up changes to your account

* Submit a pull request at `OxfordIHTM/icd`
* Submit a pull request at `OxfordIHTM/oxfordtheme`
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ Suggests:
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
URL: http://oxford-ihtm.io/oxfordtheme/
Roxygen: list(markdown = TRUE)
URL: https://oxford-ihtm.io/oxfordtheme/,https://github.com/OxfordIHTM/oxfordtheme
BugReports: https://github.com/OxfordIHTM/oxfordtheme/issues
15 changes: 12 additions & 3 deletions R/create_palette.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ create_palette_sequential <- function(name, n) {
## Update palette to n ----
pal <- grDevices::colorRampPalette(pal)(n)

## Create palette class ----
class(pal) <- "palette"

## Return palette ----
structure(pal, class = "palette", name = name)
pal
}


Expand Down Expand Up @@ -91,8 +94,11 @@ create_palette_divergent <- function(name, n) {
## Update palette to n ----
pal <- grDevices::colorRampPalette(pal)(n)

## Create palette class ----
class(pal) <- "palette"

## Return palette ----
structure(pal, class = "palette", name = name)
pal
}

#'
Expand Down Expand Up @@ -134,8 +140,11 @@ create_palette_qualitative <- function(name, n) {
## Update palette to n ----
pal <- grDevices::colorRampPalette(pal)(n)

## Create palette class ----
class(pal) <- "palette"

## Return palette ----
structure(pal, class = "palette", name = name)
pal
}


Expand Down
7 changes: 6 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ library(ggplot2)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/OxfordIHTM/oxfordtheme/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/OxfordIHTM/oxfordtheme/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/OxfordIHTM/oxfordtheme/branch/main/graph/badge.svg)](https://app.codecov.io/gh/OxfordIHTM/oxfordtheme?branch=main)
[![CodeFactor](https://www.codefactor.io/repository/github/oxfordihtm/oxfordtheme/badge)](https://www.codefactor.io/repository/github/oxfordihtm/oxfordtheme)
<!-- badges: end -->

Palette, theme, and theme components based on [University of Oxford](https://ox.ac.uk)'s [visual identity guidelines](https://communications.web.ox.ac.uk/communications-resources/visual-identity/identity-guidelines).
Expand Down Expand Up @@ -121,7 +122,7 @@ structure(oxford_theme_palettes()$corporate, class = "palette", name = "corporat

The University of Oxford recommended theme palettes can be used for plotting. Below is code examples of how this can be done both with base R plotting function and with `ggplot2`.

#### Base R plot
#### Bar plots in base R and using `ggplot`

```{r mtcars-barplot, fig.show = "hold", fig.height = 8, out.width = "50%"}
## Barplot of cyl and vs of mtcars dataset using heritage Oxford theme
Expand Down Expand Up @@ -160,6 +161,7 @@ ggplot(
theme_minimal()
```

#### Scatter plots in base R and using `ggplot`

```{r mtcars-scatterplot, fig.show = "hold", fig.height = 8, out.width = "50%"}
## Scatterplot of mpg and disp of mtcars dataset using celebratory Oxford theme
Expand Down Expand Up @@ -196,6 +198,9 @@ ggplot(data = mtcars, mapping = aes(x = mpg, y = disp, colour = factor(cyl))) +
theme_minimal()
```

## Author/s

* [Ernest Guevarra](https://github.com/ernestguevarra)

## Community guidelines

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](h
[![R-CMD-check](https://github.com/OxfordIHTM/oxfordtheme/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/OxfordIHTM/oxfordtheme/actions/workflows/R-CMD-check.yaml)
[![Codecov test
coverage](https://codecov.io/gh/OxfordIHTM/oxfordtheme/branch/main/graph/badge.svg)](https://app.codecov.io/gh/OxfordIHTM/oxfordtheme?branch=main)
[![CodeFactor](https://www.codefactor.io/repository/github/oxfordihtm/oxfordtheme/badge)](https://www.codefactor.io/repository/github/oxfordihtm/oxfordtheme)
<!-- badges: end -->

Palette, theme, and theme components based on [University of
Expand Down Expand Up @@ -168,7 +169,7 @@ The University of Oxford recommended theme palettes can be used for
plotting. Below is code examples of how this can be done both with base
R plotting function and with `ggplot2`.

#### Base R plot
#### Bar plots in base R and using `ggplot`

``` r
## Barplot of cyl and vs of mtcars dataset using heritage Oxford theme
Expand Down Expand Up @@ -209,6 +210,8 @@ ggplot(

<img src="man/figures/README-mtcars-barplot-1.png" width="50%" /><img src="man/figures/README-mtcars-barplot-2.png" width="50%" />

#### Scatter plots in base R and using `ggplot`

``` r
## Scatterplot of mpg and disp of mtcars dataset using celebratory Oxford theme

Expand Down Expand Up @@ -246,6 +249,10 @@ ggplot(data = mtcars, mapping = aes(x = mpg, y = disp, colour = factor(cyl))) +

<img src="man/figures/README-mtcars-scatterplot-1.png" width="50%" /><img src="man/figures/README-mtcars-scatterplot-2.png" width="50%" />

## Author/s

- [Ernest Guevarra](https://github.com/ernestguevarra)

## Community guidelines

Feedback, bug reports and feature requests are welcome; file issues or
Expand Down
16 changes: 16 additions & 0 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
citHeader("To cite oxfordtheme in publications use:")

citEntry(
entry = "Manual",
title = "oxfordtheme: Oxford Palette, Theme, and Theme Components.",
author = person("Ernest Guevarra"),
year = "2024",
note = "R package version 0.0.9000",
url = "https://oxford-ihtm.io/oxfordtheme/",
textVersion = paste(
paste("Ernest Guevarra (2024).",
"oxfordtheme: Oxford Palette, Theme, and Theme Components.",
"R package version 0.0.9000.",
"URL https://oxford-ihtm.io/oxfordtheme/")
)
)
8 changes: 4 additions & 4 deletions man/create_palette.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/get_oxford_colour.Rd

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

17 changes: 8 additions & 9 deletions man/oxford_colours.Rd

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

3 changes: 2 additions & 1 deletion man/oxfordtheme.Rd

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

0 comments on commit ef249c1

Please sign in to comment.