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]:
#We set the all charts as public
cf.set_config_file(sharing='public',theme='pearl',offline=False)
cf.go_offline()


Line Chart


In [3]:
cf.datagen.lines().iplot(kind='scatter',xTitle='Dates',yTitle='Returns',title='Cufflinks - Line Chart')



In [4]:
cf.datagen.lines(3).iplot(kind='scatter',xTitle='Dates',yTitle='Returns',title='Cufflinks - Filled Line Chart',
                         colorscale='-blues',fill=True)



In [6]:
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'])


/Users/jorgesantos/anaconda/envs/plotly3/lib/python3.6/site-packages/statsmodels/compat/pandas.py:56: FutureWarning:

The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.

Scatter Chart


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


Spread Chart


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


Bar Chart


In [9]:
cf.datagen.lines(5).resample('M').mean().iplot(kind='bar',xTitle='Dates',yTitle='Return',title='Cufflinks - Bar Chart')



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


Box Plot


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


Historgram


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


Heatmap Plot


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


Bubble Chart


In [14]:
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')


Scatter 3D


In [15]:
cf.datagen.scatter3d(2,150,mode='stocks').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)


Bubble 3D


In [16]:
cf.datagen.bubble3d(5,4,mode='stocks').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)


Surface


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


/Users/jorgesantos/Dropbox/Development/Git/repos/cufflinks/cufflinks/datagen.py:380: RuntimeWarning:

invalid value encountered in true_divide