Aggialavura Python-Seaborn
Aggialavura Python-Seaborn
import seaborn as sns sns.swarmplot(x,y,df) swarm plot sns.heatmap(df.corr())* heat map plot
# If working on a notebook - hue='categ var' divide per var - annot = True add actual values
%matplotlib inline
- palette='' set palette - cmap='' set a color palette
sns.barplot(x,y,df) bar plot It has a similar role of a box and whisker g = sns.PairGrid(df) set (empty)
plots. It shows the distribution of quanti‐ axis of pairplot
- estimator=''* bar values
tative data across several levels of one -g.map(plt.scatter) populate axis
sns.countplot(x,df) bars = count
(or more) categorical variables. The with some plot
sns.boxplot(x,y,,df) box plot violin plot features a kernel density
-g.map_diag(plt.hist) set diag plots
- hue='categ var' divide per var estimation of the underlying distribution.
-g.map_upper(plt.scatter) set upper
- palette='' set palette What is a strip plot? plots
- orient='h' horiz. plot It will draw a scatterplot where one -g.map_lower(sns.kdeplot) set lower plots
sns.violinplot(x,y,df) violin plot* variable is categorical. It is also a good
g = sns.FacetGrid(df,c,r) empty axis
complement to a box or violin plot in
- hue='categ var' divide per var -g = g.map(plt .hist, "c") populate axis
cases where you want to show all
- palette='' set palette histograms
observations along with some represent‐
sns.stripplot(x,y,df) bars = scatter ation of the underlying distribution. -..g.map(sns.distplot, "c") populate axis
- jitter = True add noise with distplots
What is a swarm plot
- hue='categ var' divide per var now some more complex stuff
It is similar to a stripplot(), but the points
- palette='' set palette are adjusted (only along the categorical
- split = True split by hue axis) so that they don’t overlap. This
gives a better representation of the distri‐
bution of values, although it does not
scale as well to large numbers of
observations.
cheatography.com/aggialavura/
www.dariopittera.com
Python - Seaborn Cheat Sheet
by DarioPittera (aggialavura) via cheatography.com/83764/cs/19851/
cheatography.com/aggialavura/
www.dariopittera.com