matplotlib / matplotlib/mplfinance

difference in size between saved plot and fig

Open
#600 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
4.4k
Forks
678
PR merge metrics
No merged PRs in 30d

Description

I do not understand why plots differ in terms of size and how they look when I try to save them or returnfig.

I generate plots of figsize (9,4) when I save them they look great, with a tight layout, no margins and axes excellent! But I need these plots again so it would be better to use a buffer instead. However, when I use the buffer resulting plot has a different size and added margins on one side.

The saved plot has size (365, 801, 1) while plot from the buffer (400, 900, 1).

I appreciate any suggestions how to use buffer but without adding margins.
Thank you

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

Reproduce the plot using figsize (9,4), first saving it and then retrieving it through a buffer with returnfig. Compare the resulting dimensions and margins, including the reported sizes (365, 801, 1) and (400, 900, 1). Done means the buffer result matches the saved plot without the added margins.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.