1

Is it possible to rotate a secondary label on the x axis? I need to ideally, angle the secondary label but can't find any documentation on how to. I am able to vertically align one of the labels (viral/non_viral).

rates_food_x = [(row[0], row[1]) for index,row in 
try_impression_surface_rates_food.iterrows()]

rates_food_y = try_impression_surface_rates_food.loc[:,'rate'].tolist()


source_sr_food = ColumnDataSource(data=dict(x=rates_food_x, y=rates_food_y))

chart_sr_food = figure(x_range=FactorRange(*rates_food_x),
          plot_width=400, plot_height=350, tools=[hover_sr_food],
          title='Impression Distribution by Surface - Food')

chart_sr_food.left[0].formatter.use_scientific = False

chart_sr_food.yaxis.axis_label = "Distribution %" 

chart_sr_food.xaxis.axis_label = "Surface"

chart_sr_food.yaxis[0].formatter = PrintfTickFormatter(format="%0.0f %%")

chart_sr_food.legend.orientation = "horizontal"

chart_sr_food.legend.location = "top_center"

chart_sr_food.xaxis.major_label_orientation = 'vertical'



chart_sr_food.vbar(x='x', top='y', source=source_sr_food, width=0.6, 
               fill_color=factor_cmap('x', palette=Spectral6, 
                    factors=list(set(try_impression_surface_rates_food['var'])), start=1, end=2))



show(chart_sr_food)

enter image description here

Utopia025
  • 1,181
  • 3
  • 11
  • 21
  • If you could please post your data structure in `try_impression_surface_rates_food`, that would be really helpful for anyone trying to replicate your efforts. – Jonas Byström Feb 13 '18 at 00:25
  • The question has been answered here: https://stackoverflow.com/questions/48631546/rotating-minor-tick-labels-for-categorical-bokeh-plot – Eugene Pakhomov Feb 13 '18 at 16:37

1 Answers1

3

Since version 0.12.16, this is possible:

p.xaxis.major_label_orientation = "vertical"
p.xaxis.subgroup_label_orientation = "normal"
p.xaxis.group_label_orientation = 0.8
bigreddot
  • 33,642
  • 5
  • 69
  • 122