The goal of ggugent is to apply the official Ghent University (UGent) colours, theme to a ggplot2 graph.
You can install the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("rdpauw/ggugent")
To be able to apply the UGent theme, it is important to install the
Arial-font via the package extrafont
. First, you will have to load the
package via library(extrafont)
Afterwards, you can import all
available fonts via font_import()
to make the Arial-font available.
The ggugent
package contains four distinct function families:
scale_color_ugent_all()
and scale_fill_ugent_all()
, which
contains all official UGent general and faculty colors.pal_ugent()
, which generates a vector with encoded HEX-codes of
the included colors.ggugent_style()
, which will apply a theme in the UGent theme on a
created ggplot.finalise_plot()
, will enable you to save and add a cutsom logo to
the plot.This is a basic example of a ugent theme ggplot:
library(ggugent)
library(ggplot2)
data("diamonds")
ggplot(
subset(diamonds, carat >= 2.2),
aes(x = table, y = price, colour = cut)) +
geom_point(alpha = 0.7) +
geom_smooth(method = "loess", alpha = 0.1, size = 1, span = 1) +
scale_color_ugent_all() +
ggugent_style()
#> `geom_smooth()` using formula 'y ~ x'
library(scales)
show_col(pal_ugent()(3))
library(scales)
show_col(pal_ugent_all()(12))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.