plotly / plotly/plotly.R

bug boxplot set to horizontal

Open
#2,005 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

Hi, I've found a bug in ggplotly() when I want to draw an horizontal boxplot. The code that doesn't work is this:

au2=  ggplot(data) + geom_boxplot(aes_string(x = "Conc",  y ="Class"))+ 
    labs( x = "log2(Concentration)", title = "Density boxplot")
plotly::ggplotly(au2)

where "Conc" is continous and "Class" is discrete. ggplot correctly draw the graph, but when I use ggplotly(), the plot is almost empty (becomes empty if I put also fill = "Class")

in ggplot works fine:
ggplot_not
in plotly doesn't work:
plotly_not

If I reverse x and y everything works fine but the boxplot will be vertical. So in order to make an horizontal boxplot that kinda works in plotly I have to use coord_flip() in ggplot2. So this code:

au2 = ggplot(box_data) + geom_boxplot(aes_string(y = "Conc",  x ="Class")) +  
    labs( x = "log2(Concentration)", title = "Density boxplot") + coord_flip()
plotly::ggplotly(au2)

But I have a last problem with ticks. They are a bit rotated:

problem with ticks in plotly:
plotly_ok

What's happening??

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 reproducing the reported horizontal boxplot with ggplot(), geom_boxplot(), and plotly::ggplotly(), comparing the direct horizontal mapping with the coord_flip() workaround. Investigate the handling of continuous and discrete axes, fill, and tick labels; done means horizontal boxplots render correctly with fill and their ticks are oriented as expected.

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.