- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can box and whisker plot be used to compare the data in different categories in Python Seaborn?
Seaborn library helps in visualizing data. It comes with customized themes and a high level interface.
Scatter plots provide limited information, since they only tell us about the distribution of values within a given category of data. We need to use a different technique if we wish to compare the data present within categories. This is where box plots come into play. It is a way in which the data distribution in the dataset can be understood with the help of quartiles.
It consists of vertical lines that extend from the boxes. These extensions are known as whiskers. These whiskers talks about how the data varies outside the upper and lower quartiles. This is why box plots are also known as whisker plots.
Syntax of boxplot function
Outliers in the data are plotted as individual points. Here’s the example −
import pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset('iris') sb.boxplot(x = "species", y = "petal_length", data = my_df) plt.show()
- The required packages are imported.
- The input data is ‘iris_data’ which is loaded from the scikit learn library.
- This data is stored in a dataframe.
- The ‘load_dataset’ function is used to load the iris data.
- This data is visualized using the ‘boxplot’ function.
- Here, the dataframe is supplied as parameter.
- Also, the x and y values are specified.
- This data is displayed on the console.
- How can bar plot be used in Seaborn library in Python?
- How can factorplot be used in Seaborn to visualize data in Python?
- How can the countplot be used to visualize data in Python Seaborn Library?
- How can box plot be overlaid on top of swarm plot in Seaborn?
- How can Seaborn library be used to display a Scatter Plot in Python?
- How can Seaborn library be used to display a hexbin plot in Python?
- How can FacetGrid be used to visualize data in Python Seaborn Library?
- How can seaborn library be used to display data without the background axis spines in Python?
- How can Pygal be used to generate box plots in Python?
- How can Seaborn library be used to visualize point plots in Python?
- How can Bokeh be used to visualize different shapes of data points in Python?
- How can Tensorflow be used to plot the results using Python?
- How can Keras be used to plot the model using Python?
- How can matplotlib be used to plot 3 different datasets on a single graph in Python?
- How can Bokeh be used to generate patch plot in Python?