Create ggplot2 charts in the Grattan Institute style.
See the grattantheme vignette to learn how to make your ggplot2 charts Grattan-y.
The grattantheme package needs to be downloaded and installed from Github. The easiest way to do this is with the devtools package. If you don’t have the devtools package, install it:
Once devtools is installed, you can download and install grattantheme as follows:
devtools::install_github("mattcowgill/grattantheme", dependencies =
TRUE, upgrade = "always")
Once grattantheme is installed, you can load it the same way you normally load an R package:
See the grattantheme vignette for a more complete guide.
theme_grattan() to format your ggplot2 charts in a style
consistent with the Grattan style guide, including elements such as
gridline colours and line width, font size, etc. For scatter plots,
theme_grattan(chart_type = "scatter") provides a black y-axis.
grattan_y_continuous() to set default values for your vertical
axis that will work well with most Grattan charts.
grattan_fill_manual(n) to format the
n coloured elements of your
ggplot2 plot. These functions will
choose appropriately-spaced Grattan colours, ordered from either light
to dark or the reverse.
The colours that will be used in your plot are:
A range of colours from the style guide (such as
grattan_red, and so on) are defined for your convenience.
grattan_save() to save your ggplot2 charts (eg. as
?grattan_save() for a list).
make_presentation() to create Powerpoint
presentations from your chart(s), including editable titles and
save_chartdata() to save your chart and accompanying data as a
properly-formatted .xlsx workbook.
grattan_anim_save() to save gganimate animations formatted in the
Some graph defaults (such as colour) will be modified during your R session; restart R to restore all defaults.
Please note that some manual modification to your chart will most likely be required in order to make it fully consistent with the style guide, just as it would in other visualisation software or Excel/Powerpoint.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.