m_add_line: Add Lines Between Points

Description Usage Arguments Value Examples

View source: R/add.R

Description

Add lines between the given points. Will match starting point/s with ending point/s to create a line between each point. Styling options can be supplied as one option, or a vector of length equal to the number of lines.

Usage

1
2
3
4
5
6
7
8
9
m_add_line(
  id,
  start,
  end,
  dashed = TRUE,
  color = "black",
  opacity = 1,
  hidden = FALSE
)

Arguments

id

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

start

Starting position (or list() of positions) of line. Can be a single position or list() of positions. Format either m_sel() or m_vector3().

end

Ending position (or list() of positions) of line. Can be a single position or list() of positions. Format either m_sel() or m_vector3().

dashed

Logical whether the lines are dashed.

color

Either single or list of color values equal to number of lines.

opacity

Either single or list of opacity values equal to number of lines.

hidden

Either single or list of hidden values equal to number of lines.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(r3dmol)

r3dmol() %>%
  m_add_model(data = pdb_6zsl) %>%
  m_set_style(style = m_style_cartoon()) %>%
  m_zoom_to() %>%
  m_add_style(
    sel = m_sel(resi = 1:10),
    style = c(
      m_style_stick(),
      m_style_sphere(scale = 0.3)
    )
  ) %>%
  m_add_line(
    start = list(
      m_sel(resi = 1, chain = "A"),
      m_sel(resi = 1, chain = "A")
    ),
    end = list(
      m_sel(resi = 10, chain = "A"),
      m_sel(resi = 10, chain = "B")
    ),
    dashed = TRUE
  )

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