holoviz / holoviz/hvplot

rows and cols are inverted when passing row col arguments to .plot.heatmap

Open
#1,338 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

#### ALL software version info
```
Platform: Windows-10-10.0.22631-SP0
Python: 3.11.7 | packaged by Anaconda, Inc. | (main, Dec 15 2023, 18:05:47) [MSC v.1916 64 bit (AMD64)]

hvplot: 0.9.2
holoviews: 1.18.3
panel: 1.3.8
bokeh: 3.3.4
matplotlib: 3.8.0
numpy: 1.26.3
pandas: 2.2.1
```

#### Description of expected behavior and the observed behavior
Using `.plot.heatmap` with the row/col argument produces a heatmap with kdims that are inverted. Specifically, the `col` column points to the rows, and the `row` column points to the columns.

The expected behavior is that the `col/row` function arguments will indeed indicate the rows and the columns. Moreover, this is inconsistent with just passing a `col` argument (without `row` argument).

Could be related to https://github.com/holoviz/hvplot/issues/1335
#### Complete, minimal, self-contained example code that reproduces the issue

```
import polars as pl
import holoviews as hv
df = pl.DataFrame({
"x":[1,1,2,2,]*4,
"y":[1,2,1,2,]*4,
"C":[1,2,3,4,1,1,2,2,3,2,3,1,4,3,2,1],
"col":([1]*4+[2]*4)*2,
"row":[10]*8+[11]*8,
})

g = df.plot.heatmap(x="x",y="y",C="C",col="col", row="row")
hv.save(g, "inverted-rows-and-cols.html")
```

#### Stack traceback and/or browser JavaScript console output

#### Screenshots or screencasts of the bug in action

![image](https://github.com/holoviz/hvplot/assets/23070692/9f7d5aee-7beb-4ef8-97c3-1b53c7b72d2a)

- [x] I may be interested in making a pull request to address this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.