|
From: Eric F. <ef...@ha...> - 2014-06-28 07:20:54
|
On 2014/06/27, 9:59 AM, zunbeltz wrote: > I have a script that fetchs data from a database and plot using > something similar to > > fig, (ax1, ax3) = plt.subplots(2, 1, sharex=False, sharey=False, num=fignum) > ax1.errorbar(...) > title(...) > ax2 = ax1.twiny() > ax4 = ax2.twiny() > ... > plt.legent() > plt.draw() > > Then, I call this script with plt.ion() and I use plt.show(block=True); > so the plot stays opened. > > Now, I want to rerun the script every second to get the updated data > from the database. Is it posible to have the plot no blocking the script > and being refresh? You might find that plt.pause(1) is helpful. See pylab_examples/animation_demo.py. Also, it sounds like running via ipython, if possible, would make things easier for you; it takes care of all sorts of difficulties with interactivity. And it's wonderfully helpful in other ways as well. > > I try to use block=False but this makes that the plot is not shown. I > want to change my original script as little as possible. One posible > idea I have is to pickle the plot (in the original script); and use > another script that opens the pickled file every second. That sounds overly complex and roundabout. I'm sure that one or more of the suggestions above can lead to a simple solution. Eric > > TIA > > Zunbeltz > (posted unsuccessfully at stackoverflow) > > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |