Skip to content

Set sharex/sharey to False if using 3d plots #7047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Sep 16, 2022

Matplotlibs 3d plots appears to not support sharex/sharey. So reset to default values instead. This improves the look of the plot as axis values aren't deleted.

Example:

import matplotlib.pyplot as plt

fig = plt.figure()
subplot_kws = {"projection":"3d"}
ax1 = fig.add_subplot(211, **subplot_kws)
ax1.plot([0, 1, 2], [5,6,6])
ax2 = fig.add_subplot(212, sharex = ax1, **subplot_kws)
ax2.plot([0, 1, 2], [5,4,2])  # x axis is not linked.

Split up from #6778.

@mathause
Copy link
Collaborator

Does this warrant a test? But good to go anyways.

@Illviljan
Copy link
Contributor Author

I'm not sure how to check that sharex works or not. Any ideas?

@mathause
Copy link
Collaborator

Maybe:

len(list(ax.get_shared_x_axes())) != 0

@Illviljan Illviljan mentioned this pull request Sep 25, 2022
3 tasks
@Illviljan
Copy link
Contributor Author

I'll add the test in a future pr.

@Illviljan Illviljan merged commit 212a5d7 into pydata:main Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants