Вместо этого, независимо от порядка сортировки redim.values, он «возрастает» от 0 до -19 по оси Y. См. ось, обведенную красным.

from pathlib import Path
import holoviews as hv
import pandas as pd
import webbrowser
hv.extension('bokeh')
renderer = hv.renderer('bokeh')
data = [{"x": str(i),
"y": str(-j),
"z": i*j }
for i in range(20)
for j in range(20)]
df = pd.DataFrame(data)
# X works ok... or ok by happenstance
x_vals = list(set(df["x"].tolist()))
x_vals.sort(key=int)
# Y making no difference
y_vals1 = list(set(df["y"].tolist()))
y_vals1.sort(key=int, reverse=True)
y_vals2 = list(set(df["y"].tolist()))
y_vals2.sort(key=int, reverse=False)
hm1 = hv.HeatMap(df,
)
hm1.opts(hv.opts.HeatMap(tools=['hover'],
colorbar=True,
height=800,
width=800,
toolbar='above',
),
)
hm1.redim.values(
#x=x_vals,
y=y_vals1,
)
html = renderer.html(hm1)
Path("test_True.html").write_text(html,
encoding="utf-8")
webbrowser.open("test_True.html")
#-------------------------------------------------------------------------
hm2 = hv.HeatMap(df,
)
hm2.opts(hv.opts.HeatMap(tools=['hover'],
colorbar=True,
height=800,
width=800,
toolbar='above',
),
)
hm2.redim.values(
#x=x_vals,
y=y_vals2,
)
html = renderer.html(hm2)
Path("test_False.html").write_text(html,
encoding="utf-8")
webbrowser.open("test_False.html")
Подробнее здесь: https://stackoverflow.com/questions/790 ... difference