banner



How To Draw A Modified Box Plot

Box Plot is the visual representation of the depicting groups of numerical data through their quartiles. Boxplot is also used for detect the outlier in information set. It captures the summary of the data efficiently with a simple box and whiskers and allows the states to compare easily beyond groups. Boxplot summarizes a sample data using 25th, 50th and 75th percentiles. These percentiles are also known every bit the lower quartile, median and upper quartile.

A box plot consist of five things.

  • Minimum
  • First Quartile or 25%
  • Median (Second Quartile) or fifty%
  • Third Quartile or 75%
  • Maximum

To download the dataset used, click here.

Depict the box plot with Pandas:

1 way to plot boxplot using pandas dataframe is to use boxplot() office that is office of pandas library.

import numpy as np

import pandas as pd

import matplotlib.pyplot as plt

% matplotlib inline

df = pd.read_csv( "tips.csv" )

df.caput()

Boxplot of days with respect total_bill.

df.boxplot(by = 'twenty-four hour period' , cavalcade = [ 'total_bill' ], grid = False )

 Boxplot of size with respect tip.

df.boxplot(by = 'size' , column = [ 'tip' ], grid = False )

Describe the boxplot using seaborn library:

Syntax :
seaborn.boxplot(x=None, y=None, hue=None, data=None, gild=None, hue_order=None, orient=None, color=None, palette=None, saturation=0.75, width=0.viii, dodge=True, fliersize=five, linewidth=None, whis=1.5, notch=False, ax=None, **kwargs)

Parameters:
x = feature of dataset
y = characteristic of dataset
hue = feature of dataset
data = dataframe or full dataset
color = color name

Permit's see how to create the box plot through seaborn library.

Information virtually "tips" dataset.

tips = sns.load_dataset( 'tips' )

tips.head()

Boxplot of days with respect total_bill.

sns.set_style( "whitegrid" )

sns.boxplot(x = 'day' , y = 'total_bill' , data = tips)

Allow's take the first box plot i.e, blue box plot of the effigy and understand these statistical things:

  • Bottom blackness horizontal line of bluish box plot is minimum value
  • First black horizontal line of rectangle shape of blueish box plot is First quartile or 25%
  • Second black horizontal line of rectangle shape of blue box plot is Second quartile or l% or median.
  • 3rd black horizontal line of rectangle shape of blue box plot is third quartile or 75%
  • Top blackness horizontal line of rectangle shape of blue box plot is maximum value.
  • Small-scale diamond shape of blueish box plot is outlier information or erroneous data.

Source: https://www.geeksforgeeks.org/box-plot-visualization-with-pandas-and-seaborn/

Posted by: fungunpleted.blogspot.com

0 Response to "How To Draw A Modified Box Plot"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel