r3dmol icon indicating copy to clipboard operation
r3dmol copied to clipboard

m_add_label() prints label at wrong position

Open senanu opened this issue 8 months ago • 1 comments

Thank you for such a useful package -- I've found it much easier to use than some of the alternatives.

m_add_label prints a label, but if given m_vector3 coordinates, the label prints at the wrong position.

The following reprex shows this, using the example code from the help file. Here, I print 2 labels, at different positions (I just changed the signs of the coordinates and label colors) but the labels end up in the same position.

library(r3dmol)

r3dmol() %>%
  m_add_model(data = pdb_6zsl, format = "pdb") %>%
  m_add_label(
    text = "Label",
    sel = m_vector3(-6.89, 0.75, 0.35),
    style = m_style_label(
      backgroundColor = "#666666",
      backgroundOpacity = 0.9
    )
  ) %>%
  m_add_label(
    text = "Label2",
    sel = m_vector3(6.89, -0.75, -0.35),
    style = m_style_label(
      backgroundColor = "#000000",
      backgroundOpacity = 0.9
    )
  ) %>%
  m_zoom_to()

The positioning seems to work fine when given a residue number, but I'd like to be able to place labels outside of the molecular structure and connect them to the relevant location with an arrow. Also, m_vector3 works fine in other situations.

senanu avatar Oct 24 '23 15:10 senanu