plotly / plotly/plotly.py

Traces in facet plot drawn outside of figure area.

Open
#3,549 4 comments 0 reactions 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

Code to reproduce the issue:

import pandas as pd
import numpy as np
import plotly
import string
np.random.seed(0)
plotly.io.renderers.default = "browser"
COL_NAME = "Key"
FIGURE_HEIGHT = 12200
column_names = string.ascii_letters[0:20]
# FIGURE_HEIGHT = 7200  # This removes the issue 
# column_names = string.ascii_letters[0:10]  # This removes the issue 
df = pd.DataFrame(np.random.randint(0,100,size=(100, len(column_names))), columns=list(column_names))
df.columns.name = COL_NAME
fig = plotly.express.line(df,facet_row=COL_NAME,height=FIGURE_HEIGHT)
fig.show()

Screenshot of what I'm seeing:
image

Issue may have to do with the height argument or the number of traces included in the figure, or some other aspect I don't suspect.

Thank you for the help and for the great visualization tool!

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 with the provided reproduction using plotly.express.line with facet_row, a 12,200-pixel height, and 20 columns, then inspect the resulting figure through fig.show(). Compare it with the 7,200-pixel and 10-column cases that do not reproduce the issue; done means all traces remain inside the figure area for the failing case.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, plotly, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.