 # Common axis for multiple plots

I have a set of plots in a grid that have similar y-axis. I want to get ride of the individual y-axes and have one common axis for all the plots.

I tried making “p.yaxis.visible = False” in all but one plot, but that makes the plot area small in the plot with the axis. Ideally, I would like to be able to add in a new figure with just axes and have the other three without axis.

Here’s an example of what I’m trying to do.

from bokeh.layouts import gridplot
from numpy import arange, linspace, pi, sin, cos
from bokeh.models import LinearAxis, Range1d
from bokeh.plotting import figure, output_file, show

x = arange(-2pi, 2pi, 0.1)

y11 = sin(x)
y12 = linspace(0, 100, len(y11))

y21 = cos(x)
y22 = linspace(100, 0, len(y11))

y31 = sin(x*2)
y32 = linspace(0, 10, len(y11))**2

def createCombinedPlot(x, y1, y2):

``````p = figure(x_range=(-6.5, 6.5), y_range=(-1.1, 1.1),
plot_width=300, plot_height=200)

p.circle(x, y1, color="red")
p.extra_y_ranges = {"foo": Range1d(start=0, end=100)}
p.circle(x, y2, color="blue", y_range_name="foo")
p.add_layout(LinearAxis(y_range_name="foo"), 'left')

return p
``````

plot_list = [createCombinedPlot(x, y1, y2) for x, y1, y2 in ((x, y11, y12), (x, y21, y22), (x, y31, y32))]

output_file(“twin_axis_modified.html”)

show(gridplot(plot_list, ncols=2))

Hi @optisium please edit your post to use code formatting so that the code is intelligible (either with the `</>` icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

Otherwise, all I can do is point to some possibly relevant examples with shared axes:

iris_splom.py — Bokeh 2.3.0 Documentation

bokeh/examples/app/ohlc at branch-2.4 · bokeh/bokeh · GitHub