By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,340 Members | 1,413 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,340 IT Pros & Developers. It's quick & easy.

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

P: 2
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]
  6.  
  7. plt.ion() #  Interactive on
  8.  
  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
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 391
Hi

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

P: 2
Ya I figured out how to do this...You need to use wxPython with matplotlib for this purpose...refer this link for more
http://eli.thegreenplace.net/2008/08...wxpython-guis/
Dec 28 '09 #3

Post your reply

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