plotly / plotly/plotly.R

Individual marker styling inconsistent

Open
#2,245 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Hi, thank you for making and working on such a wonderful plotting package.

For one of the projects I'm working on, I'm trying to style individual markers, however it's inconsistent when trying to target individual markers. For example I want to make the fourth point as full opacity (1) and larger (15) while the others are at 0.2 and size 10. I would expect "sample4" to be at full opacity, but it's "sample3". Am I doing something wrong?

test_data <- data.frame(
    x_data = c(2.8113, 5.8112, 7.3461, 15.5405, 16.3035),
    y_data = c(2, 2, 2, 6, 3),
    groups = c("group1", "group1", "group2", "group2", "group1"),
    samples = c("sample1", "sample2", "sample3", "sample4", "sample5")
)
plotly::plot_ly(
    test_data,
    x = ~x_data,
    y = ~y_data,
    mode = "markers",
    type = "scatter",
    color = ~groups,
    text = ~samples,
    marker = list(
        size = c(10, 10, 10, 15, 10),
        opacity = c(0.2, 0.2, 0.2, 1, 0.2)
      )
    )

produces the following plot

image Thanks a lot in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied plot_ly example in the plotly.R repository and inspect how grouped marker vectors are mapped to the plotted points. Compare the displayed marker styling with the requested size and opacity vectors. Done means sample4 receives size 15 and opacity 1 while the other samples receive size 10 and opacity 0.2.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.