Skip to content

Commit

Permalink
ensure np array before looking for minpositive value
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Oct 5, 2020
1 parent 42ab37b commit f26bbab
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions wxmplot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,21 @@ def set_viewlimits(self):
try:
for trace, lines in enumerate(ax.get_lines()):
x, y = lines.get_xdata(), lines.get_ydata()
if y_minpos is None:
y_minpos= min(y[np.where(y>0)])
else:
y_minpos= min(y_minpos, min(y[np.where(y>0)]))
if x_minpos is None:
x_minpos= min(x[np.where(x>0)])
else:
x_minpos= min(x_minpos, min(x[np.where(x>0)]))

try:
if not isinstance(y, np.ndarray):
y = np.array(y)
if not isinstance(x, np.ndarray):
x = np.array(x)
if y_minpos is None:
y_minpos= min(y[np.where(y>0)])
else:
y_minpos= min(y_minpos, min(y[np.where(y>0)]))
if x_minpos is None:
x_minpos= min(x[np.where(x>0)])
else:
x_minpos= min(x_minpos, min(x[np.where(x>0)]))
except:
pass
if limits == [None, None, None, None]:
limits = [min(x), max(x), min(y), max(y)]
else:
Expand Down

0 comments on commit f26bbab

Please sign in to comment.