/ Python And R Data science skills: 96 plotly and CUFFLINKS iplot 02

Sunday 18 February 2018

96 plotly and CUFFLINKS iplot 02

96 plotly AND CUFFLINKS iplot 02
In [1]:
import pandas as pd
import numpy as np
%matplotlib inline

from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import cufflinks as cf
init_notebook_mode(connected=True)
cf.go_offline()
IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`.
In [2]:
df1 = pd.DataFrame(np.random.randn(100,4),columns='A B C D'.split())
df2 = pd.DataFrame({'Category':['A','B','C'],'Values':[32,43,50]})
In [4]:
df1.iplot()
  • scatter
  • bar
  • box
  • spread
  • ratio
  • heatmap
  • surface
  • histogram
  • bubble
In [23]:
df1.iplot(kind='scatter',x='A',y='B')
In [24]:
df1.iplot(kind='scatter',x='A',y='B',mode='markers')
In [10]:
df1.iplot(kind='scatter',x='A',y='B',mode='markers',size=10)
In [25]:
df2.iplot(kind='bar',x='Category',y='Values')
In [26]:
df1.iplot(kind='bar')
In [27]:
df1.count().iplot(kind='bar')
In [28]:
df1.sum().iplot(kind='bar')
In [29]:
df1.iplot(kind='box')
In [30]:
df3 = pd.DataFrame({'x':[1,2,3,4,5],'y':[10,20,30,20,10],'z':[5,4,3,2,1]})
df3.iplot(kind='surface')
In [18]:
df3.iplot(kind='surface',colorscale='rdylbu')
In [31]:
df3 = pd.DataFrame({'x':[1,2,3,4,5],'y':[10,20,30,20,10],'z':[500,400,300,200,100]})
df3.iplot(kind='surface')
In [32]:
df1['A'].iplot(kind='hist',bins=25)
In [33]:
df1['A'].iplot(kind='hist',bins=40)

No comments:

Post a Comment