matplotlib / matplotlib/matplotlib

[ENH]: Configureable default padding around figure when using constrained_layout

Open
#27,584 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

New feature topic: geometry manager
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

### Problem

Constrained layout figures fill out their frames too well, and adding padding during savefig makes the figures no longer adhere to the figsize given in my stylesheet, and isn't a by-default configured amount of padding. When these figures will be used (sometimes two half page-width figures side by side) in my latex document, the contents sit way too close. I don't want to change spacing within the subplot group -- that's all fine, I just want constrained layout to add space around the figure (incl. labels and maybe titles) while respecting the outer figure dimensions.

### Proposed solution

Add padding arguments to rcParams so that they may be configured on a stylesheet. These padding arguments should not influence the spacing of elements within the figure -- only around the figure.

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 reviewing how constrained layout currently determines spacing around the figure and how rcParams are defined and applied. Establish how configurable outer padding can preserve the requested figsize without changing spacing within the subplot group, then add focused coverage for the proposed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.