ggplotly + subplot(shareX=TRUE) causes date axis tick labels to disappear after zoom/pan
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 50/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- r
- Domain
- data-visualization
Research direction
Start with the reproducible R example using ggplotly(), subplot(), shareX = TRUE, and the pan/zoom interaction. Compare the date-time axis behavior before and after zooming or panning; done means x-axis tick labels remain visible and update automatically.
Written by the indexing model from the issue text.
Description
Description
When combining two ggplotly() objects using subplot(..., shareX = TRUE), x-axis tick labels disappear after zooming/panning.
This happens specifically with date-time x axes.
The hover labels still show correct datetime values, but axis ticks disappear.
Reproducible example
library(tidyverse)
library(lubridate)
library(plotly)
library(viridisLite)
d = tibble(
time = seq(
ymd_hms("2019-01-01 00:00:00"),
by = "10 sec",
length = 1e5
),
y = cumsum(rnorm(1e5))
)
d2 = expand.grid(
date = unique(date(d$time)),
y = 48 / 2^8 * 2^(seq(
0,
log2(48 / (48 / 2^8)),
by = 1/20
))
) %>%
as_tibble() %>%
mutate(z = rnorm(n()))
g1 = ggplot(d, aes(time, y)) +
geom_line(linewidth = 0.3) +
theme_bw()
g2 = ggplot(
d2 %>%
mutate(date = as.POSIXct(date) + 12*3600),
aes(date, log2(y), fill = z)
) +
geom_raster() +
scale_fill_gradientn(colours = turbo(100)) +
theme_bw()
p1 = ggplotly(g1)
p2 = ggplotly(g2)
subplot(
p1,
p2,
nrows = 2,
shareX = TRUE
) %>%
layout(
dragmode = "pan"
)
Expected behavior
x-axis tick labels should remain visible and automatically update during zoom/pan.
Actual behavior
x-axis tick labels disappear after zooming/panning.
Session info
sessionInfo()
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
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.
More from plotly/plotly.R
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
save_image Error Open
Difficulty 3/5 1-2 days Newbie friendliness 52/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
easystats/performance#950 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
briandconnelly/airnow#9 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OHDSI/CohortConstructor#774 ·