plotly / plotly/plotly.R

Marker symbol and line rendered in wrong order

Open
#1,155 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug difficulty: high priority: medium
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Given the code below, Plotly render the marker symbols and lines in wrong order. From df, you can see the point (3, 3) should be a circle without line. But it's rendered as a pentagon with the red circle:

library(plotly)
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout

df <- data.frame(x = seq(1, 10), y = seq(1, 10),
                 Sample_Group = rep(c("N", "T"), 5),
                 Symbol = rep(c("circle", "pentagon"), 5))
df$Symbol_Line <- sapply(df$Symbol, function(x) {ifelse(x == "pentagon", 2, 0)})
df
#>     x  y Sample_Group   Symbol Symbol_Line
#> 1   1  1            N   circle           0
#> 2   2  2            T pentagon           2
#> 3   3  3            N   circle           0
#> 4   4  4            T pentagon           2
#> 5   5  5            N   circle           0
#> 6   6  6            T pentagon           2
#> 7   7  7            N   circle           0
#> 8   8  8            T pentagon           2
#> 9   9  9            N   circle           0
#> 10 10 10            T pentagon           2

p <- plot_ly(df, x = ~x, y = ~y,
             type = "scatter", mode = "markers",
             color = ~Sample_Group,
             marker = list(symbol = ~Symbol,
                           size = 15,
                           line = list(width = ~Symbol_Line,
                                       color = "red")))

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

Start with the reproducible R example in issue #1155 and trace how the marker symbol and marker line values are passed to the rendering path. Done means the point (3, 3) renders as a circle without a line, while pentagon points retain their red line.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.