plotly / plotly/plotly.py

secondary_y creates a small spacing on the right

Open
#3,210 2 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

It looks like secondary_y would cause the chart to render a small chunk of whitespace to the right of it.

With secondary_y:

image

import plotly.graph_objects as go
from plotly.subplots import make_subplots


fig = make_subplots(specs=[[{'secondary_y': True}]])

fig.add_trace(go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name='yaxis data'), secondary_y=False)
fig.add_trace(go.Scatter(x=[2, 3, 4], y=[4, 5, 6], name='yaxis2 data'), secondary_y=True)

fig.update_layout(legend={'y': 1, 'x': 0}, margin={'t': 0, 'b': 0, 'l': 0, 'r': 0})
fig.show()
Without secondary_y:

image

import plotly.graph_objects as go
from plotly.subplots import make_subplots


fig = make_subplots()

fig.add_trace(go.Scatter(x=[1, 2, 3], y=[40, 50, 60], name='yaxis data'))
fig.add_trace(go.Scatter(x=[2, 3, 4], y=[4, 5, 6], name='yaxis2 data'))

fig.update_layout(legend={'y': 1, 'x': 0}, margin={'t': 0, 'b': 0, 'l': 0, 'r': 0})
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 two Plotly Python examples in the issue and compare the rendered chart widths with and without secondary_y. Trace the subplot and layout handling involved in secondary_y; done means the extra right-side whitespace is gone while both y-axes and the displayed traces remain correct.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.