0

This is my code. I'd like to click the button plot the graph and then remove the graph plotted before plotting a new graph on clicking the button.

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)

1 Answer 1

1

use clear_output() before your plot statement

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I actually figured it out just forgot to update the question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.