theme_ft_aagi()andtheme_gt_aagi()now follow the font chosen by the AAGI Quarto template (via theAAGI_MAINFONTenvironment variable or theaagi_mainfontknitr::opts_knitoption) and otherwise fall back from Proxima Nova to Arial to "sans", so PDF output no longer fails when Proxima Nova is unavailable.
- Implement session-level font-caching
- Deletes unused directories that caused R Build error
- Fix roxygen2 code so that there are no error messages about missing {}
-
scale_fill_aagi()andscale_colour_aagi()are provided for use in {ggplot2} to easily use AAGI colours and palettes in graphs. -
use_aagi_style()is provided as a full wrapper that allows you to create a {ggplot2} object that uses boththeme_aagi()with either of thescale_aggi_()functions that autoselect based on data type.
-
plot_aagi()now accepts an explicityargument, supporting bothplot_aagi(x)andplot_aagi(x, y)calling conventions. -
hist_aagi()default histogram breaks changed from Sturges' rule to Scott's rule, which is more robust for skewed and heavy-tailed data. Thebreaksargument now accepts"scott"(default),"sturges","fd"(Freedman-Diaconis), or"exact"(fixed bin width of 1 for integer counts). -
theme_gt_aagi()now validates thatxis agt_tblobject before processing, providing a clear, user-friendly error message rather than a cryptic internal{gt}error.
-
Fixed a typo where the internal function
.set_aagi_font()was mistakenly prefixed as..set_aagi_font()in one call path. -
Fixed
hist_aagi()break computation to gracefully handle degenerate inputs (constant vectors or single-value data) without errors. -
Fixed panel graphics issues in
hist_aagi()where custom axis settings were not applied correctly whenpar(mfrow)/par(mfcol)was active. -
Fixed
cli::cli_warn()call inbarplot_aagi()to wrap the message vector inc(), resolving a malformed warning. -
Fixed recycling warning in
barplot_aagi()to correctly count bars for matrix inputs (now usesncol()for matrices instead oflength()). -
Fixed
theme_gt_aagi()to use the native pipe (|>) consistently throughout the{gt}pipeline. -
Fixed documentation for
hist_aagi(): the x-axis label defaults to an empty string, not the variable name from data.
-
The
colargument has been moved from explicit function parameters into...across all four base graphics wrappers (barplot_aagi(),boxplot_aagi(),hist_aagi(),plot_aagi()), providing a consistent interface and simplifying internal colour handling. -
watermark()input validation overhauled: uses dedicated internal assertion helpers (.assert_scalar_string(),.assert_scalar_number(),.assert_one_of()) with clearer{cli}-formatted error messages. -
Font resolution in internal utilities now uses a per-session cache (
.aagi_font_cache) to avoid repeatedsystemfonts::match_fonts()calls, improving load performance. -
DPI warning in
add_aagi_logo()softened to an informational message rather than a warning. -
Reduced cyclomatic complexity in
watermark()andhist_aagi()helper functions.
-
Removed dependency on
{rlang}for type-checking; all validation now uses idiomatic base R (is.character(),length(),is.na(), etc.). -
Internal font helpers (
.set_aagi_font(),.par_aagi(),.register_font(),.font_available()) are now documented with@dev/@keywords internaland consolidated inutils.R. -
.set_aagi_font()renamed fromset_aagi_font()(prefixed with.to signal its internal-only status). -
Removed internal PDF copy of AAGI style guidelines, these are available from GitHub, https://github.com/AAGI-AUS/AAGI-Style-Guide-and-Logos.
-
@returnstags standardised across all four base graphics functions (barplot_aagi(),boxplot_aagi(),hist_aagi(),plot_aagi()): each now leads with the return value first, then notes the side-effect. -
Added
@family Baseplotsand@seealsocross-references linking all four base graphics functions to each other. -
Added missing
@authortag towatermark(). -
Clarified
breaksoptions inhist_aagi()documentation.
- Tests updated to match renamed internal functions and revised function signatures.
-
Fixed
plot_aagi()formula interface compatibility: Refactoredplot_aagi()to properly handle formula-based plotting (e.g.,plot_aagi(y ~ x, data = df)) by using proper argument splicing instead ofdo.call(), which was breaking formula environments. -
Fixed colour default handling in
plot_aagi(): Ensured AAGI colour names are properly converted to hex codes and AAGI Black is correctly applied as default when no colour is specified. -
Removed problematic
colparameter frompar_aagi(): The globalcolparameter inpar_aagi()was causing "numerical color values must be >= 0" errors in base graphics functions. -
Colour handling is now per-function only, providing better control and avoiding graphics parameter conflicts.
-
Added missing
on.exit()cleanup inbarplot_aagi(): Ensuredshowtext::showtext_end()is properly called viaon.exit()for consistent resource cleanup across all plotting functions. -
Fixed Windows font registration error on CI: Improved
.onLoad()font registration with comprehensive error handling for Windows environments wheregrDevices::windowsFont()may return invalid values. -
Font registration failures are now silently handled since fonts are already registered via {sysfonts}.
-
Simplified
plot_aagi()implementation: Now usesrlang::call2()with argument splicing for cleaner, more robust handling of all plot types including formula interfaces. -
Enhanced error resilience in
.register_font(): AddedtryCatch()wrapper around Windows-specific font registration to gracefully handle platform-specific font issues without crashing package load.
First stable release of {AAGIThemes}, featuring comprehensive input validation, robust error handling, and production-ready graphics theming for AAGI brand guidelines.
None. This is the first stable release.
-
Enhanced
watermark()function with comprehensive validation and error messages:- Input validation for watermark text (non-empty character strings, rejects NA and whitespace-only)
- Parameter validation for
fontsize(positive numbers),alpha(0-1 range),angle(numeric),colour(single character string) - Fontface validation with clear error messages listing valid options (
plain,bold,italic,bold.italic) - Improved error handling with
clipackage for user-friendly messages
-
Robust base graphics functions with improved validation:
plot_aagi(),hist_aagi(),boxplot_aagi(), andbarplot_aagi()now include input validation- Colour parameter validation using
rlang::is_scalar_character() - Consistent error handling and messaging across all functions
-
Hardened
.convert_aagi_colour()utility function:- Vector input support via
vapply()for batch colour conversions - Proper handling of NULL, empty, and non-character inputs
- Error recovery with user-friendly warnings for invalid AAGI colours
- Case-sensitive and prefix-aware colour matching
- Vector input support via
-
Improved
set_aagi_font()font selection:- Robust fallback from Proxima Nova to Arial when font unavailable
- System font detection using
systemfontspackage
-
Code quality and robustness:
- All functions now use
rlang::is_scalar_*()for idiomatic modern R type validation - Comprehensive input validation prevents invalid states downstream
- Early returns optimize control flow in utility functions
- All functions now use
-
Error messaging:
- All error messages use
cli::cli_abort()andcli::cli_warn()for consistent, user-friendly formatting - Messages include variable names and valid options using
{.var}and{.or}CLI formatting
- All error messages use
-
Code consistency:
- Unified validation patterns across all plotting functions
- Proper use of
on.exit()for resource cleanup - Consistent parameter handling via
withr::local_par()
- Comprehensive roxygen2 documentation for all exported functions
- Updated examples in function documentation
- Cross-references via
@seealsofor related functions
-
Expanded test suite with 100+ test cases covering:
- Input validation and edge cases (empty strings, NA values, whitespace-only strings, vectors)
- Parameter validation (ranges, types, allowed values)
- Error conditions with proper error message verification
- Integration tests with
ggplot2workflows - Vector input handling for utility functions
-
All tests pass on R 4.0+
- New dependency:
rlang(imported for modern type validation) - Updated dependencies:
cli(enhanced error messaging),scales(colour handling)
- Internal utility functions marked with
@devtag:set_aagi_font(),par_aagi(),.convert_aagi_colour() - Improved separation of concerns between utility and user-facing functions
- Fixed
barplot_aagi()to remove redundant colour validation - Fixed colour conversion error handling in all plotting functions
None.
- Matt Cowgill and Will Mackey for watermark function design
- GRDC and Curtin University for support