facet_trelliscope: Facet Trelliscope

View source: R/facet_trelliscope.R

facet_trelliscopeR Documentation

Facet Trelliscope

Description

Facet Trelliscope

Usage

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,
  inputs = NULL,
  state = NULL,
  views = NULL,
  jsonp = TRUE,
  as_plotly = FALSE,
  plotly_args = NULL,
  plotly_cfg = NULL,
  split_sig = NULL,
  google_analytics_id = NULL,
  self_contained = FALSE,
  thumb = TRUE,
  require_token = FALSE,
  id = NULL,
  order = 1,
  disclaimer = FALSE,
  update_plots = 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

inputs

optional set of input specifications (using input_cogs) to allow user input for each panel

state

the initial state the display will open in

views

an optional list of pre-specified views of the display (experimental)

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.

google_analytics_id

optional string specifying Google Analytics ID

self_contained

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

thumb

should a thumbnail be created?

require_token

require a special token for all displays to be visible (experimental)

id

set a hard-coded ID for this app (do not set this if the display will be part of a larger web page)

order

an integer indicating the order that the display should appear in if using multiple displays

disclaimer

an optional string of html to include as a disclaimer for the set of displays

update_plots

should the plots be updated? This is to allow slight updates to the underlying display data without the need to re-render all of the plots. Use it carefully.

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.

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

## 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 Aug. 8, 2025, 6:40 p.m.