plotly / plotly/plotly.R

Implementation of facet_wrap(..., dir="v")

Open
#1,243 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

ggplot2 has the dir option that allows facets to be filled by columns, rather than rows. However, it does not display properly in plotly.

library(ggplot2)
library(plotly)

data <- data.frame(
  x = seq(1:100),
  y = sample(1:1000, 100),
  z = factor(sample(1:4, 100, replace = T))
)

plot <- ggplot(data, aes(x, y)) +
  facet_wrap(~ z, dir = "v") +
  geom_point()

plot
ggplotly(plot)

ggplot works properly and fills the facets from top to bottom, left to right.

screen shot 2018-04-21 at 14 23 14

Using the current dev version of plotly, ggplotly doesn't display all the facets, and still orders them from left to right, top to bottom.

screen shot 2018-04-21 at 14 23 07

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 issue's R example with facet_wrap(~ z, dir = "v") and ggplotly(plot), then trace how ggplotly converts the facet layout and ordering. Compare the result with ggplot's top-to-bottom, left-to-right layout; done means all facets display in the requested vertical order.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.