plotly / plotly/plotly.R

ggplotly changing the x-axis label while plotting the group charts in boxplot

Open
#1,718 0 comments 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

Sample Code:

library(ggplot2)
library(plotly)
data(mtcars)

mtcars$vs <- factor(mtcars$vs,
labels = c("A","B"))
df$carb = as.factor(df$carb)
df=mtcars[mtcars$vs == "A",]

gg <- ggplot(df, aes(x = vs, y = hp)) +
geom_boxplot() +
facet_wrap(~carb)
ggplotly(gg)

ggplot is properly showing x-axis label as "A" for each of the plots. But ggplotly showing label as "A" only for 1st column and for rest it is showing label as "1".

Please find screenshot for both:

ggplotly:
Rplot

ggplot:
Rplot02

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 sample code with ggplot2 and plotly, then compare the x-axis labels in ggplot and ggplotly across the facet_wrap(~carb) panels. Trace how facet labels are converted during ggplotly rendering. Done means every panel displays the factor label "A" rather than "1".

Written by the indexing model from the issue text.

Assessment

Tech stack
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.