Change language

Violin area for data analysis

Violin plots contain more information than boxed plots, they are less popular. Due to their unpopularity, their mean ing may be more difficult to understand for many readers unfamiliar with the plot of the violin game.

To get a link to Iris Data, click here .

Attribute Dataset Information:

 Attribute Information: -" sepal length in cm -" sepal width in cm -" petal length in cm -" petal width in cm -" class: Iris Setosa Iris Versicolour Iris Virginica Number of Instances: 150 Summary Statistics: Min Max Mean SD Class Correlation sepal length: 4.3 7.9 5.84 0.83 0.7826 sepal width: 2.0 4.4 3.05 0.43 -0.4194 petal length: 1.0 6.9 3.76 1.76 0.9490 (high! ) petal width: 0.1 2.5 1.20 0.76 0.9565 (high!) Class Distribution: 33.3% for each of 3 classes. 

Loading Libraries

import numpy as np

import pandas as pd

import seaborn as sns

from matplotlib import pyplot

import seaborn

Loading data

data = pd.read_csv ( " Iris.csv " )

  

print (data.head ( 10 ))

Exit:

Description

data.describe ()

Exit :

Information

data.info ()

Exit :

Description of the SepalLengthCm parameter in the Iris dataset.

data [ "SepalLengthCm" ]. describe ()

Output:

 count 150.000000  mean  5.843333 std 0.828066 min 4.300000 25% 5.100000 50% 5.800000 75% 6.400000 max 7.900000 Name: SepalLengthCm, dtype: float64 

Code # 1: Violin section for the "SepalLengthCm" parameter.

fig, ax = pyplot.subplots (figsize = ( 9 , 7 ) )

sns.violinplot (ax = ax, y = data [ "SepalLengthCm" ])

Output:

As you can see we have a higher density between 5 and 6. This is very important because, as in the SepalLengthCm description, the average is 5.43.

Code # 2: Violin section for SepalLengthWidth.

 

fig, ax = pyplot.subplots (figsize = ( 9 , 7 ))

sns.violinplot (ax = ax, y = data [ "SepalWidthCm" ])

Exit:

Here also, Higher density on average = 3.05

Code # 3: Violin comparing "SepalLengthCm" and "SepalWidthC m ".

fig, ax = pyplot .subplots (figsize = ( 9 , 7 ))

sns.violinplot (ax = ax, data = data.iloc [:, 1 : 3 ])

Exit:

Code # 4: Violin area where the SepalLengthCm views are compared.

fig, ax = pyplot.subplots (figsize = ( 9 , 7 ))

sns.violinplot (ax = ax, x = data [ "Species" ], 

y = data [ "SepalLengthCm" ])

Exit:

Shop

Gifts for programmers

Learn programming in R: courses

$FREE
Gifts for programmers

Best Python online courses for 2022

$FREE
Gifts for programmers

Best laptop for Fortnite

$399+
Gifts for programmers

Best laptop for Excel

$
Gifts for programmers

Best laptop for Solidworks

$399+
Gifts for programmers

Best laptop for Roblox

$399+
Gifts for programmers

Best computer for crypto mining

$499+
Gifts for programmers

Best laptop for Sims 4

$

Latest questions

PythonStackOverflow

Common xlabel/ylabel for matplotlib subplots

1947 answers

PythonStackOverflow

Check if one list is a subset of another in Python

1173 answers

PythonStackOverflow

How to specify multiple return types using type-hints

1002 answers

PythonStackOverflow

Printing words vertically in Python

909 answers

PythonStackOverflow

Python Extract words from a given string

798 answers

PythonStackOverflow

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

606 answers

PythonStackOverflow

Python os.path.join () method

384 answers

PythonStackOverflow

Flake8: Ignore specific warning for entire file

360 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

How to specify multiple return types using type-hints

Printing words vertically in Python

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically