plotly / plotly/plotly.py

secondary_y creates a small spacing on the right

未关闭
#3,210 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
Python
星标
18.8k
派生
2.8k
平均合并
16 小时 26 分钟
30 天内合并 PR
21

描述

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()

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先运行 issue 中的两个 Plotly Python 示例,并比较有 secondary_y 和没有 secondary_y 时渲染图表的宽度。跟踪涉及 secondary_y 的 subplot 和 layout 处理;当右侧多余的空白消失,同时两个 y 轴和显示的 traces 仍然正确时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
plotly, python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。