Note that there are some explanatory texts on larger screens.

plurals
  1. POPython matplotlib Update figure after savefig called
    primarykey
    data
    text
    <p>My problem is: I have Matplotlib figure in PyGTK application, that is constatly updated each few seconds. I've added abbility to save figure to disk as PNG file. After calling <code>figure.savefig(filename, other parameters)</code> my figure in application stops being updated.</p> <p>Figure initialization phase:</p> <pre><code># setup matplotlib stuff on empty space in vbox4 figure = Figure() canvas = FigureCanvasGTK(figure) # a gtk.DrawingArea canvas.show() self.win.get_widget('vbox4').pack_start(canvas, True, True) # this will be aded to last place self.win.get_widget('vbox4').reorder_child(canvas, 1) #place plot to space where it should be </code></pre> <p>Figure is being updated this way (this called each few seconds in separate thread):</p> <pre><code>def _updateGraph(self, fig, x, x1, y): #Various calculations done here fig.clf()#repaint plot: delete current and formate a new one axis = fig.add_subplot(111) #axis.set_axis_off() axis.grid(True) #remove ticks and labels axis.get_xaxis().set_ticks_position("none") for i in range(len(axis.get_xticklabels())): axis.get_xticklabels()[i].set_visible(False) axis.get_yaxis().set_ticks_position("none") axis.plot(numpy.array(x),numpy.array(y)/(1.0**1), "k-" ,alpha=.2) axis.set_title('myTitle') fig.autofmt_xdate() fig.canvas.draw() </code></pre> <p>everything works as expected. But after calling:</p> <pre><code>figure.savefig(fileName, bbox_inches='tight', pad_inches=0.05) </code></pre> <p>File have been saved, BUT <strong>my figure on screen stops being updated</strong>. </p> <p>Any ideas how do I save figure to disk and still be able to update my fig on screen ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload