plt_scale_y_mirror: ggplot2: Mirror the y axis on the right side

View source: R/plt_scale_y_mirror.R

plt_scale_y_mirrorR Documentation

ggplot2: Mirror the y axis on the right side

Description

Mirror the ticks and text from the y axis on the right side.

Usage

plt_scale_y_mirror(breaks, labels = NULL, expand = c(0.01, 0), ...)

Arguments

breaks

A numeric vector, that will be the breaks in the y axis

labels

A vector (default = NULL), that will be the labels in the axis, if not provided 'breaks' will be used instead

expand

A numeric vector (default = c(0.01,0)), that is the range expansion used to add some space between the data and the plot border

Value

A ggplot2 object.

Examples


library(ggplot2)

plot <-
  ggplot(mtcars,aes(hp,drat))+
  geom_point()

plot

plot + plt_scale_y_mirror(breaks = seq(0,40,4))


vbfelix/relper documentation built on May 10, 2024, 10:50 p.m.