Open In App

How to change ticks label sizes using Python’s Bokeh?

Bokeh is an interactive data plotting visualization library for modern web browsers. It provides elegant, concise construction of versatile graphics, and affords high-performance interactivity over large or streaming datasets.

In this article, we are going to discuss How to change ticks label sizes using Python’s Bokeh.



Step-by-step Approach:

Below are some examples based on the above approach:



Example 1:




from bokeh.plotting import figure, show
from bokeh.models import Legend
  
# Figure to plot
plot = figure(plot_width=700, plot_height=500)
  
  
# X axis customization
plot.xaxis.axis_label = "X Axis"
plot.xaxis.axis_label_text_color = "green"
  
# Y axis customization
plot.yaxis.axis_label = "Y Axis"
plot.yaxis.axis_label_text_color = "green"
  
# Creating the simple dataset
x = list(range(15))
y = [i**2 for i in x]
  
# setting the X and Y values
plot.line(x, y, line_width=4, line_color='lime',
          legend_label="label_text_font_size = '15pt'")
  
# Legend Customization
plot.legend.label_text_font_size = "15pt"
plot.legend.label_text_color = "green"
  
# Draw function
show(plot)

Output:

Example 2:




from bokeh.plotting import figure, show
from bokeh.models import Legend
from math import sin
  
# Figure to plot
plot = figure(plot_width=700, plot_height=500)
  
  
# X axis customization
plot.xaxis.axis_label = "X Axis"
plot.xaxis.axis_label_text_color = "green"
  
# Y axis customization
plot.yaxis.axis_label = "Y Axis"
plot.yaxis.axis_label_text_color = "green"
  
# Creating the simple dataset
x = y = list(range(10))
  
  
# setting the X and Y values
plot.line(x, y, line_width=4, line_color='lime',
          legend_label="label_text_font_size = '30pt'")
  
# Legend Customization
plot.legend.label_text_font_size = '30pt'
plot.legend.label_text_color = "green"
  
# Draw function
show(plot)

Output:


Article Tags :