Creates a button that will add the given style to the selection when pressed.

m_button_add_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_*(). Multiple styles can be supplied inside a vector (i.e.) c(m_style_cartoon(), m_style_stick()).

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_button_add_style(m_style_stick(), label = "Show Sticks") %>%
  m_button_add_style(m_style_stick(hidden = TRUE), label = "Hide Sticks")