Saving & Loading


In [1]:
import autofig
import numpy as np

In [2]:
#autofig.inline()

In [3]:
x = np.linspace(0,0.1,11)
y = x**2

In [4]:
autofig.reset()
autofig.plot(x, y, yunit='km', c='blue', axpos=222, label='axpos=222', legend=True)
autofig.plot(x, y, yunit='kg', c='red', axpos=(1,2,1), label='axpos=121', legend=True)
mplfig = autofig.draw(save_afig='saving_and_loading.afig')



In [5]:
autofig.gcf().axes[0].x.axes


Out[5]:
<Axes | 1 call(s) | dims: >

In [6]:
autofig.gcf().axes[0].x.get_lim()


Out[6]:
(-0.010000000000000002, 0.11000000000000001)

In [7]:
autofig.reset()

In [8]:
autofig.open('saving_and_loading.afig')


Out[8]:
<autofig.figure.Figure | 2 axes | 2 call(s)>

In [9]:
autofig.gcf().axes[0].x.axes


Out[9]:
<Axes | 0 call(s) | dims: >

In [10]:
autofig.gcf().axes[0].x.get_lim()


Out[10]:
(None, None)

In [11]:
autofig.draw(show=True)


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-11f61ee8fd20> in <module>()
----> 1 autofig.draw(show=True)

/home/kyle/.local/lib/python2.7/site-packages/autofig-1.0.0-py2.7.egg/autofig/__init__.pyc in draw(*args, **kwargs)
    138     * the return from <Figure.draw>
    139     """
--> 140     return gcf().draw(*args, **kwargs)
    141 
    142 def animate(*args, **kwargs):

/home/kyle/.local/lib/python2.7/site-packages/autofig-1.0.0-py2.7.egg/autofig/figure.pyc in draw(self, fig, i, calls, tight_layout, draw_sidebars, draw_title, subplot_grid, show, save, save_afig, in_animation)
    530                        draw_sidebars=False,
    531                        draw_title=draw_title,
--> 532                        show=False, save=False, in_animation=in_animation)
    533 
    534             self._backend_artists += axesi._get_backend_artists()

/home/kyle/.local/lib/python2.7/site-packages/autofig-1.0.0-py2.7.egg/autofig/axes.pyc in draw(self, ax, i, calls, draw_sidebars, draw_title, show, save, in_animation)
   1238 
   1239         xlim = self.x.get_lim(i=i)
-> 1240         if not np.any(np.isnan(xlim)):
   1241             ax.set_xlim(xlim)
   1242         ylim = self.y.get_lim(i=i)

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

In [ ]: