#### World's Best AI Learning Platform with profoundly Demanding Certification Programs

Designed by IITian's, only for AI Learners.

Download our e-book of Introduction To Python

How to leave/exit/deactivate a Python virtualenvironment Exception Type: JSONDecodeError at /update/ Exception Value: Expecting value: line 1 column 1 (char 0) Which are different modes to open a file ? What is a random forest model and how do you build a random forest model? How to plot Bubble plot with Encircling? How to integrate Sales force and Django? What is list and explain list methods? Find the Largest and smallest items in a collection. Join Discussion

4 (4,001 Ratings)

218 Learners

Dec 9th (6:00 PM) 223 Registered

Sahil Parrvez

6 months ago

Violin plots | Insideaiml

Violin plots are similar to box plots, but they also show at different values ,the probability density of data.A marker for the median of the data and a box indicating the interquartile range are included in these plots, as in the standard box plots. Overlaid on this box plot is a kernel density estimation. It used to represent comparison of a variable distribution (or sample distribution) across different "categories".

A violin plot is more informative than a plain box plot. In fact while a box plot only shows summary statistics such as mean/median and interquartile ranges, the violin plot shows the full distribution of the data.

```
import matplotlib.pyplot as plt
np.random.seed(10)
collectn_1 = np.random.normal(100, 10, 200)
collectn_2 = np.random.normal(80, 30, 200)
collectn_3 = np.random.normal(90, 20, 200)
collectn_4 = np.random.normal(70, 25, 200)
## combine these different collections into a list
data_to_plot = [collectn_1, collectn_2, collectn_3, collectn_4]
# Create a figure instance
fig = plt.figure()
# Create an axes instance
ax = fig.add_axes([0,0,1,1])
# Create the boxplot
bp = ax.violinplot(data_to_plot)
plt.show()
```