matplotlib / matplotlib/mplfinance

The use of `returnfig=True` creates multiple figures when using ipywidgets

オープン
#673 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Python
スター
4.4k
フォーク
678
PR マージ指標
30日以内にマージされた PR はありません

説明

Describe the bug
If you provide returnfig=True or use your own axes, updating the ipywidgets produces additional plots.

To Reproduce
this example uses 15 min klines, but that doesn't matter.

@interact(
        start_pos = widgets.FloatSlider(value=0, max=len(df.index) - 1 - 7 * 96, min=0, step=1),
        length    = widgets.FloatSlider(value=7 * 96, max=7 * 96, min=96, step=96),
        
        )
def plot_func(start_pos, length):
    start_pos, length = int(start_pos), int(length)
    ldf = df.iloc[start_pos:start_pos + length]
    print(ldf.index[0], ' - ', ldf.index[-1])
    mpf.plot(ldf, style='yahoo', figsize=(20,5), returnfig=True)
    #print([ str(ax) for ax in axlist])

Expected behavior
When using ipywidgets and updateing the slider, the reloading of the plot_func produces an additional figure each time you update the widget. This shouldn't be. When your don't use returnfig (or don't add ax and volume by your own figure) this behaviour does not accure.

jupyter lab
mplfinance 0.12.10b0

Screenshots
image

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Reproduce the issue in JupyterLab using the shown plot_func with ipywidgets, mplfinance, and returnfig=True. Start by observing figure creation as the sliders update, then trace the plotting entry point and figure handling. Done means repeated widget updates leave only the current plot instead of adding figures.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
jupyter, matplotlib, python
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。