plotly / plotly/plotly.R

Subplot with faceted ggplots: misplaced facet strips with nrows>1

Open
#1,473 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug difficulty: high ggplotly
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

When passing faceted ggplots to subplot(), the result is rendered properly as long as nrows=1. However, once I pass nrows=2 or greater, the facet strips become misplaced.

require(ggplot)
require(plotly)

ggiris <- qplot(Petal.Width, Sepal.Length, data = iris, color = Species)
# With nrows = 1, facets are rendered properly
subplot (ggiris , ggiris+facet_wrap(~Species))
# With nrows>1, facets are messed up
subplot (ggiris , ggiris+facet_wrap(~Species), nrows=2)

subplot_facet

subplot_facet_nrows2

This used to work correctly on my system, using a previous version of the library - I found the error after updating plotly and a bunch of other libraries. Unfortunately, I haven't been able to restore the previous environment, so I don't know on which release it stopped working.

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 examples in the issue with subplot(), facet_wrap(), and nrows=2, then trace the subplot entry point and its handling of faceted ggplots and row layout. Done means facet strips remain correctly positioned when nrows is greater than 1, with a regression test covering the reported example.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.