Skip to content

Support axis sharing between arbitrary subplot rows, columns #200

Description

@kinyatoride

Description

Hi, I like the way you configured sharex and sharey with different levels, but there is a slight difference between matplotlib sharex/sharey. In proplot, sharex only works in the same row whereas matplotlib works in different rows as well.

I think this difference is fine but can you add an option (such as sharex=4) to allow sharing in different rows?

Thanks.

Steps to reproduce

import numpy as np
import proplot as plot

rng = np.random.default_rng()
x = np.arange(10)
y = rng.standard_normal(10)

fig, axs = plot.subplots(ncols=2, nrows=2, share=3)

for i, ax in enumerate(axs):
    ax.plot(x+i, y+i)

axs.axvline(0, c='k', ls='--')
axs.axhline(0, c='k', ls='--')

Actual behavior: [What actually happened]
Screen Shot 2020-06-26 at 8 25 34

Equivalent steps in matplotlib

import numpy as np
import matplotlib.pyplot as plt

rng = np.random.default_rng()
x = np.arange(10)
y = rng.standard_normal(10)

fig, axes = plt.subplots(2, 2, sharex=True, sharey=True)
for i, ax in enumerate(axes.flat):
    ax.plot(x+i, y+i)

    ax.axvline(0, c='k', ls='--')
    ax.axhline(0, c='k', ls='--')  

Screen Shot 2020-06-26 at 8 25 59

Proplot version

0.6.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions