ggclip: ggplot clipping

View source: R/ggplots.R

ggclipR Documentation

ggplot clipping

Description

Toggles ggplot panel clipping.

Usage

ggclip(p, action = 'off')

Arguments

p

a ggplot object

action

turn clipping 'off' (default) or 'on'

Examples

library(ggplot2)
library(grid)

(q <- qplot(1:10, 1:10,size = I(10)) + scale_y_continuous(expand = c(0, 0)))
ggclip(q)

dat <- data.frame(time = 0:5, y = 0:5)
(p <- ggplot(dat, aes(x = time, y = y)) +
    geom_area(alpha = .1) + theme_bw() +
    scale_y_continuous(expand = c(0, 0)) +
    scale_x_continuous(expand = c(0, 0)) +
    theme(panel.grid.major = element_blank(), 
          panel.grid.minor = element_blank(),
          axis.text.x=element_blank(),
          axis.ticks.x=element_blank()) +
     geom_segment(aes(x = 0, xend = 5 , y = 0, yend = 0), size = 1.5,
                  arrow = arrow(length = unit(0.6, 'cm'))))

ggclip(p)



raredd/plotr documentation built on Nov. 19, 2023, 4:09 a.m.