Adding secondary-y latex legend name shifts x-axis coordinates
未关闭
还没有人认领这个 Issue。
bug
P3
sev-3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Plotly version 5.20.0.
I am creating subplots with seconary y-axes. When I add the name attribute to a figure that includes a Latex string, the x-axis coordinates are incrementally shifted more and more to the right with each subplot. For instance, the first subplot in this image renders fine, but 2 through 4 are shifted right:
This only happens when including the Latex string.
Here's a minimal working example:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
x = [1, 2, 3, 4]
y = [1]*4
R = 1
C = 4
fig = make_subplots(
rows=R,
cols=C,
specs=[
[{"secondary_y": True} for _ in range(C)]
for _ in range(R)
],
)
rc = [(r, c) for r in range(R) for c in range(C)]
for i, (r, c) in enumerate(rc):
fig.add_trace(
go.Scatter(
x=x,
y=y,
showlegend=not i,
name="y1",
),
row=r+1,
col=c+1,
secondary_y=False,
)
fig.add_trace(
go.Scatter(
x=x,
y=y,
showlegend=not i,
name=r"$y$2",
),
row=r+1,
col=c+1,
secondary_y=False,
)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
运行提供的包含四个子图的最小可运行示例,并比较带有和不带有 LaTeX 图例名称时的渲染结果。跟踪渲染期间子图 x 轴坐标的计算方式,然后验证当次坐标轴的 trace 使用 LaTeX 标签时,所有子图的位置仍保持对齐。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100