matplotlib / matplotlib/mplfinance

Feature Request: Add SubFigures to Mpf_Figure

Open
#664 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Presently the Mpf_Figure class does not support mpl subfigure plots. Subfigures allow encapsulation of a group of subcharts into one figure that can then be embedded easily in the overall figure

Adding the following function to Mpf_Figure class will add in subfigures
``` Python
def add_subfigure(self,*args,**kwargs):

if 'style' in kwargs or not hasattr(self,'mpfstyle'):
style = _check_for_and_apply_style(kwargs)
else:
style = _check_for_and_apply_style(dict(style=self.mpfstyle))

sf = mplfigure.Figure.add_subfigure(self, *args, **kwargs)
sf.mpfstyle = style
self.subfigs += [sf]
return sf
```

Current Alternative solution / workaround is to sub-class Mpf_Figure and add this in. It would be preferable not to have to do this as SubFigure are part of the mpl and should be supported in mpf

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

Locate the Mpf_Figure class and its existing subplot or figure-management methods; the issue does not name a file or test. Compare those entry points with Matplotlib's Figure.add_subfigure API, then verify that subfigures inherit the relevant style, are tracked by the figure, and can be used without subclassing Mpf_Figure.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.