

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Creating multiple boxplots on the same graph from a dictionary, using Matplotlib
To create multiple boxplots on the same graph from a dictionary, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- Make a dictionary, dict, with two columns.
- Create a figure and a set of subplots.
- Make a box and whisker plot
- Set the xtick labels using set_xticklabels() method
- To display the figure, use show() method.
Example
from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = {'col1': [3, 5, 2, 9, 1], 'col2': [2, 6, 1, 3, 4]} fig, ax = plt.subplots() ax.boxplot(data.values()) ax.set_xticklabels(data.keys()) plt.show()
Output
- Related Questions & Answers
- Plot multiple boxplots in one graph in Pandas or Matplotlib
- Drawing multiple legends on the same axes in Matplotlib
- Creating Dictionary using Javascript
- How to plot multiple histograms on same plot with Seaborn using Matplotlib?
- How to show a bar and line graph on the same plot in Matplotlib?
- Adding a legend to a Matplotlib boxplot with multiple plots on the same axis
- Generate a graph using Dictionary in Python
- How to plot multiple Pandas columns on the Y-axis of a line graph (Matplotlib)?
- Plot a bar using matplotlib using a dictionary
- Creating a Graph in Javascript
- Creating 3D animation using matplotlib
- How to plot two violin plot series on the same graph using Seaborn?
- Creating a graph with date and time in axis labels with Matplotlib
- Change values on matplotlib imshow() graph axis
- MongoDB multiple OR conditions on same key?
Advertisements