I have multiple canvas and sometimes one or more might have nothing to draw (no data).
Currently I just call.
canvas.draw()
canvas.Refresh()
for each of the canvas, but this gives me an error if there is no data.
Is there a built-in flag I can check before calling draw? Or do I have to keep create my own?
Werner
PS
If it is of any help, I get this (also I have mpl.verbose.level = u'silent':
C:\Python25\lib\site-packages\matplotlib\axes.py:3996: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots.
warnings.warn("No labeled objects found. "
And here is the traceback.
Traceback (most recent call last):
File "C:\Dev\twcbBranchv31\Program\panelstats.py", line 178, in DoRefresh
self.RefreshAllGraphs()
File "C:\Dev\twcbBranchv31\Program\panelstats.py", line 313, in RefreshAllGraphs
self.priceChangeP.canvas.draw()
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py", line 59, in draw
FigureCanvasAgg.draw(self)
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py", line 314, in draw
self.figure.draw(self.renderer)
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 774, in draw
for a in self.axes: a.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1721, in draw
a.draw(renderer)
File "C:\Python25\Lib\site-packages\matplotlib\artist.py", line 46, in draw_wrapper
draw(artist, renderer, *kl)
File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 736, in draw
for tick, loc, label in self.iter_ticks():
File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 677, in iter_ticks
majorLocs = self.major.locator()
File "C:\Python25\Lib\site-packages\matplotlib\dates.py", line 754, in __call__
dmin, dmax = self.viewlim_to_dt()
File "C:\Python25\Lib\site-packages\matplotlib\dates.py", line 454, in viewlim_to_dt
return num2date(vmin, self.tz), num2date(vmax, self.tz)
File "C:\Python25\Lib\site-packages\matplotlib\dates.py", line 249, in num2date
if not cbook.iterable(x): return _from_ordinalf(x, tz)
File "C:\Python25\Lib\site-packages\matplotlib\dates.py", line 170, in _from_ordinalf
dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1