Setting x_axis_label or y_axis_label font / font size (Bokeh)

Is there a way to adjust the font / font size x_axis_labeland y_axis_labelin Bokeh (0.70)? I know a way to adjust the font size of the header using a property title_text_font_sizeusing:

figure (..., title_text_font_size="12pt")

Is there a way to specify something like:

figure (..., x_axis_label_text_font_size='10pt')

(using the <name>_text_font_size convention) to specify a font size property. The above did not work. If not, can someone give some guidance on how to make this adjustment in the cofeescript + API side of things, so what can contribute to the project? Thanks

+4
source share
2 answers

xaxis yaxis, . :

p.xaxis.axis_label = 'whatever'
p.xaxis.axis_label_text_font_size = "40pt"
+10

CustomJS:

  • fig = figure(...) x_axis_location y_axis_location, , . , , X , y , :

    x_axis_location='above', y_axis_location='right'
    
  • :

    fig.xaxis.visible = None
    fig.yaxis.visible = None
    
  • (.. , 1):

    from bokeh.models import LinearAxis
    xaxis = LinearAxis(axis_label="Initial x-axis label")
    yaxis = LinearAxis(axis_label="Initial y-axis label")
    fig.add_layout(xaxis, 'below')
    fig.add_layout(yaxis, 'left')
    
  • CustomJS, axis_label s:

    callback = CustomJS(args=dict(source=source,
                                  xaxis=xaxis,
                                  yaxis=yaxis), code="""
    
        xaxis.attributes.axis_label = "New x-axis label";
        yaxis.attributes.axis_label = "New y-axis label";
        xaxis.trigger('change');
        yaxis.trigger('change');
    
        """)
    
+1

Source: https://habr.com/ru/post/1568159/


All Articles