Skip to content

Pickled Figure Loses sharedx Properties #4827

@spaceluigi

Description

@spaceluigi

I am storing pickled Figures for plotting at later time but for some reason the sharedx property keeps getting lost on the 2nd (unpickled) figure. Execute the code below for a quick example. Is there a way to reset the shared x property? There is PR 1312 that talks about a potential unshare_x_axes function but there doesn't really appear to be a setting function either. This may actually be two problems though since the pickle should also maintain the sharedx property.

#!/usr/bin/env python
import cPickle as pickle
import matplotlib.pyplot as plt
import numpy as np

# Simple data to display in various forms
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)

f, axarr = plt.subplots(2, sharex=True)
axarr[0].plot(x, y)
axarr[0].set_title('Sharing X axis')
axarr[1].scatter(x, y)

pickle.dump(f,open('test.pickle','wb'))

new_plot = pickle.load(open('test.pickle','rb'))
new_plot.canvas.draw()

plt.show()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy