Hello people, is there any way to re-order columns and/or rows in heatmap plotted with holoviews & bokeh?
I am trying to plot a heatmap with hvplot from a matrix (a square pandas dataframe to be precise) but can’t seem to find a way… I can plot it if I just have a dataframe with x, y, annotations
columns but then the order is not guaranteed. So I am resorting to seaborn to form the matrix as I want it first and then plot it. But it would be nice if there’s already a way in holoviews.
For e.g., this is the sample of my dataframe:
df = [['night', 'daytime', 20],
['morning', 'morning', 880],
['night', 'night', 1063],
['NA', 'daytime', 12],
['evening', 'evening', 1376],
['NA', 'night', 7],
['daytime', 'evening', 123],
['morning', 'NA', 218],
['morning', 'daytime', 84],
['evening', 'daytime', 239]]
df = pd.DataFrame(df, columns=['cluster_1', 'cluster_2', 'size'])
and if I do df.hvplot.heatmap('cluster_2', 'cluster_1', 'size')
, I get a nice heatmap as below:
but I don’t know a way of reordering the default grid. For e.g, how do I set the order ['morning', 'daytime', 'evening', 'night', 'NA']
instead?
thanks