plotly / plotly/plotly.R

Zoom all facets at the same time

Open
#2,142 1 comment 6 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

There seems to be a discrepancy between plotly for R and for python in how it handles zooming across facets.

To take my examples directly from the documentation: https://plotly.com/ggplot2/facet-plots/ vs https://plotly.com/python/facet-plots/

In the python version, if I select a region to zoom in on, the same zoom is applied to all facets, regardless of position.

In the r version, if I zoom on one facet, the 'x' zoom is applied to facets in the same column, and the 'y' zoom is applied to facets in the same row - but other facets are unaffected.

I would like to replicate the python behaviour in r. Any clues for how to do this?

Reprex: Compare zoom behaviour between R and python

library(reshape2)
library(plotly)

p <- ggplot(tips, aes(x=total_bill)) + geom_histogram(binwidth=2,colour="white")

# Histogram of total_bill, divided by sex and smoker
p <- p + facet_grid(sex ~ smoker)

ggplotly(p)
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df, x='gdpPercap', y='lifeExp', color='continent', size='pop',
                facet_col='year', facet_col_wrap=4)
fig.show()

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 R reprex from the issue and comparing its facet zoom behavior with the linked Python facet example. The issue names no repository files or tests; done means selecting a region in one facet applies the same x and y zoom to every facet.

Written by the indexing model from the issue text.

Assessment

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