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?
Ticks are the markers denoting data points on the axes and tick labels are the name given to ticks. By default matplotlib itself marks the data points on the axes but it has also provided us with setting their own axes having ticks and tick labels of their choice. Attention geek!
labels : labels of axis tick marks. Allowed values are : trans for axis transformations. Possible values are “log2”, “log10”, “sqrt”, etc The R code below set the position of tick marks on the y axis of the box plot.
Ticks are the markers denoting data points on the axes and tick labels are the name given to ticks. By default matplotlib itself marks the data points on the axes but it has also provided us with setting their own axes having ticks and tick labels of their choice.
Change the appearance of the axis tick mark labels The color, the font size and the font face of axis tick mark labels can be changed using the functions theme () and element_text () as follow : p + theme(axis.text.x= element_text(family, face, colour, size)) p + theme(axis.text.y = element_text(family, face, colour, size))
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With