Package 'firatheme'

Title: A ggplot2 Theme using the Fira Sans Font
Description: Make your graphs pretty with the Fira font, colours and prettified axes and labels.
Authors: Erik-Jan van Kesteren
Maintainer: Erik-Jan van Kesteren <[email protected]>
License: MIT + file LICENCE
Version: 0.4.0
Built: 2026-05-20 09:31:48 UTC
Source: https://github.com/vankesteren/firatheme

Help Index


Fira theme colours

Description

This is a vector with 5 colours to be used in palettes and other visual elements.

Usage

firaCols

Format

An object of class character of length 5.

See Also

firaPalette


Fira theme palette

Description

This function outputs n colours from the fira ggplot2 theme palette

Usage

firaPalette(n = 5)

Arguments

n

the number of colours to output

See Also

firaCols


Save plots that use the fira theme

Description

This function behaves like ggsave but automatically embeds the fira font if the output format requires it. Install 64-bit GhostScript for this functionality. Currently only works automatically on Windows. For other platforms, run the following with the _correct_ location to the installed GhostScript Binary: Sys.setenv(R_GSCMD = "bin/gs/gs9.23/binaryname")

Usage

firaSave(filename = "plot.pdf", device = "pdf", ...)

Arguments

filename

path to a file

device

which type of output device to use

...

other arguments passed to ggsave

See Also

ggsave


Fira discrete colour scales

Description

Colour scales belonging to the fira theme

Usage

scale_fill_fira(..., continuous = FALSE)

scale_colour_fira(..., continuous = FALSE)

scale_color_fira(..., continuous = FALSE)

Arguments

...

Arguments passed on to discrete_scale

breaks

One of:

  • NULL for no breaks

  • waiver() for the default breaks (the scale limits)

  • A character vector of breaks

  • A function that takes the limits as input and returns breaks as output. Also accepts rlang lambda function notation.

limits

One of:

  • NULL to use the default scale values

  • A character vector that defines possible values of the scale and their order

  • A function that accepts the existing (automatic) values and returns new ones. Also accepts rlang lambda function notation.

drop

Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE includes the levels in the factor. Please note that to display every level in a legend, the layer should use show.legend = TRUE.

na.translate

Unlike continuous scales, discrete scales can easily show missing values, and do so by default. If you want to remove missing values from a discrete scale, specify na.translate = FALSE.

minor_breaks

One of:

  • NULL for no minor breaks

  • waiver() for the default breaks (none for discrete, one minor break between each major break for continuous)

  • A numeric vector of positions

  • A function that given the limits returns a vector of minor breaks. Also accepts rlang lambda function notation. When the function has two arguments, it will be given the limits and major break positions.

labels

One of the options below. Please note that when labels is a vector, it is highly recommended to also set the breaks argument as a vector to protect against unintended mismatches.

  • NULL for no labels

  • waiver() for the default labels computed by the transformation object

  • A character vector giving labels (must be same length as breaks)

  • An expression vector (must be the same length as breaks). See ?plotmath for details.

  • A function that takes the breaks as input and returns labels as output. Also accepts rlang lambda function notation.

guide

A function used to create a guide or its name. See guides() for more information.

call

The call used to construct the scale for reporting messages.

super

The super class to use for the constructed scale

continuous

whether the associated variable should be considered continuous. Typically used after "Error: Continuous value supplied to discrete scale"

See Also

firaPalette


Fira theme

Description

This theme uses Mozilla's Fira Sans as its font. Save to pdf using firaSave().

Usage

theme_fira(facet = FALSE, family = "Fira Sans")

Arguments

facet

Whether to add borders for better facet legibility (default FALSE)

family

Change the font family. Defaults to Fira Sans

Value

ggplot theme

See Also

firaSave

Examples

library(ggplot2)

ggplot(mtcars, aes(x = mpg * 0.43, y = wt * 0.4535924, colour = factor(cyl))) +
  geom_point(size = 2) +
  labs(
    title = "Car weight vs efficiency",
    subtitle = "Using sensible metrics",
    x = "Efficiency (km/l)",
    y = "Weight (1000 kg)",
    colour = "Cylinders"
  ) +
  theme_fira() +
  scale_colour_fira()