Feature Request: Add SubFigures to Mpf_Figure
traderjoe1968 opened this issue · 2 comments
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
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 sfCurrent 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
Yes, I've been thinking about this for a while. Thanks for the input and code. Definitely want to do this.
It's a little more complicated to get this to work correctly. I have the basic stuff working, however I had to use external axes to pass in subfigure. It would be better for mpf plotting routine to take in a Fig/SubFigure param to use as the canvas.
This is very worthwhile as then the overall chart can be composed of multiple SubFigures.
eg (Note: not currently working as I want)
