facet_trelliscope: Facet Trelliscope

Description Usage Arguments Note Examples

View source: R/facet_trelliscope.R

Description

Facet Trelliscope

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
facet_trelliscope(
  facets,
  nrow = 1,
  ncol = 1,
  scales = "same",
  name = NULL,
  group = "common",
  desc = ggplot2::waiver(),
  md_desc = ggplot2::waiver(),
  path = NULL,
  height = 500,
  width = 500,
  state = NULL,
  jsonp = TRUE,
  as_plotly = FALSE,
  plotly_args = NULL,
  plotly_cfg = NULL,
  split_sig = NULL,
  self_contained = FALSE,
  thumb = TRUE,
  auto_cog = FALSE,
  split_layout = FALSE,
  data = ggplot2::waiver()
)

Arguments

facets

formula to facet the panels on. Similar to ggplot2::facet_wrap's facets

nrow

the number of rows of panels to display by default

ncol

the number of columns of panels to display by default

scales

should scales be the same ("same", the default), free ("free"), or sliced ("sliced"). May provide a single string or two strings, one for the X and Y axis respectively.

name

name of the display

group

group that the display belongs to

desc

description of the display

md_desc

optional string of markdown that will be shown in the viewer for additional context about the display

path

the base directory of the trelliscope application

height

height in pixels of each panel

width

width in pixels of each panel

state

the initial state the display will open in

jsonp

should json for display object be jsonp (TRUE) or json (FALSE)?

as_plotly

should the panels be written as plotly objects?

plotly_args

optional named list of arguments to send to ggplotly

plotly_cfg

optional named list of arguments to send to plotly's config method

split_sig

optional string that specifies the "signature" of the data splitting. If not specified, this is calculated as the md5 hash of the sorted unique facet variables. This is used to identify "related displays" - different displays that are based on the same faceting scheme. This parameter should only be specified manually if a display's faceting is mostly similar to another display's.

self_contained

should the Trelliscope display be a self-contained html document? (see note)

thumb

should a thumbnail be created?

auto_cog

should auto cogs be computed (if possible)?

split_layout

boolean that determines if the layout is split into components like a facet_grid vs. individual panels like facet_wrap. Only applies to ggplot2 plot objects.

data

data used for faceting. Defaults to the first layer data

Note

Note that self_contained is severely limiting and should only be used in cases where you would either like your display to show up in the RStudio viewer pane, in an interactive R Markdown Notebook, or in a self-contained R Markdown html document.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## Not run: 
library(ggplot2)

# basically swap out facet_wrap for facet_trelliscope
qplot(cty, hwy, data = mpg) +
  facet_trelliscope(~ class + manufacturer)

# not required, but if you set labels, these will be added as
# descriptions to the cognostics that are automatically computed
mpg <- set_labels(mpg, mpg_labels)

qplot(cty, hwy, data = mpg) +
  theme_bw() +
  facet_trelliscope(~ manufacturer + class, nrow = 2, ncol = 4)

# using plotly
library(plotly)
qplot(cty, hwy, data = mpg) +
  theme_bw() +
  facet_trelliscope(~ manufacturer + class, nrow = 2, ncol = 4, as_plotly = TRUE)

qplot(class, cty, data = mpg, geom = c("boxplot", "jitter"), na.rm = TRUE) +
  facet_trelliscope(~ class, ncol = 7, height = 800, width = 200,
    state = list(sort = list(sort_spec("cty_mean")))) +
  theme_bw()

library(gapminder)
qplot(year, lifeExp, data = gapminder) +
  xlim(1948, 2011) + ylim(10, 95) + theme_bw() +
  facet_trelliscope(~ country + continent, nrow = 2, ncol = 7,
    width = 300, as_plotly = TRUE,
    plotly_cfg = list(displayModeBar = FALSE))

## End(Not run)

trelliscopejs documentation built on Feb. 1, 2021, 9:05 a.m.