Adds a button that will overwrite the style for the given selection with the new given styles.

m_button_set_style(
  id,
  style = m_style_cartoon(),
  sel = m_sel(),
  label = "Style"
)

Arguments

id

R3dmol id or a r3dmol object (the output from r3dmol()).

style

Style spec to apply to specified atoms using m_style_*()

sel

Atom selection specification with m_sel()

label

String for button label.

Value

R3dmol id or a r3dmol object (the output from r3dmol())

Examples

# Add buttons to show and hide sticks
r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_zoom_to() %>%
  m_set_style(m_style_cartoon()) %>%
  m_button_add_style(m_style_stick(), label = "Add Sticks") %>%
  m_button_add_style(m_style_sphere(scale = 0.3), label = "Add Spheres") %>%
  m_button_set_style(m_style_cartoon(), label = "Set Cartoon")