Submit Search
Upload
Plotting heatmap with matplotlib/seaborn
•
Download as PPTX, PDF
•
0 likes
•
77 views
H
Hoffman Lab
Follow
Hoffman Lab Tech Talk
Read less
Read more
Technology
Report
Share
Report
Share
1 of 10
Download now
Recommended
GNU Parallel: Lab meeting—technical talk
GNU Parallel: Lab meeting—technical talk
Hoffman Lab
TCRpower
TCRpower
Hoffman Lab
Efficient querying of genomic reference databases with gget
Efficient querying of genomic reference databases with gget
Hoffman Lab
WashU Epigenome Browser
WashU Epigenome Browser
Hoffman Lab
Wireguard: A Virtual Private Network Tunnel
Wireguard: A Virtual Private Network Tunnel
Hoffman Lab
Go Get Data (GGD)
Go Get Data (GGD)
Hoffman Lab
fastp: the FASTQ pre-processor
fastp: the FASTQ pre-processor
Hoffman Lab
R markdown and Rmdformats
R markdown and Rmdformats
Hoffman Lab
Recommended
GNU Parallel: Lab meeting—technical talk
GNU Parallel: Lab meeting—technical talk
Hoffman Lab
TCRpower
TCRpower
Hoffman Lab
Efficient querying of genomic reference databases with gget
Efficient querying of genomic reference databases with gget
Hoffman Lab
WashU Epigenome Browser
WashU Epigenome Browser
Hoffman Lab
Wireguard: A Virtual Private Network Tunnel
Wireguard: A Virtual Private Network Tunnel
Hoffman Lab
Go Get Data (GGD)
Go Get Data (GGD)
Hoffman Lab
fastp: the FASTQ pre-processor
fastp: the FASTQ pre-processor
Hoffman Lab
R markdown and Rmdformats
R markdown and Rmdformats
Hoffman Lab
File searching tools
File searching tools
Hoffman Lab
Better BibTeX (BBT) for Zotero
Better BibTeX (BBT) for Zotero
Hoffman Lab
Awk primer and Bioawk
Awk primer and Bioawk
Hoffman Lab
Terminals and Shells
Terminals and Shells
Hoffman Lab
BioRender & Glossary/Acronym
BioRender & Glossary/Acronym
Hoffman Lab
Linters in R
Linters in R
Hoffman Lab
BioSyntax: syntax highlighting for computational biology
BioSyntax: syntax highlighting for computational biology
Hoffman Lab
Get Good With Git
Get Good With Git
Hoffman Lab
Tech Talk: UCSC Genome Browser
Tech Talk: UCSC Genome Browser
Hoffman Lab
MultiQC: summarize analysis results for multiple tools and samples in a singl...
MultiQC: summarize analysis results for multiple tools and samples in a singl...
Hoffman Lab
dreamRs: interactive ggplot2
dreamRs: interactive ggplot2
Hoffman Lab
Basic Cryptography & Security
Basic Cryptography & Security
Hoffman Lab
Intervene: a tool for intersection and visualization of multiple gene or geno...
Intervene: a tool for intersection and visualization of multiple gene or geno...
Hoffman Lab
Evaluating machine learning claims
Evaluating machine learning claims
Hoffman Lab
Introduction to proteomics
Introduction to proteomics
Hoffman Lab
Topics in TeX and LaTeX: Selected packages, programming, and Overleaf updates
Topics in TeX and LaTeX: Selected packages, programming, and Overleaf updates
Hoffman Lab
Conda and Bioconda
Conda and Bioconda
Hoffman Lab
Elixir and OTP
Elixir and OTP
Hoffman Lab
TPOT: The data science assistant
TPOT: The data science assistant
Hoffman Lab
Transferring data: best practices, Globus Online, and Compute Canada infrastr...
Transferring data: best practices, Globus Online, and Compute Canada infrastr...
Hoffman Lab
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
More Related Content
More from Hoffman Lab
File searching tools
File searching tools
Hoffman Lab
Better BibTeX (BBT) for Zotero
Better BibTeX (BBT) for Zotero
Hoffman Lab
Awk primer and Bioawk
Awk primer and Bioawk
Hoffman Lab
Terminals and Shells
Terminals and Shells
Hoffman Lab
BioRender & Glossary/Acronym
BioRender & Glossary/Acronym
Hoffman Lab
Linters in R
Linters in R
Hoffman Lab
BioSyntax: syntax highlighting for computational biology
BioSyntax: syntax highlighting for computational biology
Hoffman Lab
Get Good With Git
Get Good With Git
Hoffman Lab
Tech Talk: UCSC Genome Browser
Tech Talk: UCSC Genome Browser
Hoffman Lab
MultiQC: summarize analysis results for multiple tools and samples in a singl...
MultiQC: summarize analysis results for multiple tools and samples in a singl...
Hoffman Lab
dreamRs: interactive ggplot2
dreamRs: interactive ggplot2
Hoffman Lab
Basic Cryptography & Security
Basic Cryptography & Security
Hoffman Lab
Intervene: a tool for intersection and visualization of multiple gene or geno...
Intervene: a tool for intersection and visualization of multiple gene or geno...
Hoffman Lab
Evaluating machine learning claims
Evaluating machine learning claims
Hoffman Lab
Introduction to proteomics
Introduction to proteomics
Hoffman Lab
Topics in TeX and LaTeX: Selected packages, programming, and Overleaf updates
Topics in TeX and LaTeX: Selected packages, programming, and Overleaf updates
Hoffman Lab
Conda and Bioconda
Conda and Bioconda
Hoffman Lab
Elixir and OTP
Elixir and OTP
Hoffman Lab
TPOT: The data science assistant
TPOT: The data science assistant
Hoffman Lab
Transferring data: best practices, Globus Online, and Compute Canada infrastr...
Transferring data: best practices, Globus Online, and Compute Canada infrastr...
Hoffman Lab
More from Hoffman Lab
(20)
File searching tools
File searching tools
Better BibTeX (BBT) for Zotero
Better BibTeX (BBT) for Zotero
Awk primer and Bioawk
Awk primer and Bioawk
Terminals and Shells
Terminals and Shells
BioRender & Glossary/Acronym
BioRender & Glossary/Acronym
Linters in R
Linters in R
BioSyntax: syntax highlighting for computational biology
BioSyntax: syntax highlighting for computational biology
Get Good With Git
Get Good With Git
Tech Talk: UCSC Genome Browser
Tech Talk: UCSC Genome Browser
MultiQC: summarize analysis results for multiple tools and samples in a singl...
MultiQC: summarize analysis results for multiple tools and samples in a singl...
dreamRs: interactive ggplot2
dreamRs: interactive ggplot2
Basic Cryptography & Security
Basic Cryptography & Security
Intervene: a tool for intersection and visualization of multiple gene or geno...
Intervene: a tool for intersection and visualization of multiple gene or geno...
Evaluating machine learning claims
Evaluating machine learning claims
Introduction to proteomics
Introduction to proteomics
Topics in TeX and LaTeX: Selected packages, programming, and Overleaf updates
Topics in TeX and LaTeX: Selected packages, programming, and Overleaf updates
Conda and Bioconda
Conda and Bioconda
Elixir and OTP
Elixir and OTP
TPOT: The data science assistant
TPOT: The data science assistant
Transferring data: best practices, Globus Online, and Compute Canada infrastr...
Transferring data: best practices, Globus Online, and Compute Canada infrastr...
Recently uploaded
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Pooja Nehwal
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
The Digital Insurer
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
V3cube
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Paola De la Torre
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
Recently uploaded
(20)
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Slack Application Development 101 Slides
Slack Application Development 101 Slides
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Plotting heatmap with matplotlib/seaborn
1.
Plotting heatmap with matplotlib/seaborn February
2nd 2022
2.
Method 1: matplotlib
(auto) import numpy as np import matplotlib.pyplot as plt data = np.random.random(( 12 , 12 )) plt.imshow( data , cmap = 'autumn',interpolation = 'nearest' ) plt.title( "2-D Heat Map" ) plt.show() https://www.geeksforgeeks.org/how-to-draw-2d-heatmap-using-matplotlib-in-python/
3.
Method 2: seaborn
(auto) import numpy as np; np.random.seed(0) import seaborn as sns; sns.set_theme() uniform_data = np.random.rand(10, 12) ax = sns.heatmap(uniform_data) https://seaborn.pydata.org/generated/seaborn.heatmap.html
4.
Method 2: seaborn
(auto + label) flights = sns.load_dataset("flights") flights = flights.pivot("month", "year", "passengers") ax = sns.heatmap(flights) https://seaborn.pydata.org/generated/seaborn.heatmap.html
5.
Method 2: seaborn
(auto + label + annotation) flights = sns.load_dataset("flights") ax = sns.heatmap(flights, annot=True, fmt="d") ax = sns.heatmap(flights) https://seaborn.pydata.org/generated/seaborn.heatmap.html
6.
Method 2: Two
heatmaps import matplotlib.pyplot as plt import seaborn as sns from matplotlib import gridspec fig = plt.figure(figsize=(12, 10), dpi=300) gs = gridspec.GridSpec(1, 2, width_ratios=[3, 1]) ax0 = plt.subplot(gs[0]) ax0 = sns.heatmap(terms, cmap=cmap, cbar=False) ax1 = plt.subplot(gs[1]) ax1 = sns.heatmap(ground_truth, cmap=cmap, yticklabels=False, cbar_kws={'shrink': 2.0, 'label': 'Quantile of term'})
7.
Method 3: matplotlib
(manual) import matplotlib.pyplot as plt from matplotlib.patches import Polygon, Rectangle from matplotlib.collections import PatchCollection fig, ax = plt.subplots() patch1 = [] for y_corr in reversed(range(11)): for x_corr in range(11): patch1.append(Rectangle((x_corr,y_corr),1,1)) p = PatchCollection(patch1, cmap='RdYlBu', alpha=0.6) p.set_edgecolor('black') # map color color = df.values.flatten() p.set_array(np.array(color)) ax.add_collection(p) … ax.set_yticklabels(...) ax.set_ylabel('Query extension (bp)') … col = plt.colorbar(p, cax = cax, format=ticker.FuncFormatter(fmt)) col.ax.set_ylabel("Geometric mean of q-value") … ax.add_patch(Rectangle((5, 4), 1, 1, fill=False, edgecolor='lawngreen', lw=3)) Heatmap Label Color bar Highlight rectangle
8.
Method3: Heatmap with
two colors
9.
Heatmap with two
colors from matplotlib.patches import Polygon, Rectangle for y_corr in reversed(range(10)): for x_corr in range(10): index1 = [[x_corr, y_corr], [x_corr + 1, y_corr + 1], [x_corr, y_corr + 1]] patch1.append(plt.Polygon(index1))
10.
Heatmap with two
colors added manually !!!
Download now