-
Notifications
You must be signed in to change notification settings - Fork 227
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
figure changes size at end of loop if drawn dynamically #17
Comments
Do you have high-dpi display? |
I do, is that the problem? |
It shouldn't be a problem, but it is :) The way that the high-dpi displays are handled is by adding a layer of 'virtual pixels' that unless you opt-out just 'zooms' your bitmaps by 2x. What looks like is happening here is that the js side is correctly opting out, but it is not being threaded through to matplotlib to render the image and double the 'virtual' dpi until after the cell is finished executing. Until we sort this out splitting everything after |
thanks for the comment @tacaswell. What do you mean exactly by "splitting evething (...) into a second cell"? |
I mean put it in a second cell so the first cell creates and show the figure, the second updates it. |
I am also running into this issue -- exactly the same plotting mechanism and symptoms (on the latest Anaconda). It would be nice if it wasn't necessary to split the plots in this way when using Retina displays (which is basically all macs nowadays). |
@wjakob The parameter that controls this is https://github.com/matplotlib/jupyter-matplotlib/blob/master/ipympl/backend_nbagg.py#L141 . I suspect what is happening is:
One (very hackish) solution is to do |
any solution to this problem? |
@tiehfood I think someone needs to look into the communications between the js front end and the python side to sort out when the dpi is negotiated, would you be interested in trying? The revelant code is likely in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_webagg_core.py and https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_nbagg.py |
I am no code expert and I have just access to the jupyter front end in this case... |
I tried to find the reason for this issue. I added print statements to the messages handling Python side, and it appears that all the messages (i.e. |
As we are not using the tornado application with ipympl, I suspect the way to fix it would be to get rid of it on the backend |
Any updates on this front? |
This bug is now 3 years old and I still have this issue. Are there any plans how this can be fixed? |
Hi Guys, I was facing the same issue, I was creating different plots into the same cell using a loop, the way I fixed it was putting the fig = plt.figure(figsize=(20, 10)) inside the loop. Now all the plots has the same size into the execution of the same cell. I had it out of the loop before. Check the example below: |
As per the title, consider the following snippet:
and this is what I get running it:
I used
plt.show()
at the beginning of the loop because nothing gets drawn otherwise.Is there a way to avoid this?
The text was updated successfully, but these errors were encountered: