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.2.4
Built: 2024-11-21 03:04:01 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

palette

A palette function that when called with a single integer argument (the number of levels in the scale) returns the values that they should take (e.g., scales::hue_pal()).

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

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

drop

Should unused factor levels be omitted from the scale? The default, TRUE, uses the levels that appear in the data; FALSE uses all the levels in the factor.

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.

scale_name

The name of the scale that should be used for error messages associated with this scale.

name

The name of the scale. Used as the axis or legend title. If waiver(), the default, the name of the scale is taken from the first mapping used for that aesthetic. If NULL, the legend title will be omitted.

labels

One of:

  • 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)

  • A function that takes the breaks as input and returns labels as output

expand

For position scales, a vector of range expansion constants used to add some padding around the data to ensure that they are placed some distance away from the axes. Use the convenience function expansion() to generate the values for the expand argument. The defaults are to expand the scale by 5% on each side for continuous variables, and by 0.6 units on each side for discrete variables.

guide

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

position

For position scales, The position of the axis. left or right for y axes, top or bottom for x axes.

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(family = "Fira Sans")

Arguments

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()