plotly / plotly/plotly.R

handle POSIXct frames

Open
#1,246 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

plot_ly exhibits strange behavior when trying to loop over a POSIXct variable in an animation. POSIXct variables are handled fine as the axes of a non-animating plot_ly, so I was hoping they would be supported as frames.

It seems the frame is turned into a numeric, which makes sense. However, a POSIXct y axis seems to be mutated beyond use when using a POSIXct frame.

library(plotly)

data <- data.frame(x = 1:100, 
                   t1 = rep(seq.POSIXt(as.POSIXct("2018-04-01"), as.POSIXct("2018-04-10"), length.out = 10), 10),
                   t2 = seq.POSIXt(as.POSIXct("2018-05-01"), as.POSIXct("2018-05-10"), length.out = 100))

data %>%
  plot_ly(x = ~x, y = ~t2, frame = ~t1) %>% 
  add_markers()

2018-04-26_02-36-57

Thank you for providing this great capability, and I am excited about the potential for Plotly animations as well!

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 example with plot_ly, POSIXct t1 frames, and the POSIXct t2 y axis to reproduce the malformed animation. Trace how the frame is converted to numeric and verify that the POSIXct y axis remains usable while animated.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.