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: to show only specific figure created in plotting.py instead of using plt.show we use fig.show. #510

Open
anbarief opened this issue Mar 18, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@anbarief
Copy link
Contributor

anbarief commented Mar 18, 2022

Running the code below, Python will pop up the window (figure) created in plotting.py and also the userfig window I created independently in this piece of code. Usually if people want to show the userfig they can just run userfig.show().

userfig,ax = plt.subplots() #I want the userfig to be only showed when I use userfig.show()

dataset = pd.read_csv('data.csv', index_col=0, parse_dates= True)
n = len(dataset)

mpf.plot(dataset, type='candle', style='yahoo')

This is due to in plotting.py it uses plt.show (which shows all figures created in your Python code, including outside the plotting.py) instead of specific figure fig.show to show only the figure created in plotting.py. The downside of using fig.show is that it does not have block argument, but i think this is not a problem, since the user can use plt.show independently outside the plotting.py if he needs the block. I propose this change in plotting.py:

BEFORE:
Capture2

AFTER:
Capture

@anbarief anbarief added the enhancement New feature or request label Mar 18, 2022
@DanielGoldfarb
Copy link
Collaborator

This is a very interesting idea. At first glance I like it. Will look into it further to make sure there are no unintended consequences. Thanks for the suggustion.

anbarief added a commit to anbarief/mplfinance that referenced this issue Mar 27, 2022
to show only specific figure created in plotting.py instead of using plt.show we use fig.show. matplotlib#510
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