'The graph is not showing up in my jupyter notebook in kaggle

I am not able to see my plot in my kaggle notebook. The following is my code.

import ipywidgets as widgets
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
import seaborn as sns
df = pd.read_csv('../input/sdd1247/COMED_hourly.csv', parse_dates=["Datetime"], index_col="Datetime")
def Visualization_plots(x):
    y = df.loc['2017']
    y['COMED_MW'].resample('H').mean().plot()


button = widgets.Button(
    description='Submit',
    disabled=False,
    button_style='success', # 'success', 'info', 'warning', 'danger' or ''
    tooltip='Click me',
    icon='alicorn' # (FontAwesome names without the `fa-` prefix)
)
button.on_click(Visualization_plots)
button

The button shows up.. but when I click on it, I expected the graph to show below it. But nothing shows up. I do however see the graph in the console. How can I show the graph in my notebook instead?

This is how it shows up in the console window: enter image description here



Solution 1:[1]

I would add plt.show() on the line after the plot instruction. If it doesn't work please provide a few lines of your dataset.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 rehaqds