469,600 Members | 2,185 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,600 developers. It's quick & easy.

How to handle output window minimize/movement in interactive mode of matplotlib

I want to dynamically update the scatter plot based on the y-axis data received from a socket connection. I used python matplot lib in interactive mode to do this, but during dynamic updation if i move the window to a different location or minimize the window then the plot updation stops abruptly. Please let me know how to do this?

I have attached a sample dynamic updation code used here and the same problem appears here also, please help.
Expand|Select|Wrap|Line Numbers
  1. import matplotlib.pyplot as plt
  2. import random
  3. import time
  4. items = [25.5,26.7,23.4,22.5,20,13.4,15.6,-12,-16,20]
  5. x = [1,2,3,4,5,6,7,8,9,10]
  7. plt.ion() #  Interactive on
  9. for i in range(1,100):
  10.     plt.title('graph plotting')
  11.     plt.ylabel('temperature')
  12.     plt.xlabel('time')
  13.     random.shuffle(items)
  14.     plt.plot(x,items,'ob-')
  15.     plt.axis([0, 10, -40, 40])
  16.     plt.draw()
  17.     #time.sleep(2)
  18.     plt.clf()
  19. plt.close()
Dec 21 '09 #1
2 3329
391 Expert 256MB

If you manage to do this, I'd be very interested! I use matplotlib to make my plots for papers, presentations etc, but also use python to control experiments, and couldn't figure out how to do this exact thing with matplotlib, although I didn't try as hard as I could yet! Still somewhere down there on my to do list!

Anyway, the way I solved it was with gnuplot, and the corresponding gnuplot module for python. I don't really know how to use gnuplot, but you don't really have to, as it's a similar kind of interface to matplotlib.

However, I have a feeling there's a python mega widget (PMW) or something similar that might be better still for this purpose. I vaguely remember seeing something about this in Langtangen's excellent Python Scripting for Computational Scientists. I'll try to remember to look it up when I get back to the office.
Dec 27 '09 #2
Ya I figured out how to do this...You need to use wxPython with matplotlib for this purpose...refer this link for more
Dec 28 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Moosebumps | last post: by
reply views Thread by Andrej Dzerzhinsky | last post: by
1 post views Thread by Darren Dale | last post: by
4 posts views Thread by Brad Jones | last post: by
5 posts views Thread by Christophe HELFER | last post: by
20 posts views Thread by Ilias Lazaridis | last post: by
8 posts views Thread by Boki | last post: by
5 posts views Thread by =?Utf-8?B?SmFtZXMgV29uZw==?= | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.