Skip to content

Instantly share code, notes, and snippets.

@bkaankuguoglu
Created January 15, 2022 15:35
Show Gist options
  • Save bkaankuguoglu/c7eb2ed43d261ab39316412a0085fbb8 to your computer and use it in GitHub Desktop.
Save bkaankuguoglu/c7eb2ed43d261ab39316412a0085fbb8 to your computer and use it in GitHub Desktop.
def plot_dataset_with_forecast(df, df_forecast, title):
data = []
value = go.Scatter(
x=df.index,
y=df.value,
mode="lines",
name="values",
marker=dict(),
text=df.index,
line=dict(color="rgba(0,0,0, 0.3)"),
)
data.append(value)
forecast = go.Scatter(
x=df_forecast.index,
y=df_forecast.prediction,
mode="lines",
name="forecasted values",
marker=dict(),
text=df.index,
line=dict(color="rgba(10,100,10, 0.3)"),
)
data.append(forecast)
layout = dict(
title=title,
xaxis=dict(title="Date", ticklen=5, zeroline=False),
yaxis=dict(title="Value", ticklen=5, zeroline=False),
)
fig = dict(data=data, layout=layout)
iplot(fig)
plot_dataset_with_forecast(df, df_forecast, title='PJM East (PJME) Region: forecasted estimated energy consumption in Megawatts (MW)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment