hvplot icon indicating copy to clipboard operation
hvplot copied to clipboard

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

Open rancomp opened this issue 9 months ago • 0 comments

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

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

rancomp avatar May 07 '24 10:05 rancomp