Adding titles and labels: Part 2

Introduction to Data Visualization with Seaborn

Erin Case

Data Scientist

Adding a title to AxesSubplot

FacetGrid
g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box") 

g.fig.suptitle("New Title", y=1.03)
AxesSubplot
g = sns.boxplot(x="Region", 
                y="Birthrate", 
                data=gdp_data)

g.set_title("New Title", y=1.03)
Introduction to Data Visualization with Seaborn

Titles for subplots

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box",
                col="Group") 

Birth rate box plots with subgroups

Introduction to Data Visualization with Seaborn

Titles for subplots

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box",
                col="Group") 

g.fig.suptitle("New Title", y=1.03)

Birth rate box plots with subgroups and figure title

Introduction to Data Visualization with Seaborn

Titles for subplots

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box",
                col="Group") 

g.fig.suptitle("New Title", 
               y=1.03)

g.set_titles("This is {col_name}")

Birth rate box plots with subgroups and subplot titles

Introduction to Data Visualization with Seaborn

Adding axis labels

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box")
`

g.set(xlabel="New X Label", ylabel="New Y Label")
plt.show()

Birth rate box plot with axis labels

Introduction to Data Visualization with Seaborn

Rotating x-axis tick labels

g = sns.catplot(x="Region", 
                y="Birthrate", 
                data=gdp_data, 
                kind="box")

plt.xticks(rotation=90)
plt.show()

Birth rate box plot with rotated x tick labels

Introduction to Data Visualization with Seaborn

Let's practice!

Introduction to Data Visualization with Seaborn

Preparing Video For Download...