- series.plot() |
Series
|
- dataframe.plot(x='None',y='None') |
DataFrame
|
- data.plot.<kind>() |
Another method
|
'bar' or 'barh', 'hist', 'box', 'kde' or 'density' , 'hexbin', 'pie' and 'scatter' |
Kinds
|
- data.plot.bar() /.barh() |
Bar plot/ Horizontal plot
|
- data.plot.bar(stacked=True) |
Stacked bar plot
|
- data.plot.area() |
Area plot
|
- data.plot.area(stacked=False) |
Non-Stacked area plot
|
- series.plot.pie() |
Pie plot for Series
|
- DataFrame.plot.pie(subplots=True) |
Pie plot for DataFrame
|
- series.plot.pie(labels= ['A','B','C'], colors= ['r','b','g'], autopct= '%.2f') |
Wedge labels
|
-DataFrame.plot.scatter(x=' ', y=' ') |
Scatter plot
|
-ax= df.plot.scatter(x='A',y='B', color='None', label='Group1') |
|
-df.plot.scatter(x='C',y='D', color='Other', label='Group2', ax= ax) |
Multiple plot
|
- data.plot.hist() |
Histogram plot
|
- data.plot.hist(stacked=True, bins=10) |
Stacked and bins size
|
- data.plot.hist(orientation='horizontal', cumulative=True) |
Horizontal and cumulative
|
data.diff().hist(color='g', alpha=0.5) |
Subplots histograms
|
- data.plot.box() |
Box plot
|
- dict={'boxes':' ','whiskers':' ', 'medians':' ', 'caps': ' '} |
Color of Boxes
|
- data.plot.box(color=dict) |
|
- data.plot.box(vert=False) |
Horizontal box plot
|
- df.boxplot(by='column') |
|
- df.boxplot(column=[' ',' '], by=[' ',' '])) |
Groupings
|
- df.groupby('g').boxplot() |
for random choice
|
- g=np.random_choice(['A','B'],size=50])
- DataFrame.plot.hexbin(x='None', y='None') |
Hexagonal bin plot
|
- DataFrame.plot.hexbin(x='None', y='None', C= 'z', reduce_C_function=np.max) |
add column 'z' for the value
|
- DataFrame.plot.hexbin(x='None', y='None', gridsize= 20) |
Gridsize
|
- data.plot.kde() |
Density plot
|
> data= pd.read_csv('Name or direction of data')- pdt.andrews_curves(data, 'column name with class names')- pdt.parallel_coordinates(data, 'column name with class names')- pdt.radviz(data, 'column name with class name')> import pandas.plotting as pdt- pdt.scatter_matrix('frame', 'alpha= 0.5', 'figsize=(6,6)')- pdt.lag_plot(series)- pdt.autocorrelation_plot(series)- pdt.bootstrap_plot(series, size= 50, samples= 500, color='green')- series.plot(style='k--')- DataFrame.plot(legend= False)- DataFrame.plot(colormap=' ')- data.plot(logy= True) or logx or loglog- DataFrame.column1.plot()- DataFrame.column2.plot(secondary_y=True)- data.plot(x_compat= True)
- data.plot(subplots=True) |
Subplots
|
- data.plot(subplots= True, layout= (2,3) |
Multiple axes
|
DataFrame.plot.bar(yerr=df_err, xerr= df1_err, capsize=3) |
- ax.get_xaxis().set_visible(False)- DataFrame.plot(table= True, ax=ax)- fig, ax= plt.subplots(1,1)- pdt.table(ax, DataFrame, loc='upper right', colWidths=[0.2, 0.2, 0.2])- DataFrame.plot(ax= ax)
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.