mirror of https://github.com/tqdm/tqdm.git
gui: fix matplotlib
This commit is contained in:
parent
35a6ee9a45
commit
c66458d9ac
17
tqdm/gui.py
17
tqdm/gui.py
|
@ -122,6 +122,7 @@ class tqdm_gui(std_tqdm): # pragma: no cover
|
||||||
ax = self.ax
|
ax = self.ax
|
||||||
line1 = self.line1
|
line1 = self.line1
|
||||||
line2 = self.line2
|
line2 = self.line2
|
||||||
|
hspan = getattr(self, 'hspan', None)
|
||||||
# instantaneous rate
|
# instantaneous rate
|
||||||
y = delta_it / delta_t
|
y = delta_it / delta_t
|
||||||
# overall rate
|
# overall rate
|
||||||
|
@ -148,18 +149,10 @@ class tqdm_gui(std_tqdm): # pragma: no cover
|
||||||
if total:
|
if total:
|
||||||
line1.set_data(xdata, ydata)
|
line1.set_data(xdata, ydata)
|
||||||
line2.set_data(xdata, zdata)
|
line2.set_data(xdata, zdata)
|
||||||
try:
|
if hspan:
|
||||||
poly_lims = self.hspan.get_xy()
|
hspan.set_xy((0, ymin))
|
||||||
except AttributeError:
|
hspan.set_height(ymax - ymin)
|
||||||
self.hspan = self.plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g')
|
hspan.set_width(n / total)
|
||||||
poly_lims = self.hspan.get_xy()
|
|
||||||
poly_lims[0, 1] = ymin
|
|
||||||
poly_lims[1, 1] = ymax
|
|
||||||
poly_lims[2] = [n / total, ymax]
|
|
||||||
poly_lims[3] = [poly_lims[2, 0], ymin]
|
|
||||||
if len(poly_lims) > 4:
|
|
||||||
poly_lims[4, 1] = ymin
|
|
||||||
self.hspan.set_xy(poly_lims)
|
|
||||||
else:
|
else:
|
||||||
t_ago = [cur_t - i for i in xdata]
|
t_ago = [cur_t - i for i in xdata]
|
||||||
line1.set_data(t_ago, ydata)
|
line1.set_data(t_ago, ydata)
|
||||||
|
|
Loading…
Reference in New Issue