Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9188009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:54:42+00:00 2026-06-17T19:54:42+00:00

The previous answer from tcaswell on how to create shared axis for plots which

  • 0

The previous answer from tcaswell on how to create shared axis for plots which are not on the same figure was perfect 🙂 But I’m now wondering how to disable the shared axis and reenable them without having to redraw or destroy anything ? (I have multiple graphs and I want to add a button that the user can click to disable/enable those shared axes) I found a way :

import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(111)
fig2 = plt.figure()
ax2 = fig2.add_subplot(111, sharex=ax1)

to create the shared axis and then

fig2.delaxes(ax2)
ax2 = fig2.add_subplot(111)

but this require to redraw everything and can take some times. I didnt find a simple function to disable the link. Is there a lighter way than what I did ?

Thanks !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:54:44+00:00Added an answer on June 17, 2026 at 7:54 pm

    There is no existing easy way to do this, however I think it can be done (it will just take a bit of digging into the matplotlib internals). The way that the axes are linked underneath is by simply using the same locator and formatter objects for both axis. To link/unlink you will have to copy/make new all of those objects, as well as update some ancillary structures (_shared_x_axes, _shared_y_axes). Look at the implementation of matplotlib.axes.Axes.cla() for some idea of what you need to do.

    There is a pull request against the repo that adds this functionality and the associated feature request. If you are comfortable a) installing from source b) using master and c) applying this patch I think the developers would appreciate you testing this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a CSS related question, I got one good answer from my previous
I was inspired by the good answers from my previous question about SQL. Now
This question is based on my previous question which I got a working answer
Is there a way to modify the code from a previous answer import groovy.xml.MarkupBuilder
Following on from the excellent answer to my previous question: Linq Entity Framework generic
I need to get previous 30 days from a specific date which is available
After exploring the very excellent answer from Heike to my previous question about anamorphic
Following on from a previous question in which I asked: How can I use
I have fit a regression using lme4 thanks to a previous answer . Now
Thanks to a previous answer , I'm now able to read my password-protected Word

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.