how to adjust # of ticks on Bokeh axis (labels are overlapping on small figures)

喜你入骨 提交于 2019-12-03 02:21:40

Looks like there is still no direct way to specify this. Please follow the related issue. This is a workaround:

from bokeh.models import SingleIntervalTicker, LinearAxis

plot = bp.figure(plot_width=800, plot_height=200, x_axis_type=None)
ticker = SingleIntervalTicker(interval=5, num_minor_ticks=10)
xaxis = LinearAxis(ticker=ticker)
plot.add_layout(xaxis, 'below')

You can control the number of tickets via the interval parameter in SingleIntervalTicker.

You can control the number of ticks now with desired_num_ticks property. Look at the example from the bokeh docs (and this issue).

For example, in your case, something like this: plot.yaxis[0].ticker.desired_num_ticks = 10.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!