From: Perry G. <pe...@st...> - 2004-12-11 17:44:28
|
John Hunter wrote: [...] > > By default, matplotlib defers drawing until the end of the script > because drawing can be an expensive opertation, and you may not > want to update the plot every time a single property is changed, only > once after all the properties have changed. > > But in interactive mode, eg from the python shell, you usually do want > to update the plot with every command, eg, after changing the xlabel > or the marker style of a line. With the TkAgg backend, you can use > matplotlib from an arbitrary python shell. Just set TkAgg to be your > default backend and interactive to be True in your matplotlibrc file > and fire up python. Then > > >>> from pylab import * > >>> plot([1,2,3]) > >>> xlabel('hi mom') > > should work out of the box. Note, in batch mode, ie when making > figures from scripts, interactive mode can be slow since it redraws > the figure with each command. So you may want to think carefully > before making this the default behavior. TkAgg sets interactive mode > to True when you issue the show command. > [...] I'd just add that we may want to recommend that using ioff(), ion() be part of the matplotlib idiom for writing demos and larger, more involved plotting programs and scripts particularly where the author of the script or function is unsure of what context it will be run in. That way it always runs efficiently. Does that seem a reasonable thing to recommend? Perry |