Heatmap only supports equal row and column
See original GitHub issueDescription
heatmap
only works for equal row and column.
Steps to reproduce
import proplot as plot
import pandas as pd
data = pd.DataFrame(index=list('abcdefghij'), columns=list('lmn'))
data = data.fillna(0)
print(data.values.shape)
# Covariance matrix plot
f, ax = plot.subplots(axwidth=4.5)
m = ax.heatmap(
data, cmap='ColdHot', vmin=-1, vmax=1, N=100,
lw=0.5, edgecolor='k', labels=True, labels_kw={'weight': 'bold'},
clip_on=False, # turn off clipping so box edges are not cut in half
)
ax.format(
suptitle='Heatmap demo', title='Table of correlation coefficients', alpha=0, linewidth=0,
xloc='top', yloc='right', yreverse=True, ticklabelweight='bold',
ytickmajorpad=4, # the ytick.major.pad rc setting; adds extra space
)
Expected behavior (generated by seaborn):
import seaborn as sns
import pandas as pd
data = pd.DataFrame(index=list('abcdefghij'), columns=list('lmn'))
data = data.fillna(0)
sns.set()
ax = sns.heatmap(data, cmap="YlGn")
Actual behavior:
File "E:\miniconda3\envs\satpy\lib\site-packages\proplot\subplots.py", line 217, in _iterator
ret.append(func(*args, **kwargs))
File "E:\miniconda3\envs\satpy\lib\site-packages\proplot\axes.py", line 1275, in heatmap
obj = self.pcolormesh(*args, **kwargs)
File "E:\miniconda3\envs\satpy\lib\site-packages\proplot\wrappers.py", line 3083, in _wrapper
return driver(self, func, *args, **kwargs)
File "E:\miniconda3\envs\satpy\lib\site-packages\proplot\wrappers.py", line 551, in standardize_2d
f'Input shapes x {x.shape} and y {y.shape} must match '
ValueError: Input shapes x (10,) and y (3,) must match Z centers (10, 3) or Z borders (11, 4).
Proplot version
0.5.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Heatmap only supports equal row and column #136 - GitHub
Description heatmap only works for equal row and column. Steps to reproduce import proplot as plot import pandas as pd data = pd....
Read more >A Complete Guide to Heatmaps | Tutorial by Chartio
Each cell in the heatmap is associated with one row in the data table. The first two columns specify the 'coordinates' of the...
Read more >Chapter 2 A Single Heatmap | ComplexHeatmap Complete ...
One major advantage of ComplexHeatmap package is that it supports splitting the heatmap by rows and columns to better group the features and ......
Read more >All About Heatmaps - Towards Data Science
Heatmaps are a compelling way to visualize relationships between variables in high dimensional space. It can be done using feature variables as ...
Read more >sheatmap: Plot a heatmap with values as close to the diagonal ...
Whether to apply the same order to both rows and columns (if reordering ... D2 instead of complete , since the only methods...
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
I think
ax.heatmap
just doesn’t take raw pandas dataframes. If you dodata.values
it works.Here’s an example with some random data inside and calling
data.columns
anddata.index
for proper labeling:This is fixed by #159. Note you can also make the grid boxes square by passing
aspect='equal'
toformat()
(which callsAxes.set_aspect()
) although #159 also makes “equal” aspect ratio the default behavior for heatmaps, just like it is the default forimshow
plots.