Size and aspect
Non grid plot: The figure() is a matplotlib function used to plot the figures. The figsize is used to set the size of the figure.
Python3
import seaborn as sns import matplotlib.pyplot as plt tips = sns.load_dataset( 'tips' ) plt.figure(figsize = ( 12 , 3 )) sns.countplot(x = 'sex' , data = tips) |
Output:
Grid type plot: This example shows a regression plot of tips vs the total_bill from the dataset. lmplot stands for linear model plot and is used to create a regression plot. x =’total_bill’ sets the x axis to total_bill. y=’tip’ sets the y axis to tips. size=2 is used to the size(the height)of the plot. aspect is used to set the width keeping the width constant.
Python3
import seaborn as sns import matplotlib.pyplot as plt tips = sns.load_dataset( 'tips' ) sns.lmplot(x = 'total_bill' , y = 'tip' , size = 2 , aspect = 4 , data = tips) |
Output:
Seaborn | Style And Color
Seaborn is a statistical plotting library in python. It has beautiful default styles. This article deals with the ways of styling the different kinds of plots in seaborn.