- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 to create waffle charts in Python Matplotlib?
A Waffle Chart is a gripping visualization technique that is normally created to display progress towards goals. While creating a new figure or activating an existing figure, we can use FigureClass=Waffle.
Steps
Create Panda's data frame using a dictionary.
Create a new figure or activate an existing figure using FigureClass=Waffle, number of rows=5, values=df.price and labels=df.books.
To display the figure, use show() method.
Example
import pandas as pd import matplotlib.pyplot as plt from pywaffle import Waffle plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True data = {'books': ['physics', 'chemistry', 'math', 'english', 'hindi'], 'price': [80, 87, 89, 56, 39] } df = pd.DataFrame(data) fig = plt.figure( FigureClass=Waffle, rows=5, values=df.price, labels=list(df.books) ) plt.show()
Output
- Related Articles
- How to display pie charts in Matplotlib Python?
- How to create charts in excel using Python with openpyxl?
- How to add group labels for bar charts in Matplotlib?
- How to Add Legends to charts in Python?
- How can bubble charts be created using Matplotlib?
- Plotting Pandas DataFrames in Pie Charts using Matplotlib
- Plot two horizontal bar charts sharing the same Y-axis in Python Matplotlib
- How to create two line charts in the same plot in R?
- SPC Charts: Overview, When to Use Them, and How to Create Them
- How can matplotlib be used to create histograms using Python?
- How can matplotlib be used to create a sine function in Python?
- How can Matplotlib be used to create multiple plots iteratively in Python?
- Explain how Matplotlib can be used to create a wireframe plot in Python?
- How to create a draggable legend in Matplotlib?
- How to create a heat map in Python that ranges from green to red? (Matplotlib)

Advertisements