-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix double visualization issues #53
Comments
This is a known bug/feature caused by behaviour of jupyter with matplotlib. Whenever the plot() is called, jupyter renders it. If the function returns the plot too, jupyter will render it 2nd time. We return the plot if the user wants to adjust it or play around with it themselves. The fastest and easiest fix for this would be to assign a variable before calling the plot. This will still make it render in jupyter but prevents it from doing it twice. There are several other options, but they are not really good for various reasons. E.g. closing the plot in the function - it will affect the behaviour outside of jupyter on linux platforms. Setting the matplotlib to inline within jupyter The setup for every plotting function for jupyter run (adding bool param to the function in_jupyter) - not desirable as it increases params set for every single function in vis. |
What if we check whether the code runs in Jupyter notebook? Does this happen also with the object oriented matplotlib api? What's the main difference between the code that emits Jupyter widget when calling plot vs. the one that doesn't? |
It is possible to check, yes, via env var, and return the fig conditionally to it.
Not sure what you mean here.
Jupyter calls figure rendering automatically. If I don't return figure from the function, the behaviour is not observed in my env. There are 3 use cases of our API: jupyter, vanilla python plotting interface, and operating on the plotting function output to e.g. adjust styling. Depending on the priority we give for each, this can be solved differently. My perspective is that jupyter is not the main priority/use case, so the fix should be rather on the side of jupyter than in python code. |
For now fixed with var assignement. Updated with conditional on jup env, will submit after merge dev to main, since all vignettes will be affected. |
currently the fix is at 5c7d288 |
To make it more precise, what about:
|
Some plots appear repeated on the Jupyter notebooks executions. To be fixed and tested in at least 2 computers.
The text was updated successfully, but these errors were encountered: