How to rotate X-axis labels in bokeh figure?

前端 未结 2 502
鱼传尺愫
鱼传尺愫 2021-01-03 19:23

I\'m just starting to use Bokeh. Below I create some args I use for the rect figure.

x_length = var_results.index * 5.5

Multiplying the ind

相关标签:
2条回答
  • 2021-01-03 19:37

    In order to rotate the labels e.g. by 90 degrees to the left, you can set major_label_orientation to π/2. This can be done either when creating the axis element (as a kwarg to the axis constructor if you are using low level plotting) or also after you have created a plot/figure, for instance by:

    p.xaxis.major_label_orientation = math.pi/2
    
    # or alternatively:
    p.xaxis.major_label_orientation = "vertical"
    

    See also this example in the documentation.

    0 讨论(0)
  • 2021-01-03 19:57

    As an alternative to rotation, you set the orientation to a fixed value:

    p.xaxis.major_label_orientation = "vertical"
    

    should do what you want, too.

    0 讨论(0)
提交回复
热议问题