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()
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'])
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')
In [8]:
cf.datagen.lines(2).iplot(kind='spread',xTitle='Dates',yTitle='Return',title='Cufflinks - Spread 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')
In [11]:
cf.datagen.box(6).iplot(kind='box',xTitle='Stocks',yTitle='Returns Distribution',title='Cufflinks - Box Plot')
In [12]:
cf.datagen.histogram(2).iplot(kind='histogram',opacity=.75,title='Cufflinks - Histogram')
In [13]:
cf.datagen.heatmap(20,20).iplot(kind='heatmap',colorscale='spectral',title='Cufflinks - Heatmap')
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')
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)
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)
In [18]:
cf.datagen.sinwave(10,.25).iplot(kind='surface',theme='solar',colorscale='brbg',title='Cufflinks - Surface Plot',
margin=(0,0,0,0))