- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 Plot Cluster using Clustermaps class in Matplotlib
Let us suppose you have given a dataset with various variables and data points thus in order to plot the cluster map for the given data points we can use Clustermaps class.
In this example, we will import the wine quality dataset from the https://archive.ics.uci.edu/ml/datasets/wine+quality.
import matplotlib.pyplot as plt import numpy as np import seaborn as sns sns.set(style='white') #Import the dataset wine_quality = pd.read_csv(‘winequality-red.csv’ delimeter=‘;’)
Let us suppose we have raw data of wine Quality datasets and associated correlation matrix data.
Now let us plot the clustermap of the data,
row_colors = wine_quality["quality"].map(dict(zip(wine_quality["quality"].unique(),"rbg"))) g = sns.clustermap(wine_quality.drop('quality',axis=1),standard_scale=1, robust=True,row_colors=row_colors, cmap='viridis')
Plot the clustermap of the following datasets,
g = sns.clustermap(corr, figsize=(10,8), z_score=1, cbar_kws={"label":"color bar"})
Output
- Related Articles
- How to plot MFCC in Python using Matplotlib?
- How to plot vectors in Python using Matplotlib?
- How to plot collections.Counter histogram using Matplotlib?
- How to plot an array in Python using Matplotlib?
- How to plot events on time using Matplotlib?
- How to plot 3D graphs using Python Matplotlib?
- How to plot a wav file using Matplotlib?
- How to plot 2d FEM results using matplotlib?
- How to get a Gantt plot using matplotlib?
- How to plot a kernel density plot of dates in Pandas using Matplotlib?
- How to plot Exponentially Decaying Function using FuncAnimation in Matplotlib
- How to plot longitudinal magnitude spectrum in Matplotlib using Python?
- How to plot an angle spectrum using Matplotlib in Python?
- How to plot multiple Seaborn Jointplot in Subplot using Matplotlib?
- How to plot histograms from dataframes in Pandas using Matplotlib?

Advertisements