Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add SubFigures to Mpf_Figure #664

Open
traderjoe1968 opened this issue Mar 30, 2024 · 2 comments
Open

Feature Request: Add SubFigures to Mpf_Figure #664

traderjoe1968 opened this issue Mar 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@traderjoe1968
Copy link

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 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

@traderjoe1968 traderjoe1968 added the enhancement New feature or request label Mar 30, 2024
@DanielGoldfarb
Copy link
Collaborator

Yes, I've been thinking about this for a while. Thanks for the input and code. Definitely want to do this.

@traderjoe1968
Copy link
Author

traderjoe1968 commented Mar 31, 2024

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)

Figure_1

mplot copy.py.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants