This library binds the power of plotly with the flexibility of pandas for easy plotting.

This library is available on https://github.com/santosjorge/cufflinks

This tutorial assumes that the plotly user credentials have already been configured as stated on the getting started guide.

In [1]:
import cufflinks as cf
In [2]:
%reload_ext autoreload
%autoreload 2
In [13]:
#We set the all charts as public
cf.set_config_file(world_readable=True,theme='pearl')

Line Chart

In [14]:
cf.datagen.lines().iplot(kind='scatter',xTitle='Dates',yTitle='Returns',title='Cufflinks - Line Chart')
Out[14]:
In [24]:
cf.datagen.lines(3).iplot(kind='scatter',xTitle='Dates',yTitle='Returns',title='Cufflinks - Filled Line Chart',
                         colorscale='-blues',fill=True)
Out[24]:
In [25]:
cf.datagen.lines(1).iplot(kind='scatter',xTitle='Dates',yTitle='Returns',title='Cufflinks - Besfit Line Chart',
                         filename='Cufflinks - Bestfit Line Chart',bestfit=True,colors=['blue'],
                         bestfit_colors=['pink'])
Out[25]:

Scatter Chart

In [26]:
cf.datagen.lines(2).iplot(kind='scatter',mode='markers',size=10,symbol='x',colorscale='paired',
                          xTitle='Dates',yTitle='EPS Growth',title='Cufflinks - Scatter Chart')
Out[26]:

Spread Chart

In [35]:
cf.datagen.lines(2).iplot(kind='spread',xTitle='Dates',yTitle='Return',title='Cufflinks - Spread Chart')
Out[35]:

Bar Chart

In [36]:
cf.datagen.lines(5).resample('M').iplot(kind='bar',xTitle='Dates',yTitle='Return',title='Cufflinks - Bar Chart')
Out[36]:
In [37]:
cf.datagen.lines(5).resample('M').iplot(kind='bar',xTitle='Dates',yTitle='Return',title='Cufflinks - Grouped Bar Chart',
                          barmode='stack')
Out[37]:

Box Plot

In [38]:
cf.datagen.box(6).iplot(kind='box',xTitle='Stocks',yTitle='Returns Distribution',title='Cufflinks - Box Plot')
Out[38]:

Historgram

In [40]:
cf.datagen.histogram(2).iplot(kind='histogram',opacity=.75,title='Cufflinks - Histogram')
Out[40]:

Heatmap Plot

In [41]:
cf.datagen.heatmap(20,20).iplot(kind='heatmap',colorscale='spectral',title='Cufflinks - Heatmap')
Out[41]:

Bubble Chart

In [42]:
cf.datagen.bubble(prefix='industry').iplot(kind='bubble',x='x',y='y',size='size',categories='categories',text='text',
                          xTitle='Returns',yTitle='Analyst Score',title='Cufflinks - Bubble Chart')
Out[42]:

Scatter 3D

In [49]:
cf.datagen.scatter3d(2,150).iplot(kind='scatter3d',x='x',y='y',z='z',size=15,categories='categories',text='text',
                             title='Cufflinks - Scatter 3D Chart',colors=['blue','pink'],width=0.5,margin=(0,0,0,0),
                             opacity=1)
Out[49]:

Bubble 3D

In [52]:
cf.datagen.bubble3d(5,4).iplot(kind='bubble3d',x='x',y='y',z='z',size='size',text='text',categories='categories',
                            title='Cufflinks - Bubble 3D Chart',colorscale='set1',
                            width=.5,opacity=.9)
Out[52]:

Surface

In [53]:
cf.datagen.sinwave(10,.25).iplot(kind='surface',theme='solar',colorscale='brbg',title='Cufflinks - Surface Plot',
                                 margin=(0,0,0,0))
Out[53]: