rot_xy: Rotate the x or y axes for gg or patchwork objects

View source: R/utils.R

rot_xyR Documentation

Rotate the x or y axes for gg or patchwork objects

Description

This is a wrapper function around rot_at(), rot_x(), and rot_y() that accepts gg objects, patchwork objects, or lists of gg or patchwork objects. Arguments to those wrapped functions can be passed through. See arguments to rot_at() as well as rot_x() and rot_y().

Usage

rot_xy(x, ...)

## S3 method for class 'gg'
rot_xy(x, axis = c("x", "y"), ...)

## S3 method for class 'patchwork'
rot_xy(x, axis = c("x", "y"), ...)

## S3 method for class 'list'
rot_xy(x, axis = c("x", "y"), ...)

Arguments

x

a gg object, patchwork object, or list of those objects.

...

arguments passed to rot_at() (at, re) or rot_x() / rot_y() (angle, vertical hjust, vjust).

axis

which axis to rotate (x or y).

See Also

rot_at(), rot_x(), rot_y().

Examples

library(patchwork)

data <- pmplots_data_obs()

p <- dv_pred(data)

p1 <- rot_xy(p)
p2 <- rot_xy(p, vertical = TRUE)
p3 <- rot_xy(p, axis = "y", angle = 15)

p1 + p2 + p3

rot_xy(p + dv_ipred(data))

co <- c("STUDYc", "CPc")
etas <- paste0("ETA", 1:2)

x <- eta_covariate(data, x = co, y = etas, transpose = TRUE)

pp <- rot_xy(x, at = "CPc")

pm_with(pp, STUDYc/CPc)


metrumresearchgroup/pmplots documentation built on Feb. 13, 2025, 4:15 p.m.