Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

matplotlib figure gets deleted

By: a guest on Mar 15th, 2010  |  syntax: Python  |  size: 1.31 KB  |  views: 102  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. In [1]: import numpy as np
  2.  
  3. In [2]: from matplotlib import pyplot as plt
  4.  
  5. In [3]: import pylab
  6.  
  7. In [4]: centerNormal = pylab.load("centerNormal")
  8.  
  9. In [5]: pointProject = pylab.load("pointProject")
  10.  
  11. In [6]: myFigure = plt.figure(figsize=(30,30))
  12.  
  13. In [7]: myAxis = myFigure.add_subplot(1,1,1)
  14.  
  15. In [8]: pointProject.shape
  16. Out[8]: (208, 4)
  17.  
  18. In [9]: pointProject[:,0].shape
  19. Out[9]: (208,)
  20.  
  21. In [10]: pointProject[:,2].shape
  22. Out[10]: (208,)
  23.  
  24. In [11]: myAxis.plot(pointProject[:,0],pointProject[:,2],'ro')
  25. Out[11]: [<matplotlib.lines.Line2D object at 0x93e7c2c>]
  26.  
  27. In [12]: myFigure.show()
  28.  
  29. In [13]: myAxis.set_aspect('equal')
  30.  
  31. In [14]: myFigure.show()
  32. ---------------------------------------------------------------------------
  33. RuntimeError                              Traceback (most recent call last)
  34.  
  35. /home/tomislav/OpenFOAM/tomislav-1.5-dev-debug/run/MASTER/circleCases/hexMesh/voFoamCircleHexa/<ipython console> in <module>()
  36.  
  37. /usr/lib/python2.5/site-packages/matplotlib/backends/backend_qt4.pyc in <lambda>(*args)
  38.     239
  39.     240         # attach a show method to the figure for pylab ease of use
  40. --> 241         self.canvas.figure.show = lambda *args: self.window.show()
  41.     242
  42.     243         def notify_axes_change( fig ):
  43.  
  44. RuntimeError: underlying C/C++ object has been deleted
  45.  
  46. In [16]: