Skip to content

Commit

Permalink
avoid duplication, properly stash errorbar data
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed May 19, 2022
1 parent 8440218 commit 062520e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions wxmplot/plotpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ def oplot(self, xdata, ydata, side='left', label=None, xlabel=None,
conf.set_trace_alpha(alpha, delay_draw=True)

conf.dy[conf.ntrace] = dy
_lines = axes.plot(xdata, ydata, drawstyle=drawstyle, zorder=zorder)
if dy is not None and not fill:
_lines = axes.errorbar(xdata, ydata, yerr=dy, zorder=zorder)
_fill = None
if fill:
fkws = dict(step=None, zorder=zorder, color=color)
if drawstyle != 'default':
Expand All @@ -234,10 +230,15 @@ def oplot(self, xdata, ydata, side='left', label=None, xlabel=None,
_fill = axes.fill_between(xdata, ydata, y2=0, **fkws)
else:
_fill = axes.fill_between(xdata, ydata-dy, y2=ydata+dy, **fkws)

else: # not filling -- most plots here
_fill = None
if dy is not None:
ebar = axes.errorbar(xdata, ydata, yerr=dy, zorder=zorder)
_lines = [ebar.lines[0], ebar.lines[2]]
else:
_lines = axes.plot(xdata, ydata, drawstyle=drawstyle, zorder=zorder)
conf.traces[conf.ntrace].fill = fill


if axes not in conf.data_save:
conf.data_save[axes] = []
conf.data_save[axes].append((xdata, ydata))
Expand Down

0 comments on commit 062520e

Please sign in to comment.