I am struggling to get legible tick labels in a holoviews violin or box plot. Below are what I've tried, with comments describing how each fails to get the job done. I don't understand how to use the documented xtick and/or xformatter options for viollin and box
import hvplot
import hvplot.xarray
import xarray as xr
import numpy as np
from bokeh.models import BasicTickFormatter
if __name__ == "__main__":
# make a dummy xarray dataset with two dimensions
dim1_size = 10000
dim2_size = 50
xds = xr.Dataset(
{"values": (("dim1", "dim2"), np.random.random((dim1_size, dim2_size)))},
coords={"dim1": np.arange(dim1_size), "dim2": np.arange(dim2_size)},
)
# this works, but the horizontal axis labels overrun and are illegible
p = xds.hvplot.violin("values", by="dim2")
hvplot.show(p)
# --------------------------------------------------
# for each of the following, a server starts and no plot appears at all
# p = xds.hvplot.violin("values", by="dim2", xticks=[0, 25, 50])
# hvplot.show(p)
# p = xds.hvplot.violin("values", by="dim2").opts(xticks=[1, 25, 50])
# hvplot.show(p)
# formatter = BasicTickFormatter()
# p = xds.hvplot.violin("values", by="dim2").opts(xformatter=formatter)
# hvplot.show(p)