Create a grid of viewers that share a WebGL canvas
m_grid(
viewer,
element_id,
rows = NULL,
cols = NULL,
control_all = TRUE,
viewer_config = m_viewer_spec(),
width = NULL,
height = NULL
)
A list contains sub-viewers.
HTML string identifier.
Number of rows in viewer grid.
Number of columns in viewer grid.
Logical, simaultaneous mouse control of all windows in the grid.
Viewer specification to apply to all subviewers.
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.
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.
An r3dmol
object (the output from r3dmol()
).
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"
)
)