Issue
I have a loop like this
#!/usr/bin/env python
import matplotlib.pyplot as p
for i in xrange(N):
# Create my_image here
# Display this image
p.figure()
p.imshow(my_image)
p.show()
p.close()
This works fine when i=0. For the program to continue, I need to close the new figure created by pyplot. For all other loop iterations (i>0), another new figure is not created, a plot is not presented and the program just moves on. Why does closing a figure making pyplot unable to open new one (like MATLAB)?
The behavior which I expect is:
- Execution stops at
p.show()
- When I close the figure, execution continues
- When
p.show()
is encountered again, the new image is displayed. - Repeat step 2 until no more plot to show
Solution
It might be from a bug in previous versions of matplotlib. I was having a similar problem when I issued sequential show()
commands -- only the first would show (and stay); but, when I updated matplotlib to 1.0.1 the problem went away.
Answered By - Andy Barbour
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.