matplotlib - using interactive and non-interactive backends within one program -


i running code written pyqt4 uses matplotlib's qt4agg backend showing live plots in windows. @ same time, use matplotlib in background thread produce (different) figures saved file, not shown on screen.

i can use qt4agg in background thread, getting bunch of

qpixmap: not safe use pixmaps outside gui thread 

warnings, , crashes in cases.

as far see, matplotlib supports using 1 backend @ given time (which can changed via switch_backend, closes existing figures). there way work around limitation, , assign per-figure backend?

to knowledge, if don't use pyplot interface.

for instance, using full oo interface simple plot:

from matplotlib.backends.backend_agg import figurecanvasagg figurecanvas matplotlib.figure import figure  fig = figure() canvas = figurecanvas(fig) ax = fig.add_subplot(1,1,1) ax.plot([1,2,3]) canvas.print_figure('test.png') 

hth


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -