Skip to content

Commit

Permalink
gui: fix matplotlib
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Nov 6, 2024
1 parent 35a6ee9 commit c66458d
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions tqdm/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def display(self, *_, **__):
ax = self.ax
line1 = self.line1
line2 = self.line2
hspan = getattr(self, 'hspan', None)
# instantaneous rate
y = delta_it / delta_t
# overall rate
Expand All @@ -148,18 +149,10 @@ def display(self, *_, **__):
if total:
line1.set_data(xdata, ydata)
line2.set_data(xdata, zdata)
try:
poly_lims = self.hspan.get_xy()
except AttributeError:
self.hspan = self.plt.axhspan(0, 0.001, xmin=0, xmax=0, color='g')
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)
if hspan:
hspan.set_xy((0, ymin))
hspan.set_height(ymax - ymin)
hspan.set_width(n / total)
else:
t_ago = [cur_t - i for i in xdata]
line1.set_data(t_ago, ydata)
Expand Down

0 comments on commit c66458d

Please sign in to comment.