Hello,
I’m trying to use the seaborn.objects interface to create a multi-plot figure. I want the three plots to share the x-axis. However, I’m having difficulty figuring out how to get them to do so.
Here is the code I’m using:
f = mpl.figure.Figure(figsize=(20, 9))
sf1, sf2, sf3 = f.subfigures(3, 1)
(
so.Plot(core_df, x="depth_cm", y="l_star_moving_avg", group="section_no")
.add(so.Line(color="black"))
.label(x="Depth (cm)", y="L* Channel")
.limit(x=(0, 827.4))
.scale(
x=so.Continuous().tick(every=20)
)
.theme(theme_settings)
.on(sf3)
.plot()
)
(
so.Plot(core_df, x="depth_cm", y="a_star_moving_avg", group="section_no")
.add(so.Line(color="black"))
.label(x="Depth (cm)", y="a* Channel")
.limit(x=(0, 827.4))
.scale(
x=so.Continuous().tick(every=20)
)
.theme(theme_settings)
.on(sf2)
.plot()
)
(
so.Plot(core_df, x="depth_cm", y="b_star_moving_avg", group="section_no")
.add(so.Line(color="black"))
.label(x="Depth (cm)", y="b* Channel")
.limit(x=(0, 827.4))
.scale(
x=so.Continuous().tick(every=20)
)
.theme(theme_settings)
.on(sf1)
.plot()
)
I figure I’d be placing sharex=True
somewhere, but I can find where that would be.
Thanks!