Overview of Plotly

# Essential imports for constructing data and plotting
import numpy as np 
import pandas as pd 
import matplotlib.pyplot as plt 
import plotly.offline as py
import plotly.graph_objs as go 
import plotly.figure_factory as ff 

Plot with Matplotlib

# Create fake dataset to plot 
df = pd.DataFrame(np.random.rand(100, 4), columns=['A', 'B', 'C', 'D'])
df.plot()
plt.legend(loc='upper right')
plt.show()
../_images/P00-Plotly Basic Overview_3_0.png

Plot with Plotly

# Create a fake dataset to show in plot 
df = pd.DataFrame(np.random.rand(100, 4), columns=['A', 'B', 'C', 'D'])
data = ([
    {'x': df.index, 'y': df[col], 'name': col} for col in df.columns
])

# Create figure 
fig = go.Figure(data=data)
# Show figure 
py.iplot(fig)