Change text font size in categorical bar plot

Hi everyone,

kind of stuck with this: Im trying to chage the x_axis bar columns font size but I cant seem to figure it out…
The image is attached. What I want to change is the size of the following text: ~1, ~2, Exact match, expand.

Any help would be appreciated!

Heres the code Im currently using

def search(self):

PLOT SEARCH STRATEGIES

searchStrategy = resultsDF[‘Search Type’].unique()

values =

for x in searchStrategy:

dft = resultsDF[(resultsDF[‘Search Type’] == x)]

dft.values.tolist()

print tmpList[-1][-1]

values.append(dft.values.tolist()[-1][-1])

source = ColumnDataSource(data=dict(fruits=searchStrategy, counts=values))

p1 = figure(x_range=searchStrategy, plot_height=400, toolbar_location=None,

#title=“Evaluation of implemented search strategies”,

x_axis_label = “Evaluated search strategy”, y_axis_label = ‘% of found CIViC documents’)

p1.vbar(x=‘fruits’, top=‘counts’, width=0.5, source=source, #legend=“fruits”,

line_color=‘white’, fill_color=factor_cmap(‘fruits’, palette=Spectral6, factors=searchStrategy))

labels = LabelSet(x=‘fruits’, y=‘counts’, text=‘counts’, level=‘glyph’,

x_offset=-13.5, y_offset=0, source=source, render_mode=‘canvas’)

p1.add_layout(labels)

p1.xgrid.grid_line_color = None

p1.y_range.start = 0

p1.y_range.end = 100

p1.legend.orientation = “horizontal”

p1.legend.location = “top_center”

p1.xaxis.axis_label_text_font_size = “13pt”

p1.legend.text_font_size=“22pt”

SearchStrategiesSummaryBokeh.pdf (25.5 KB)

Hi Jurica,

You try:

p1.xaxis.major_label_text_font_size = “20px”

You can find all axis attributes here: https://bokeh.pydata.org/en/latest/docs/reference/models/axes.html

Regards,

Eugene

···

On Monday, November 27, 2017 at 12:27:18 AM UTC+7, Jurica Seva wrote:

Hi everyone,

kind of stuck with this: Im trying to chage the x_axis bar columns font size but I cant seem to figure it out…
The image is attached. What I want to change is the size of the following text: ~1, ~2, Exact match, expand.

Any help would be appreciated!

Heres the code Im currently using

def search(self):

PLOT SEARCH STRATEGIES

searchStrategy = resultsDF[‘Search Type’].unique()

values =

for x in searchStrategy:

dft = resultsDF[(resultsDF[‘Search Type’] == x)]

dft.values.tolist()

print tmpList[-1][-1]

values.append(dft.values.tolist()[-1][-1])

source = ColumnDataSource(data=dict(fruits=searchStrategy, counts=values))

p1 = figure(x_range=searchStrategy, plot_height=400, toolbar_location=None,

#title=“Evaluation of implemented search strategies”,

x_axis_label = “Evaluated search strategy”, y_axis_label = ‘% of found CIViC documents’)

p1.vbar(x=‘fruits’, top=‘counts’, width=0.5, source=source, #legend=“fruits”,

line_color=‘white’, fill_color=factor_cmap(‘fruits’, palette=Spectral6, factors=searchStrategy))

labels = LabelSet(x=‘fruits’, y=‘counts’, text=‘counts’, level=‘glyph’,

x_offset=-13.5, y_offset=0, source=source, render_mode=‘canvas’)

p1.add_layout(labels)

p1.xgrid.grid_line_color = None

p1.y_range.start = 0

p1.y_range.end = 100

p1.legend.orientation = “horizontal”

p1.legend.location = “top_center”

p1.xaxis.axis_label_text_font_size = “13pt”

p1.legend.text_font_size=“22pt”

Hi Eugene,

thank you for the fast answer and the link! That did the trick :wink:

Best,
Jurica

Dana nedjelja, 26. studenoga 2017. u 18:45:43 UTC+1, korisnik Eugene Pakhomov napisao je:

···

Hi Jurica,

You try:

p1.xaxis.major_label_text_font_size = “20px”

You can find all axis attributes here: https://bokeh.pydata.org/en/latest/docs/reference/models/axes.html

Regards,

Eugene

On Monday, November 27, 2017 at 12:27:18 AM UTC+7, Jurica Seva wrote:

Hi everyone,

kind of stuck with this: Im trying to chage the x_axis bar columns font size but I cant seem to figure it out…
The image is attached. What I want to change is the size of the following text: ~1, ~2, Exact match, expand.

Any help would be appreciated!

Heres the code Im currently using

def search(self):

PLOT SEARCH STRATEGIES

searchStrategy = resultsDF[‘Search Type’].unique()

values =

for x in searchStrategy:

dft = resultsDF[(resultsDF[‘Search Type’] == x)]

dft.values.tolist()

print tmpList[-1][-1]

values.append(dft.values.tolist()[-1][-1])

source = ColumnDataSource(data=dict(fruits=searchStrategy, counts=values))

p1 = figure(x_range=searchStrategy, plot_height=400, toolbar_location=None,

#title=“Evaluation of implemented search strategies”,

x_axis_label = “Evaluated search strategy”, y_axis_label = ‘% of found CIViC documents’)

p1.vbar(x=‘fruits’, top=‘counts’, width=0.5, source=source, #legend=“fruits”,

line_color=‘white’, fill_color=factor_cmap(‘fruits’, palette=Spectral6, factors=searchStrategy))

labels = LabelSet(x=‘fruits’, y=‘counts’, text=‘counts’, level=‘glyph’,

x_offset=-13.5, y_offset=0, source=source, render_mode=‘canvas’)

p1.add_layout(labels)

p1.xgrid.grid_line_color = None

p1.y_range.start = 0

p1.y_range.end = 100

p1.legend.orientation = “horizontal”

p1.legend.location = “top_center”

p1.xaxis.axis_label_text_font_size = “13pt”

p1.legend.text_font_size=“22pt”