sns.heatmap top and bottom boxes are cut off
See original GitHub issueWith seaborn 0.9.0
and matplotlib 3.1.1
, the topmost and bottommost row of boxes in a seaborn
plot are partially cut off:
import seaborn as sns
import numpy as np
np.random.seed(42)
sns.heatmap(np.random.random((10, 10)))
As another example, consider this demo from the gallery:
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# Load the example flights dataset and conver to long-form
flights_long = sns.load_dataset("flights")
flights = flights_long.pivot("month", "year", "passengers")
# Draw a heatmap with the numeric values in each cell
f, ax = plt.subplots(figsize=(9, 6))
sns.heatmap(flights, annot=True, fmt="d", linewidths=.5, ax=ax)
This is a pretty major visual issue. Apologies if this has been reported before, but I couldn’t find a record of such in the GH issues.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:51
- Comments:6 (1 by maintainers)
Top Results From Across the Web
matplotlib/seaborn: first and last row cut in half of heatmap plot
I have seen this question around but am unfamiliar how to revert back to matplotlib 3.1.0 or set the heatmap limits manually (tried...
Read more >sns.heatmap top and bottom boxes are cut off - Bountysource
With seaborn 0.9.0 and matplotlib 3.1.1 , the topmost and bottommost row of boxes in a seaborn plot are partially cut off:
Read more >Seaborn Heat Map Cut Off fix through matplotlib upgrade in ...
Just a simple way of upgrading to a newer version of Matplotlib, in order to resolve the Heat Map cut off issue.pip install...
Read more >Ultimate Guide to Heatmaps in Seaborn with Python
In this tutorial, we'll cover everything you need to know from basic to advanced usage of Heatmaps in Seaborn and Python.
Read more >seaborn heatmap not displaying correctly
Current version of matplotlib broke heatmaps. Downgrade the package to 3.1.0. pip install matplotlib==3.1.0. matplotlib/seaborn: first and last row cut in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s what I figured out as a work-around:
This was a
matplotlib
regression introduced in 3.1.1 which has been fixed in 3.1.2 (still forthcoming).For now the fix is to downgradematplotlib
to a prior version.Edit (by @mwaskom): The advice to downgrade is now several versions out of date and it is better to upgrade matplotlib to solve this issue.