plotly / plotly/plotly.py

Horizontal zooming on faceted scatter plots does not scale y axes correctly

Open
#2,738 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

The code below produces two plots side by side. Zooming in on the x axis only, using a horizontal motion of the mouse, results in the two y axes being independently rescaled. Zooming using a rectangle or on the y axis works as expected. The error does not appear when using fewer than 501 points.

I'm using Python 3.7.4 and Plotly 4.9.0 on Windows 10.

Example:

import plotly.express as px
import numpy as np
import pandas as pd
size=501
df = pd.DataFrame({'x': np.random.random(size=2*size),
                   'y': np.hstack((np.random.normal(loc=10,  scale=2, size=size), 
                                   np.random.normal(loc=100, scale=2, size=size))),
                   'c': np.hstack((np.zeros(shape=size), np.ones(shape=size)))})

fig = px.scatter(data_frame=df, x='x', y='y', facet_col='c')
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

Run the provided Python reproduction with 501 points and faceted scatter plots, then compare horizontal mouse zooming with rectangle and y-axis zooming. Done means horizontal zooming keeps the two y axes scaled consistently, including when the dataset has 501 or more points.

Written by the indexing model from the issue text.

Assessment

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