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

前端 未结 2 1670
独厮守ぢ
独厮守ぢ 2021-02-04 06:27

I have a multi-figure Bokeh plot of vertically stacked & aligned figures. Because I want to align the plots vertically, the y-axis labels are rotated to be vertical rather

2条回答
  •  攒了一身酷
    2021-02-04 06:27

    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')
    

    enter image description here

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

提交回复
热议问题