plotly / plotly/plotly.R

dynamicTicks = T does not respect position attribute in geom_point()

Open
#1,886 3 comments 2 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

I would like to use the dynamic ticks option with my plots in shiny although I am running into an issue with my plots that use a discrete x axis.

Plots appear as they should with dynamicTicks = F, however, after setting to TRUE the position = argument doesn't seem to be respected.

Furthermore, I notice that when using plotly_json() that some of the data items seem to go missing.

Any help with this issue would be much appreciated.

library(tidyverse)
library(plotly)

g <- mtcars %>%
  ggplot(aes(fill = as_factor(carb))) +
  geom_point(aes(x = as_factor(cyl), y = mpg), position = position_dodge(width = 0.5))

p <- ggplotly(dynamicTicks = T)

p

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 provided R reproduction using ggplotly(dynamicTicks = T), geom_point(), a discrete x axis, and position_dodge(). Compare its rendered plot with dynamicTicks = F and inspect plotly_json() for missing data; done means the position attribute is respected and all expected data items remain present.

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.