旋转Bokeh图表的嵌套X轴实验室

2024-10-02 00:24:36 发布

您现在位置:Python中文网/ 问答频道 /正文

是否可以在x轴上旋转辅助标签?我需要理想的,角度的二级标签,但找不到任何有关如何。我可以垂直对齐其中一个标签(病毒性/非病毒性)。在

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


Tags: sourceplotfoodchart标签widthsurfacelabel

热门问题