Sharing X,Y-axis Scale Limits

Use sharex, sharey parameters in the gggrid() function to control sharing of axis scale limits among plots in grid:

  • "all" or True - share limits between all subplots
  • "none" or False - do not share limits between subplots
  • "row" - share limits between subplots in the same row
  • "col" - share limits between subplots in the same column
In [1]:
from lets_plot import *
import numpy as np
In [2]:
LetsPlot.setup_html()
In [3]:
np.random.seed(37)
dat1 = {'x': np.random.normal(size=1000)}
dat2 = {'x': np.random.normal(size=200)}

p1 = ggplot(dat1, aes(x='x')) + geom_histogram()
p2 = ggplot(dat2, aes(x='x')) + geom_histogram()

1. Two Independent Charts in Grid

In [4]:
gggrid([p1, p2])
Out[4]:

2. Share Scale Limits of the Y-axis

In [5]:
gggrid([p1, p2], sharey=True)
Out[5]:

3. Share Scale Limits of both, X and Y-axis

In [6]:
gggrid([p1, p2], sharex=True, sharey=True)
Out[6]: