Skip to content

Instantly share code, notes, and snippets.

@bkaankuguoglu
Last active March 15, 2021 21:25
Show Gist options
  • Save bkaankuguoglu/102399b5d564f5678554ca0e59cf0032 to your computer and use it in GitHub Desktop.
Save bkaankuguoglu/102399b5d564f5678554ca0e59cf0032 to your computer and use it in GitHub Desktop.
a function that plots plotly graphs
import plotly.graph_objs as go
from plotly.offline import iplot
def plot_dataset(df, 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)
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment