plotly / plotly/plotly.py

[Feature request] Make it easier to specify spacing in between titles and subtitles

Open
#5,434 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I really appreciate the subtitle parameter within Plotly Express charts. However, I'm finding that, when I use title_y to update the title's location, the subtitle's location doesn't follow accordingly. This can result in unsightly gaps between the title and subtitle.

Would it be possible to add a subtitle_y dimension that would let me adjust the spacing between title and subtitle elements? I suppose subtitle_x would be handy also in case some users want a horizontal offset between titles and subtitles.

Here are some screenshots for reference. First, in this chart, I'd like to move the title and subtitle up to increase the spacing between those elements and my legend:

Image

I can set title_y to 0.98 to move it farther from the legend; however, the y position of the subtitle moves up only a little, thus increasing the gap between the two.

Image

If there were a corresponding subtitle_y parameter that I could adjust, I would be able to easily resolve this issue. (In the meantime, I can get around it by creating subtitles via add_annotation.)

Thank you in advance for your consideration and help!

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 at the Plotly Express subtitle and title positioning behavior, especially how title_y affects the subtitle; compare it with the current add_annotation workaround. Done means users can independently control subtitle vertical and horizontal offsets without the unwanted gap, with the behavior documented and covered by appropriate checks.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.