plotly / plotly/plotly.R

Issue with marker size when using animated graph

Open
#1,856 1 comment 0 reactions 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

When attempting to size markers in an animated graph, the sizing is incorrect unless the data.frame is first ordered correctly.

In the example below the markers should:

  1. Increase in size, then decrease again
  2. Decrease in size, then increase again
  3. Decrease in size
  4. Increase in size
  5. Iterate between small and large

I think it may have something to do with a warning I get 'arrange_()' is deprecated as of dplyr 0.7.0
Please use 'arrange()' instead

I'm using dplyr 1.0.0 and plotly 4.9.2.1

# data
data <- data.frame(xaxis = rep(as.character(c(1:5)), each = 10), 
                   yaxis = rep(c(1:5,5:1), 5), 
                   size = c(
                       c(seq(1,10,2), seq(10,1,-2)),
                       c(seq(10,1,-2), seq(1,10,2)),
                       c(1:10),
                       c(10:1),
                       rep(c(1,10), 5)
                   ),
                   frame = c(1:10)
)

# example 1, unordered

plot_ly(
    data = data,
    x = ~xaxis,
    y = ~yaxis,
    frame = ~frame,
    type = 'scatter',
    marker = list(size = ~size*10),
    mode = 'markers'
)

# example 2, ordered

data <- data[order(data$frame),]

plot_ly(
    data = data,
    x = ~xaxis,
    y = ~yaxis,
    frame = ~frame,
    type = 'scatter',
    marker = list(size = ~size*10),
    mode = 'markers'
)

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 by running the supplied R reproducer with dplyr 1.0.0 and plotly 4.9.2.1, then trace animated marker sizing and the deprecated arrange_() path. Done means unordered data produces the five listed size patterns and the relevant deprecation warning is addressed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.