init {r3dmol} | R Documentation |
Initialise a WebGL-based viewer
Description
Create and initialize an appropriate viewer at supplied HTML element using specification in config
Usage
r3dmol(
id = NULL,
viewer_spec = m_viewer_spec(),
...,
width = NULL,
height = NULL,
elementId = NULL
)
Arguments
id |
HTML element id of viewer. |
viewer_spec |
Some useful viewer input specifications. Additional options pass in via ... will override options set in viewer_spec. |
... |
Additional, more niche viewer input specification, see http://3dmol.csb.pitt.edu/doc/types.html#ViewerSpec for more details. |
width |
Fixed width for viewer (in css units). Ignored when used in a
Shiny app – use the |
height |
Fixed height for viewer (in css units). It is recommended to not use this parameter since the widget knows how to adjust its height automatically. |
elementId |
Use an explicit element ID for the widget (rather than an automatically generated one). Ignored when used in a Shiny app. |
Examples
library(r3dmol)
r3dmol() %>%
m_add_model(data = pdb_6zsl, format = "pdb") %>%
m_zoom_to()
# Viewer configs setting
r3dmol(
backgroundColor = "black",
lowerZoomLimit = 1,
upperZoomLimit = 350
) %>%
m_add_model(data = pdb_6zsl, format = "pdb") %>%
m_zoom_to()