1

I am using Pyplot in Julia (almost identical to Python's matplotlib) and I have generated a 2x3 subplot with

fig, axs= plt.subplots(2, 3, sharey=false,sharex="col") 

I manage the individual subplots by accessing an array, for example

axs[1,1].set_xscale("log")

enter image description here

I would like to have the 3 bottom plots share the y-axis, but only for the 3 bottom plots. Similar questions on SO have adressed this issue but not for the case where individual subplots are managed in array form as above.

How can I make axs[2,1], axs[2,2], axs[2,3] share the y-axis?

math_lover
  • 886
  • 7
  • 20
  • Suggestion. Put the plots with same y access on the same plot. Three lines, one plot. – Robert Jacobs Jun 20 '20 at 21:10
  • https://matplotlib.org/3.1.0/gallery/subplots_axes_and_figures/shared_axis_demo.html When you create the axes you can set the sharing. I suspect there is also a method to do this after the axes is created, but I’m on a phone so can’t look it up – Jody Klymak Jun 20 '20 at 21:19
  • You can also manually access all the axes in axs and use `ax.set(ylim = (y0, y1), **kwargs)` for arbitrary `y0` and `y1`. – p479h Jun 20 '20 at 21:38
  • Follow the instructions here: https://stackoverflow.com/questions/42973223/how-share-x-axis-of-two-subplots-after-they-are-created – Jody Klymak Jun 20 '20 at 23:42
  • @JodyKlymak thanks that worked! Any idea on how I could reduce the height of the whole bottom row to whatever I want? – math_lover Jun 21 '20 at 00:02
  • Look up height_ratio argument to gridspec. – Jody Klymak Jun 21 '20 at 03:01

0 Answers0