Seaborn - Strip,Swarm & Violin Plots


This post and the next one deal with a series of plots used to perform Categorical Analysis using seaborn library.

Lets use  an actual data set - Number of immigrants from various countries to Canada from  1980 to 2013.


We have processed the actual data set to cater our needs. The actual data set can be downloaded from:

https://ibm.box.com/shared/static/lw190pt9zpy5bd1ptyg2aw15awomz9pu.xlsx


Lets create another data frame containing just the information related to  Europe, Asia and Oceania.




Strip Plot

 
Description:

stripplot can be plotted using catplot() as well with the parameter kind = strip which is the default. If the markers are too cluttered, it can be adjusted to get more meaningful insight by adjusting the 'jitter' parameter.

This plot is using 2 features as 'x' and 'y'. Suppose we want to use another feature say, region as well in the plot, we can introduce it using 'hue' parameter.



The same strip plot is now showing a fine grained information, region wise info of a continent. There are other parameters that could be used in stripplot(). Check the documentation for more info.

Swarm Plot

Description:

As the name suggests, the plot looks like a Swarm of Bees, hence the name. Even this can be plotted using catplot() with kind as 'swarm'.  We can add a hue element as well to introduce another feature in the analysis using 'hue' parameter. 
This method ships with a variety of parameters such as changing the orientation from vertical to horizontal.


Violin Plot

This is an advanced plotting mechanism used by data scientists. It looks more like a box plot with a distribution over its sides.



Comments