flip_y_title: Orients y-axis title horizontally

Description Usage Details Examples

View source: R/flip_y_title.R

Description

Rotates and repositions the y-axis title where short titles allow for them to be positioned horizontally at the top of the y-axis (without causing excessive whitespace on left of plot).

Usage

1

Details

This function just sets the angle and justification of the y-axis title, orienting text horizontally above the y-axis as per GSS best practise. Depending on the placement of tick labels, you may need to expand the y-axis to accomodate tick labels and title, e.g. also run ggplot2::scale_y_continuous(expand = expansion(mult = c(0,.1)))

Examples

1
2
3
4
5
6
7
8
9
library(ggplot2)
ggplot(iris, aes(x = Species, y = Sepal.Length)) +
    geom_boxplot(fill = wwfc_cols("light gold 20")) +
    wolves_theme(media = "web") +
    labs(title = "Virginica sepals are longest",
         subtitle = "Sepal length by species",
         y = "/mm") +
    scale_y_continuous(expand = expansion(mult = c(0.1, 0.1))) +
    flip_y_title()

lizardburns/wwplot documentation built on Jan. 5, 2022, 12:26 a.m.