Produce Charts Following UK Government Analysis Function Guidance
Overview
Colour palettes and a 'ggplot2' theme to follow the UK Government Analysis Function best practice guidance for producing data visualisations, available at https://analysisfunction.civilservice.gov.uk/policy-store/data-visualisation-charts/. Includes continuous and discrete colour and fill scales, as well as a 'ggplot2' theme.
- Updated the
sequentialcolour palette to add two new shades (darkest-blueandlightest-blue). This means that thesequentialpalette can now be used to represent five categories, such as deprivation quintiles. - Renamed
na_colourargument ofscale_colour_continuous_afandscale_fill_continuous_aftona.value. This was necessary to enableuse_afchartsto work with ggplot2 v4.0.1. Addedna.valueargument toscale_colour_discrete_afandscale_fill_discrete_af. use_afchartsgains aresetargument to turn off analysis function styling of charts.theme_afnow uses theme options set by earlier calls ofuse_afchartsby default. #51- Set the
maincolour palettes tocategorical. The Scale_*_discrete_af functions now use the 6 colour cateogrical palette by default, rather than the 4 colour. - Added
af_dark_blue,af_orangeandaf_greyto give easier access to the hex codes of these colours. - Added arguments
axis_textandaxis_titleto functiontheme_afto set
whether to show axis titles and labels.
- Added argument
legend_titleto functiontheme_afto set whether to show
legend titles.
- The
legendargument oftheme_afnow accepts a legend justification e.g. 'top-right', 'left-centre' #47
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK14 OK2026-03-10
Documentation
- Help pages
- 12 (1 internal)includes a package overview page
- Examples that run
- 100%9 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 93%
- Return-value docs
- 100%
- Help pages citing references
- 0%
- Accessibility HTML
- Colours HTML
- Cookbook
- Saving charts HTML
Downloads
Repository
- PRs merged (all time)
- 88%
- Median days to close, 50 most recently updated closed issues
- 36
- Median days to close, 50 most recently updated closed PRs
- 7
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
15 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/best-practice-and-impact/afcharts on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-05-05 · The repository has a site deploy workflow
pkgdown site last built 2026-05-05
Show all practicesHide 2 practices
Dependencies
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2024-11-06
- Total releases
- 3 / 2 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 1.1 KB / 6 files
- Download size
- 1.4 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("afcharts")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.