KEMBAR78
Python for data science! #Datascience #Python | PDF
www.1stepgrow.com
SEABORN
PYTHON FOR
PYTHON FOR
DATA SCIENCE
DATA SCIENCE
CHEAT SHEET PART- 3
www.1stepgrow.com
Axis Grids
>>> g = sns.FacetGrid(titanic,
col="survived", row="sex")
>>> sns.factorplot(x="pclass",
y="survived", hue="sex",
data=titanic)
>>> sns.lmplot(x="sepal_width",
y="sepal_length", hue="species",
data=iris)
>>> g = g.map(plt.hist,"age")
Subplot grid for plotting conditional
relationships
Draw a categorical plot onto a
Facetgrid
Plot data and regression model fits
across a FacetGrid
Plotting With Seaborn
www.1stepgrow.com
Scatterplot
Bar Chart
Count Plot
>>> sns.stripplot(x="species",
y="petal_length",data=iris)
>>> sns.barplot(x="sex",
y="survived", hue="class",
data=titanic)
>>> sns.countplot(x="deck",
data=titanic, palette="Greens_d")
>>> sns.swarmplot(x="species",
y="petal_length", data=iris)
Scatterplot with one categorical
variable
Show point estimates and
confidence intervals with
scatterplot glyphs
Show count of observations
Categorical scatterplot with
non-overlapping points
Categorical Plots
www.1stepgrow.com
Point Plot
Violinplot
Boxplot
>>> sns.pointplot(x="class",
y="survived", hue="sex",
data=titanic, palette={"male":"g",
"female":"m"}, markers=["^","o"],
linestyles=["-","--"])
>>> sns.violinplot(x="age",
y="sex", hue="survived",
data=titanic)
>>> h = sns.PairGrid(iris)
>>> h = h.map(plt.scatter)
>>> sns.boxplot(x="alive",
y="age", hue="adult_male",
data=titanic)
>>> sns.boxplot
(data=iris,orient="h")
Show point estimates and
confidence intervals as
rectangular bars
Violin plot
Subplot grid for plotting pairwise
relationships
Boxplot
Boxplot with wide-form data
www.1stepgrow.com
>>> i = i.plot(sns.regplot,
sns.distplot)
>>> sns.jointplot("sepal_length",
"sepal_width", data=iris,
kind='kde')
Plot bivariate distribution
>>> sns.pairplot(iris)
>>> i = sns.JointGrid(x="x",
y="y", data=data)
Plot pairwise bivariate
distributions
Grid for bivariate plot with
marginal univariate plots
www.1stepgrow.com
Build your career story with
1stepGrow Academy
Follow 1stepGrow Academy
Save the Post
Share your Comments

Python for data science! #Datascience #Python

  • 1.
    www.1stepgrow.com SEABORN PYTHON FOR PYTHON FOR DATASCIENCE DATA SCIENCE CHEAT SHEET PART- 3
  • 2.
    www.1stepgrow.com Axis Grids >>> g= sns.FacetGrid(titanic, col="survived", row="sex") >>> sns.factorplot(x="pclass", y="survived", hue="sex", data=titanic) >>> sns.lmplot(x="sepal_width", y="sepal_length", hue="species", data=iris) >>> g = g.map(plt.hist,"age") Subplot grid for plotting conditional relationships Draw a categorical plot onto a Facetgrid Plot data and regression model fits across a FacetGrid Plotting With Seaborn
  • 3.
    www.1stepgrow.com Scatterplot Bar Chart Count Plot >>>sns.stripplot(x="species", y="petal_length",data=iris) >>> sns.barplot(x="sex", y="survived", hue="class", data=titanic) >>> sns.countplot(x="deck", data=titanic, palette="Greens_d") >>> sns.swarmplot(x="species", y="petal_length", data=iris) Scatterplot with one categorical variable Show point estimates and confidence intervals with scatterplot glyphs Show count of observations Categorical scatterplot with non-overlapping points Categorical Plots
  • 4.
    www.1stepgrow.com Point Plot Violinplot Boxplot >>> sns.pointplot(x="class", y="survived",hue="sex", data=titanic, palette={"male":"g", "female":"m"}, markers=["^","o"], linestyles=["-","--"]) >>> sns.violinplot(x="age", y="sex", hue="survived", data=titanic) >>> h = sns.PairGrid(iris) >>> h = h.map(plt.scatter) >>> sns.boxplot(x="alive", y="age", hue="adult_male", data=titanic) >>> sns.boxplot (data=iris,orient="h") Show point estimates and confidence intervals as rectangular bars Violin plot Subplot grid for plotting pairwise relationships Boxplot Boxplot with wide-form data
  • 5.
    www.1stepgrow.com >>> i =i.plot(sns.regplot, sns.distplot) >>> sns.jointplot("sepal_length", "sepal_width", data=iris, kind='kde') Plot bivariate distribution >>> sns.pairplot(iris) >>> i = sns.JointGrid(x="x", y="y", data=data) Plot pairwise bivariate distributions Grid for bivariate plot with marginal univariate plots
  • 6.
    www.1stepgrow.com Build your careerstory with 1stepGrow Academy Follow 1stepGrow Academy Save the Post Share your Comments