Time series plot x range starts from 1970
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
When I'm trying to plot a time series coloured by the value of variable, the date range starts from 1970. It defaults to a sensible date if I exclude the color argument. I can certainly manually specify the xaxis range, but when I double click the plot to reset the scale it goes back to the 1970 range again, which is quite annoying.
library(lubridate)
library(plotly)
data <- data.frame(date = seq(from = ymd_hms("20190101 000000"),
to = ymd_hms("20190301 000000"),
by = "1 hour"),
y = round(runif(1417, 0, 10)))
data %>%
plot_ly(x = ~date, y = ~y, color = ~y) %>%
add_markers()

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducible R example using plot_ly(x = ~date, y = ~y, color = ~y) and add_markers(), comparing it with the case that omits color. Investigate why the x-axis reset uses a 1970 range, and verify that double-click reset preserves the 2019 date range without manually specifying xaxis range.
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