Skip to content

Commit

Permalink
matplotlib sysplot 增加 only_draw_close,避免数据量较大时, matploblib 绘制 K 线过慢
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Apr 29, 2024
1 parent 2471f59 commit 1c8e03f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hikyuu/draw/drawplot/matplotlib_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,14 +681,15 @@ def cnplot(cn, new=True, axes=None, kdata=None):
axes.fill_between(x, y1, y2, where=y2 < y1, facecolor='red', alpha=0.6)


def sysplot(sys, new=True, axes=None, style=1):
def sysplot(sys, new=True, axes=None, style=1, only_draw_close=False):
"""绘制系统实际买入/卖出信号
:param SystemBase sys: 系统实例
:param new: 仅在未指定axes的情况下生效,当为True时,
创建新的窗口对象并在其中进行绘制
:param axes: 指定在那个轴对象中进行绘制
:param style: 1 | 2 信号箭头绘制样式
:param bool only_draw_close: 不绘制K线,仅绘制 close
"""
kdata = sys.to

Expand All @@ -698,7 +699,10 @@ def sysplot(sys, new=True, axes=None, style=1):
if axes is None:
if new:
axes = create_figure()
kplot(kdata, axes=axes)
if only_draw_close:
iplot(kdata.close, axes=axes)
else:
kplot(kdata, axes=axes)
else:
axes = gca()

Expand Down

0 comments on commit 1c8e03f

Please sign in to comment.