Skip to content

Add option for plot function to return figure and not display the figure itself. #46

Closed
@MikeAMCloud

Description

@MikeAMCloud

I desire to use mplfinance with tkinter.

To do this most straight forwardly I desire an option to return the figure.

So adding an option returnfig, using code something like the below:

Adding to vkwargs:

    'returnfig': {'Default': False,'Validator': lambda value: isinstance(value, bool)},

And extending the "savefig" code something like the below:
Code something like the below:

if config['savefig'] is not None:
    save = config['savefig']
    if isinstance(save,dict):
        plt.savefig(**save)
    else:
        plt.savefig(save)
else:
    if config['returnfig'] is not None:
        save = config['returnfig']
        if save:
            return (fig)            
    # https://stackoverflow.com/a/13361748/1639359 suggests plt.show(block=False)
    plt.show(block=config['block'])

Metadata

Metadata

Labels

enhancementNew feature or requestreleasedcode merged into repo AND released to Pypi

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions