Skip to content

Commit

Permalink
fixed DRAWIMG 添加 nan 保护
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Feb 12, 2025
1 parent 243c616 commit 32f109e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hikyuu/draw/drawplot/matplotlib_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,8 @@ def DRAWIMG(cond: Indicator, price: Indicator, img: str, kdata: KData = None, ne
w = xw / pw * pixel
h = yh / ph * pixel
for i in range(cond.discard, len(cond)):
if cond[i] > 0.:
if (not isnan(cond[i])) and cond[i] > 0. and (not isinf(cond[i])) and (not isnan(price[i])) and (not isinf(price[i])):
print(i, i-w, i+w, price[i]-h, price[i]+h)
axes.imshow(image, extent=[i-w, i+w, price[i]-h, price[i]+h], *args, **kwargs)

axes.set_aspect('auto')
Expand Down

0 comments on commit 32f109e

Please sign in to comment.