striptext: Extract Striptext

View source: R/striptext.r

striptextR Documentation

Extract Striptext

Description

Extracts striptext. Generic, with method striptext.ggplot.

Usage

striptext(x, ...)

Arguments

x

object of dispatch

...

passed arguments

Value

list with class 'striptext'

Examples

library(magrittr)
library(dplyr)
library(ggplot2)
(
  mtcars %>% 
  ggplot(aes(wt, mpg)) + 
  geom_point()
) %>% striptext

(
  mtcars %>% 
  ggplot(aes(wt, mpg)) +
  geom_point() +
  facet_grid(cyl ~ am + gear)
) %>% striptext

(
  mtcars %>% 
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(. ~ cyl + am + gear)
) %>% striptext

(
  mtcars %>% 
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(
    . ~ cyl + am + gear, 
    labeller = labeller(
      .default = label_both
    )
  )
) %>% striptext

(
  mtcars %>% 
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(
   . ~ cyl + am + gear, 
   labeller =  labeller(
     .default = label_both,
     .multi_line = FALSE
   )
 )
) %>% striptext

## Not run: 
\donttest{
(
  mtcars %>% 
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(
   . ~ cyl + am + gear, 
   labeller = purrr::partial(
     label_both, 
     sep = "\n"
   )
 )
) %>% striptext
}
## End(Not run)

(
  mtcars %>% 
  mutate(cyl = paste('cylinders:', cyl)) %>%
  mutate(gear = paste('gears:', gear)) %>%
  mutate(am = paste('transmission:', am))%>%
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(
    . ~ cyl + am + gear, 
    labeller = labeller(
      .default = label_wrap_gen(10),
      .multi_line = TRUE
    )
  )
) %>% striptext

(
  mtcars %>% 
  mutate(cyl =  paste(sep = '\n', 'cylinders', cyl)) %>%
  mutate(gear = paste(sep = '\n', 'gears', gear)) %>%
  mutate(am =   paste(sep = '\n', 'transmission', am))%>%
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(
    . ~ cyl + am + gear, 
    labeller = labeller(
      .default = label_wrap_gen(10)
    )
  )
) %>% striptext

(
  mtcars %>% 
  mutate(cyl =  paste(sep = ':', 'cylinders', cyl)) %>%
  mutate(gear = paste(sep = ':', 'gears', gear)) %>%
  mutate(am =   paste(sep = ':', 'transmission', am))%>%
  ggplot(aes(wt, mpg)) + 
  geom_point() +
  facet_wrap(
    . ~ paste(sep = '\n', cyl, am, gear), 
  )
) %>% striptext


qPharmetra/qpToolkit documentation built on May 24, 2023, 8:52 a.m.