Open jbednar opened 2 years ago
In the exemple, the x-axis is a LinearAxis
. This seems problematic ; shouldn't both axes be CategoricalAxis
(as stated in the documentation you link to)? And then, this would be logical that there is no notion of minor_ticks.
import holoviews as hv
import pandas as pd
hv.extension('bokeh', width=100)
data = [(i, chr(97+j), i*j) for i in range(5) for j in range(5) if i!=j]
hm = hv.HeatMap(data)
df = pd.DataFrame(data,columns = ['x','y','z'])
hm = hv.HeatMap(df)
brenderer = hv.renderer('bokeh')
fig = brenderer.get_plot_state(hm)
fig.axis
result is [LinearAxis(id='1673', ...), CategoricalAxis(id='1677', ...)]
.
The figure you look for can be achieved by casting df['x'] = df['x'].astype(str)
. However I think, this should work with no explicit casting (or such a casting should be taken care of by holoviews).
Besides, I noticed that an alternative casting df.x = pd.Categorical(df.x)
was giving a warning and a LinearAxis
where we could expect no warning and two CategoricalAxis
.
Sounds like a good explanation to me. Something to fix in HoloViews's Bokeh plotting for HeatMaps, then?
According to https://holoviews.org/user_guide/Customizing_Plots.html#font-sizes, there are plot options to control
minor_xticks
andminor_ticks
, but I can't find anything to control the minor ticking behavior on a HeatMap:I.e., the only option available appears to be
xticks
, but apart from the default (with lots of minor ticks) and 0 (with no ticks at all), there don't seem to be any useful values for a heatmap. A value of 1 seems broken, in that it puts ticks but only labels one of them, and none of the other values achieve having one tick per cell in this plot, which is what I was trying to achieve, i.e. the default for the Matplotlib backend: