Skip to content

Commit

Permalink
Merge pull request #9 from AAGI-Org-AU-Public/colours
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks authored Jul 17, 2024
2 parents 172a73f + d5cabfb commit 8b0ba6b
Show file tree
Hide file tree
Showing 49 changed files with 324 additions and 689 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^docs$
^pkgdown$
^\.github$
^codecov\.yml$
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
.Rproj.user
inst/doc

.Rhistory

*.Rhistory
docs
25 changes: 14 additions & 11 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
Package: theme.aagi
Title: Apply AAGI Brand Guidelines to Graphic Output and Create AAGI
Themed Documents
Package: AAGIThemes
Title: Apply AAGI Brand Guidelines to Graphic Outputs and Tables
Version: 0.0.1
Authors@R: c(
person("Adam H.", "Sparks", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0061-8359")),
person("Kenyon", "Ng", , "[email protected]", role = "aut",
comment = c(ORCID = "0000-0002-6315-9831")),
person("Jimmy", "Ng", , "[email protected]", role = "ctb"),
person("Tinula", "Kariyawasam", , "[email protected]", role = c("aut")),
person("Tinula", "Kariyawasam", , "[email protected]", role = "aut"),
person("Matt", "Cowgill", , "[email protected]", role = "aut",
comment = "Wrote major portions of package for saving charts\n for 'Grattan' package, adapted to 'theme.aagi' under 'MIT'\n licence."),
comment = "Wrote major portions of package for saving charts\n for 'Grattan' package, adapted to 'AAGIThemes' under 'MIT'\n licence."),
person("Will", "Mackey", , "[email protected]", role = "aut",
comment = "Wrote major portions of package for saving charts\n for 'Grattan' package, adapted to 'theme.aagi' under 'MIT'\n licence."),
comment = "Wrote major portions of package for saving charts\n for 'Grattan' package, adapted to 'AAGIThemes' under 'MIT'\n licence."),
person("Curtin University of Technology", role = "cph")
)
Description: Applies 'AAGI' external brand guidelines to graphics. 'AAGI'
colours and font guidelines are applied as useful and reasonable to
both base graphics as well as 'ggplot2' figures and 'flextable' objects.
base graphics, 'ggplot2' figures and 'flextable' objects.
License: GPL (>= 3)
URL: https://github.com/AAGI-Org-AU-Public/theme.aagi, https://aagi-org-au-public.github.io/theme.aagi/
BugReports: https://github.com/AAGI-Org-AU-Public/theme.aagi/issues
URL: https://github.com/AAGI-Org-AU-Public/AAGIThemes,
https://aagi-org-au-public.github.io/AAGIThemes/
BugReports: https://github.com/AAGI-Org-AU-Public/AAGIThemes/issues
Depends:
R (>= 4.0.0)
Imports:
AAGIPalettes,
cli,
flextable,
ggplot2 (>= 3.3.5),
grDevices,
grid,
magick,
officer,
rlang,
scales,
showtext,
sysfonts,
Expand All @@ -52,11 +52,14 @@ Suggests:
viridis
VignetteBuilder:
knitr
Remotes:
AAGI-Org-AU-Public/AAGIPalettes
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
X-schema.org-applicationCategory: Tools
X-schema.org-isPartOf: https://grdc.com.au/research/partnerships-and-initiatives/strategic-partnerships/aagi
X-schema.org-isPartOf:
https://grdc.com.au/research/partnerships-and-initiatives/strategic-partnerships/aagi\
5 changes: 0 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# Generated by roxygen2: do not edit by hand

export(aagi_cols)
export(aagi_palettes)
export(add_aagi_logo)
export(barplot_aagi)
export(boxplot_aagi)
export(hist_aagi)
export(interpolate_aagi_palette)
export(plot_aagi)
export(scale_colour_aagi)
export(scale_fill_aagi)
export(theme_aagi)
export(theme_ft_aagi)
export(watermark)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# theme.aagi 0.0.1
# AAGIThemes 0.0.1

12 changes: 0 additions & 12 deletions R/aagi_cols.R

This file was deleted.

81 changes: 0 additions & 81 deletions R/aagi_ggplot2_scales.R

This file was deleted.

39 changes: 0 additions & 39 deletions R/aagi_palettes.R

This file was deleted.

11 changes: 5 additions & 6 deletions R/add_aagi_logo.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@


#' Insert AAGI's Logo Into Any Graphic File
#'
#' Insert the \acronym{AAGI} logo in any graphical image. Particularly well-
#' suited for use with files created with \pkg{theme.aagi}. The logo will be
#' suited for use with files created with \pkg{AAGIThemes}. The logo will be
#' inserted in the upper-left of the image with a size of at least 4.6 cm as
#' per \acronym{AAGI} brand guidelines.
#'
Expand Down Expand Up @@ -57,7 +56,7 @@ add_aagi_logo <- function(file_in, file_out, logo_scale = 2.5) {
system.file(
"logo",
"AAGI_logo_colour_CMYK.svg",
package = "theme.aagi",
package = "AAGIThemes",
mustWork = TRUE
)
)
Expand All @@ -67,7 +66,7 @@ add_aagi_logo <- function(file_in, file_out, logo_scale = 2.5) {
system.file(
"logo",
"AAGI_logo_colour_CMYK.svg",
package = "theme.aagi",
package = "AAGIThemes",
mustWork = TRUE
)
)
Expand All @@ -90,8 +89,8 @@ add_aagi_logo <- function(file_in, file_out, logo_scale = 2.5) {

# trim plot down, removes bottom border added earlier to make room for logo
plot_out <- magick::image_crop(plot_out,
geometry = paste0("0x", plot_height + 300),
gravity = "north")
geometry = paste0("0x", plot_height + 300),
gravity = "north")

magick::image_write(plot_out, file_out)
}
32 changes: 18 additions & 14 deletions R/barplot_aagi.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#' Basic Barplots Using a Unified AAGI Style and Typography
#'
#' @description Basic barplots that follow a standard \acronym{AAGI} style
Expand All @@ -12,9 +11,11 @@
#' heights of stacked sub-bars making up the bar. If height is a matrix and
#' beside is `TRUE`, then the values in each column are juxtaposed rather than
#' stacked.
#' @param col Colour to use as fill for bars Defaults to a very dark grey.
#' @param col Colour to use as fill for bars Defaults to "AAGI Black", a very
#' dark grey. Can be supplied as a named AAGI colour; *e.g.*, "AAGI Black";
#' a named colour, "black"; or a hexadecimal code, "#414042".
#' @param ... Arguments to be passed to methods, such as graphical parameters
#' (see [graphics::par]).
#' (see [graphics::par()]).
#'
#' @examples
#'
Expand All @@ -25,18 +26,21 @@
#' @export
#'
barplot_aagi <- function(height,
col = "#414042",
...) {

col = "AAGI Black",
...) {
# only validate if the colour is an official AAGI colour and convert to hex
if (substr(col, 1, 5) == "AAGI ") {
# validation/matching is done in {AAGIPalettes} so not needed here
col <- AAGIPalettes::colour_as_hex(col)
}
withr::local_par(.new = par_aagi())

graphics::plot.new()
withr::local_par(new = TRUE)
showtext::showtext_begin()
graphics::barplot(height = height,
col = col,
border = col,
xaxs = "i",
...)
graphics::barplot(
height = height,
col = col,
border = col,
xaxs = "i",
...
)
showtext::showtext_end()
}
Loading

0 comments on commit 8b0ba6b

Please sign in to comment.