geom_rangeframe_cr: Wrapper function for geom_rangeframe to allow custom limits

View source: R/wrapper_rangeframe.R

geom_rangeframe_crR Documentation

Wrapper function for geom_rangeframe to allow custom limits

Description

By default, geom_rangeframe uses the range of the x and y data to set the range for the axis frame. This function instead uses the provided xlim and ylim to create a data frame to provide new limits to the range frame.

Usage

geom_rangeframe_cr(xlim, ylim, ...)

Arguments

xlim

Vector of length 2, gives the minimum and maximum values for the range frame on the x axis

ylim

Vector of length 2, gives the minimum and maximum values for the range frame on the y axis

...

Additional parameters for geom_rangeframe

Details

Just like geom_rangeframe, this should be used with coord_cartesian(clip="off") in order to correctly draw the lines.

Examples

library(ggplot2)
library(ggthemes)

df <- data.frame(x = 1:5, y = 1:5, z = c("a","b","c","b","c"))
p <- ggplot(df, aes(x, y, color = z)) + geom_point()
p + geom_rangeframe_cr(xlim = c(0,6), ylim = c(1,6), colour = "gray20")


christyray/crthemes documentation built on April 14, 2023, 11:18 p.m.