【问题标题】:Clear plot on jupyter notebook with IPython widget before plotting a new graph在绘制新图之前使用 IPython 小部件在 jupyter notebook 上清除绘图
【发布时间】:2018-01-06 11:38:56
【问题描述】:

这是我的代码。我想点击按钮绘制图表,然后在点击按钮绘制新图表之前删除绘制的图表。

columns=[i for i in load_weekday['feed_point_number'].unique()]

selection=widgets.Dropdown(description='Select feed_point_number?')
selection.options=columns
display(selection)

def on_button_clicked(b):
    sns.set_style("whitegrid")
    sns.set_context(rc={"figure.figsize":(12,9)})
    load_weekday.plot(x='time_code',y=selection.value,color='Blue')
button=widgets.Button(description="Plot")
display(button)

button.on_click(on_button_clicked)

【问题讨论】:

    标签: python-3.x matplotlib widget ipython jupyter-notebook


    【解决方案1】:

    在你的情节语句之前使用 clear_output()

    【讨论】:

    • 谢谢。我实际上想通了只是忘了更新问题
    猜你喜欢
    • 1970-01-01
    • 2017-07-07
    • 2012-08-03
    • 2014-02-17
    • 2013-01-01
    • 2019-03-22
    • 2021-09-07
    • 2021-11-15
    • 1970-01-01
    相关资源
    最近更新 更多