0

I have problem with pyplot window. When I try to change window size after ploting is done I get the following exception:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1532, in __call__
    return self.func(*args)
  File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 277, in resize
    self.resize_event()
  File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line 1788, in resize_event
    self.callbacks.process(s, event)
  File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 540, in process
    proxy(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 415, in __call__
    return mtd(*args, **kwargs)
  File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 859, in _handle_resize
    self._init_draw()
  File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 1077, in _init_draw
    self._draw_frame(next(self.new_frame_seq()))
StopIteration

Ploting is done by:

self.ani = animation.FuncAnimation(self.fig, self._set_data, self._is_running(), interval=20, repeat=False, blit=True)
plt.show()

When ploting is done everything is ok. After maximizing window, exception is thrown, window is maximized but its all grey (no plot). Then I change its size again and everything goes back to normal and plot is drawn. Can someone point me whats wrong or where to look for answer?

OS: Windows 7
Python: 2.9 32b
Matplotlib ver: 1.4.2, backend: TkAgg

2
  • It might help to post code that is a Minimal, Complete, and Verifiable example. It is much easier for anyone to debug by running code than by looking at two lines of code, because you can actually see the problem and directly try to fix it. Commented Feb 13, 2015 at 22:28
  • Thanks for answer. This is my first post, sorry about that. My code has many lines (too many to post it) and I cannot reproduce this by creating short example. I thought that my problem would be simple to solve for someone who has experience with matplotlib (something obvious). I'll try to reproduce this and present short example. Commented Feb 15, 2015 at 0:23

1 Answer 1

1

I had a similar problem (on Fedora), while working with a large amount of data. But with diferent error: OverflowError: In draw_path: Exceeded cell block limit. I had the same error saving the image with high dpi resolution, as plt.savefig('example.png', dpi=282). No error with low dpi parameter.

I found a solution to my problem in: https://github.com/matplotlib/matplotlib/issues/5907

So, the basic answer is:

Try:

import matplotlib as mpl
mpl.rcParams['agg.path.chunksize'] = 10000 # the default is 0

You can change it in matplotlibrc file to make it default. You can find your matplotlibrc location with:

matplotlib.matplotlib_fname()

then you can change agg.path.chunksize parameter uncommenting the line and setting the new default value:

agg.path.chunksize : 10000

http://matplotlib.org/users/customizing.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.