I've got a three-level bokeh.models.FactorRange
which I use to draw tick labels on a vbar-plot. The problem is that there are dozens of factors in total and the lowest-level labels get very cramped.
I can use plot.xaxis.formatter = bokeh.models.PrintfTickFormatter(format='')
to suppress drawing of the lowest-level labels, but this seems like an ugly hack. Also, I need to have the second-level tick labels to be rotated, yet plot.xaxis.major_label_orientation = ...
only ever affects the lowest-level ticks (just like plot.xaxis.formatter
does).
How to control each level of bokeh.models.FactorRange
individually?
As of Bokeh 0.12.13
, there is no way to control the individual orientations or formatting of different levels.
The basic initial work to revamp categorical support (for multi-level axes, etc) was a large update. Rather than add more even complexity and risk up front for features we were not sure anyone would want or need, we started with basic capability, expecting to hear from users in time what additional features were justified. This seems like it has come up a few times, so it would be reasonable to consider adding, but it would represent new work, so a GitHub feature request issue is the appropriate next step.
For completeness, I will mention that Bokeh is extensible, so it's always technically possible to create a Custom Extension. Axes are some of the most complicated code in Bokeh, and a full custom Axis would be non-trivial to write. However it's possible that would be sufficient to make subclass of CategoricalAxis
and just override this one method:
https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/axes/categorical_axis.ts#L83-L110
That's where the currently hard-coded 'parallel'
orientation are, and also where formatting could be overridden.