init: Initialise a WebGL-based viewer

Description Usage Arguments Examples

Description

Create and initialize an appropriate viewer at supplied HTML element using specification in config

Usage

1
2
3
4
5
6
7
8
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 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 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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()

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