Saturday, January 17, 2026
HomeLanguagesBokeh – Horizontal layout of plots

Bokeh – Horizontal layout of plots

Bokeh includes several layout options for arranging plots and widgets. They make it possible to arrange multiple components to create interactive dashboards or data applications. The layout functions let you build a grid of plots and widgets. You can nest as many rows, columns, or grids of plots together as you’d like. In addition, Bokeh layouts support a number of “sizing modes”. These sizing modes allow plots and widgets to resize based on the browser window.

In Bokeh Row layout all the plots will be shown in a row only. This can be done using the row layout function supported under Bokeh:

Syntax:

row( plot1, plot2, …. , plotn)

Approach:

  • Import module
  • Create data
  • Normally create multiple plots as if they are independent to each other.
  • Combine them in one layout using rows()
  • Display plots

Example:

Python3




# python program for bokeh row layout
from bokeh.io import output_file, show
from bokeh.layouts import row
from bokeh.plotting import figure
  
# output will be in output.html
output_file("output.html")
  
x = list(range(11))
# y will be same as x
y = x
# y0 divide every element of x by 2
y0 = [i/2 for i in x]
# y1 multiply every element of xby 2
y1 = [i*2 for i in x]
  
# now creating three plots
plot1 = figure(plot_width=200, plot_height=250, background_fill_color="#fafafa")
plot1.circle(x, y, size=12, color="#53777a", alpha=0.8)
  
plot2 = figure(plot_width=200, plot_height=250, background_fill_color="#fafafa")
plot2.triangle(x, y0, size=12, color="#c02942", alpha=0.8)
  
plot3 = figure(plot_width=200, plot_height=250, background_fill_color="#fafafa")
plot3.square(x, y1, size=12, color="#d95b43", alpha=0.8)
  
# now creating row layout
show(row(plot1, plot2, plot3))


Output :

Example:

Python3




from bokeh.io import output_file, show
from bokeh.layouts import row
from bokeh.plotting import figure
  
output_file("output.html")
  
x = list(range(11))
# y0 is same as x
y0 = x
# y1 is every element of x %2
y1 = [i % 2 for i in x]
# y1 is every element of x %10
y2 = [i % 10 for i in x]
  
plot1 = figure(plot_width=200, plot_height=250, background_fill_color="#fafafa")
plot1.circle(x, y0, size=12, color="#53777a", alpha=0.8)
  
plot2 = figure(plot_width=200, plot_height=250, background_fill_color="#fafafa")
plot2.triangle(x, y1, size=12, color="#c02942", alpha=0.8)
  
plot3 = figure(plot_width=200, plot_height=250, background_fill_color="#fafafa")
plot3.square(x, y2, size=12, color="#d95b43", alpha=0.8)
  
show(row(plot1, plot2, plot3))


Output :

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32474 POSTS0 COMMENTS
Milvus
118 POSTS0 COMMENTS
Nango Kala
6846 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12063 POSTS0 COMMENTS
Shaida Kate Naidoo
6985 POSTS0 COMMENTS
Ted Musemwa
7219 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6911 POSTS0 COMMENTS