plotly / plotly/plotly.py

[BUG]: Subplot LaTeX titles misaligned

Open
#5,624 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

make_subplots produces plots with misaligned LaTeX titles:
Image

Nor do they seem to be properly centered.
Saving the image with fig.write_image(img.png) does not render it differently.

If you remove the letter "p" from the title on the right or add one on the left, that seems to "solve" the vertical alignment problem.

Steps to reproduce
from plotly.subplots import make_subplots

fig = make_subplots(rows=1, cols=2,
                    subplot_titles=(r'$\Large\text{Investment Rate}$',r"$\Large\text{Experts' Capital Share}$"))

fig.add_scatter(x=[], y=[], row=1, col=1)
fig.add_scatter(x=[], y=[], row=1, col=2)

fig.update_layout(#template="plotly_white+presentation", 
                  height=600, width=1200)
fig

Version: 6.8.0


I also think the default positioning of the title should be a tiny bit higher.

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 plotly 6.8.0, starting at make_subplots and the subplot-title positioning path. Compare interactive rendering with fig.write_image(img.png); done means the LaTeX titles are vertically aligned and centered, with the default title position slightly higher if that request is included.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.