Categorical Distribution Plots

In this tutorial we are going to discuss about Categorical Distribution Plots. Topics of last tutorial:

  • Categorical plotting
  • stripplot 
  • swarmplot

In this tutorial we would learn all three types of categorical distribution plots.

boxplot ( ):

A boxplot is something that would give an overview of the complete data.This is all about a box plot, where the rectangle is the part of much data concentrated. 

Syntax: sns.boxplot( x = ‘value’ , data= dataset_name )

Another syntax: sns.catplot (  x = ‘value’ , data= dataset_name , kind = ‘box’ )

Here in syntax we also can include y parameter.

What if y parameter is assigned as a categorical value from the dataset

Let us play around few parameters, as most of the parameters were discussed in other parameter tables.

hue parameter :

Here there is another interesting parameter known as saturation which changes the color saturation in the boxplot, default the saturation is set to 0.75.

Here we also can change the size of the outlier points by passing a parameter ‘fliersize’ , default the size is set to 5. 

violinplot ( ):

One of the best plot to visualize data , and said to be most nicely looking plot.

Syntax: sns.violinplot( x = ‘value’ , data= dataset_name )

Another syntax: sns.catplot (  x = ‘value’ , data= dataset_name , kind = ‘violin’ )

Let us create a basic violin plot:

Few important parameters:

Inner:

How the inner points of the violin plot should be represented. It takes string as input.

box = then draws a miniature boxplot

quartiles = then draws lines that divide the plot into four quarters

point or stick = then shows each datapoint

None = draw unadorned violin

split( ):

When we are using hue parameter, then multiple violinplots get created for different categorical values , at that time split parameter merges them into one. Let us see that in jupyter notebook.

boxenplot ( ):

This plot actually looks combinational plot of boxplot and violinplot, this was actually named as letter value plot. 

This is the end of this tutorial about Categorical Distribution Plots. In the next tutorial we would be knowing about categorical estimate plots.

Spread knowledge

Leave a Comment

Your email address will not be published. Required fields are marked *