1

I have 8 figures (4 rows, 2 columns). I want all figures to share axes, except for one. Is this possible in matplotlib without doing it by hand?

Example:

fig = plt.figure();
ax = fig.subplots(4,2,sharex='all',sharey='all')
for j in np.arange(4):
    plt.sca(ax[j,0])
    plt.plot(np.random.random(5),'.')
    plt.sca(ax[j,1])
    plt.plot(np.arange(5),'.')
plt.sca(ax[0,0])
# Code here to unlink this one axis from the shared system
plt.gca().set_yscale('log',basey=10) # I only want this one axis to be log
James
  • 683
  • 9
  • 25
  • 1
    I think the fastest way would be to delete that subplot with `ax[0,0].remove()` and create a new one at the same position with `ax[0,0] = fig.add_subplot(421)`. Otherwise you have to 'unshare' the `Axes`, which is a bit tedious. – Thomas Kühn Sep 13 '18 at 06:20
  • Just to add, if you really want to unshare the existing axes, see [this](https://stackoverflow.com/a/49761736/2454357) and [this](https://stackoverflow.com/a/51020046/2454357). – Thomas Kühn Sep 13 '18 at 07:53
  • 1
    Removing the axis worked perfectly, thank you! – James Sep 13 '18 at 23:32

0 Answers0