m_grid: Create a grid of viewers that share a WebGL canvas

Description Usage Arguments Value Examples

View source: R/grid.R

Description

Create a grid of viewers that share a WebGL canvas

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
m_grid(
  viewer,
  element_id,
  rows = NULL,
  cols = NULL,
  control_all = TRUE,
  viewer_config = m_viewer_spec(),
  width = NULL,
  height = NULL
)

Arguments

viewer

A list contains sub-viewers.

element_id

HTML string identifier.

rows

Number of rows in viewer grid.

cols

Number of columns in viewer grid.

control_all

Logical, simaultaneous mouse control of all windows in the grid.

viewer_config

Viewer specification to apply to all subviewers.

width

Fixed width for combined viewer (in css units). Ignored when used in a Shiny app – use the width parameter in r3dmolOutput. It is not recommended to use this parameter because the widget knows how to adjust its width automatically.

height

Fixed height for combined viewer (in css units). It is recommended to not use this parameter since the widget knows how to adjust its height automatically.

Value

An r3dmol object (the output from r3dmol()).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(r3dmol)

m1 <- r3dmol() %>%
  m_add_model(data = pdb_6zsl, format = "pdb") %>%
  m_zoom_to()

m2 <- m1 %>%
  m_set_style(style = m_style_cartoon(color = "spectrum"))

m3 <- m1 %>%
  m_set_style(style = m_style_stick())

m4 <- m1 %>%
  m_set_style(style = m_style_sphere())

m_grid(
  viewer = list(m1, m2, m3, m4),
  control_all = TRUE,
  viewer_config = m_viewer_spec(
    backgroundColor = "black"
  )
)

r3dmol documentation built on March 14, 2021, 5:08 p.m.