[Matplotlib-users] imlim in ax.imshow

2012-10-01 Thread Michael Aye
Hi!

I see that the function ax.imshow takes the parameter 'imlim' but in 
the source (status: EPD 7.3-2) it is not being used?
So what is it for?

Best regards,
Michael




--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] static linking

2012-10-01 Thread Rita
Figured it out.

The real trick is to set the PKG_CONFIG_PATH properly. No need for
LD_LIBRARY_PATH

On Sun, Sep 30, 2012 at 9:52 AM, Rita rmorgan...@gmail.com wrote:

 Nelly,
 I would like to compile libpng into matplotlib if possible, ie static.
 Seems like thats not possible and I would like to would LD_LIBRARY_PATH as
 much as possible. I much prefer -Wl, rpath or LD_PRELOAD.

 Jouni,
 for the pkg-config can I use the one with my OS, /usr/bin/pkg-config? and
 also libpng comes with its own variation of pkg-config (not named that).
 How can I include that? do I set PKG_CONFIG_PATH ?





 On Sun, Sep 30, 2012 at 3:30 AM, Nelle Varoquaux 
 nelle.varoqu...@gmail.com wrote:


 On 30 Sep 2012 06:11, Jouni K. Seppänen j...@iki.fi wrote:
 
  Rita rmorgan...@gmail.com writes:
 
   i have a micro distribution setup. I am building python, numpy, scipy
 from
   scratch. I am building matplotlib from scratch also.
  
   I am doing a simple, /apps/bin/python setup.py build.
  
   I also compiled libpng and cairo in a location.

 When you build a shared library yourself, you always need to set the
 variable LD_LIBRARY_PATH. This is independant from the compilation. At
 runtime, the program merely tries to load the library if it has not been
 loaded previously.

 Usually, to avoid setting manually the path to the library, one adds this
 to its bashrc/zshrc.

 I hope this helps.
 Cheers,
 N.

 
  Have you set up pkg-config for your build of libpng? If you can't do
  that for some reason, you can edit basedirlist in setup.cfg.
 
  --
  Jouni K. Seppänen
  http://www.iki.fi/jks
 
 
 
 --
  Everyone hates slow websites. So do we.
  Make your web apps faster with AppDynamics
  Download AppDynamics Lite for free today:
  http://ad.doubleclick.net/clk;258768047;13503038;j?
  http://info.appdynamics.com/FreeJavaPerformanceDownload.html
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
 Everyone hates slow websites. So do we.
 Make your web apps faster with AppDynamics
 Download AppDynamics Lite for free today:
 http://ad.doubleclick.net/clk;258768047;13503038;j?
 http://info.appdynamics.com/FreeJavaPerformanceDownload.html
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 --- Get your facts first, then you can distort them as you please.--




-- 
--- Get your facts first, then you can distort them as you please.--
--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Qt4/PySide memory leak

2012-10-01 Thread Christoph Gohlke

On 9/24/2012 5:50 PM, Christoph Gohlke wrote:

On 9/24/2012 3:32 PM, David Honcik wrote:

I've run into a large memory leak using Matplotlib with PySide and the
Qt4 back end.  I'm using :
Python 3.2
Numpy 1.6.2
Pyside 1.1.1 (qt474)
Matplotlib 1.2 (first the Capetown Group port to Python 3, then 1.2 RC2)
on Windows XP 32 bit
I've tried using the Python 2.7 branch of all of the above and don't see
the problem.  I don't see the problem with the Tk back end.  I don't see
the problem with the Qt4 back end and PyQt4.  Only with the above
mentioned versions and using the Qt4 back end with PySide.
The following script will reproduce the problem :

import matplotlib
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'
import pylab
arrayX = []
arrayY = []
for nIndex in range(0, 100):
arrayX.append(nIndex)
arrayY.append(nIndex)
Figure = matplotlib.pyplot.figure(1)
Axes = Figure.add_axes([ 0.05, 0.05, 0.95, 0.95])
Axes.plot(arrayX,
arrayY,
color  = blue,
marker = o,
markersize = 5.0)
Axes.set_xlim(arrayX[0], arrayX[len(arrayX) - 1])
Axes.set_ylim(arrayY[0], arrayY[len(arrayY) - 1])
matplotlib.pyplot.show()

I run the above, grab the lower right sizing handle on the plot window
and start resizing the window.  Watching the python process in task
manager, each resize leaks a noticeable amount of memory.  A few minutes
of this will get process memory up to ~2.5 GB. At that point it crashes.
I'm new here, am I in the right place?



I can reproduce this exactly, also with pyside 1.1.2 and an empty plot.
Looks like QtGui.QImage is leaking.

import matplotlib
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'
from matplotlib import pyplot
pyplot.plot()
pyplot.show()

--
Christoph




As a workaround, until PySide is fixed, use the attached patch, which 
forcibly decreases the reference count of the string buffer after use.


Christoph
diff --git a/lib/matplotlib/backends/backend_qt4agg.py 
b/lib/matplotlib/backends/backend_qt4agg.py
index 0701781..408f3ce 100644
--- a/lib/matplotlib/backends/backend_qt4agg.py
+++ b/lib/matplotlib/backends/backend_qt4agg.py
@@ -4,6 +4,7 @@ Render to qt from agg
 from __future__ import division, print_function
 
 import os, sys
+import ctypes
 
 import matplotlib
 from matplotlib.figure import Figure
@@ -15,6 +16,10 @@ from backend_qt4 import QtCore, QtGui, FigureManagerQT, 
FigureCanvasQT,\
 
 DEBUG = False
 
+decref = ctypes.pythonapi.Py_DecRef
+decref.argtypes = [ctypes.py_object]
+decref.restype = None
+
 
 def new_figure_manager( num, *args, **kwargs ):
 
@@ -95,6 +100,8 @@ class FigureCanvasQTAgg( FigureCanvasQT, FigureCanvasAgg ):
 else:
 stringBuffer = self.renderer._renderer.tostring_argb()
 
+refcnt = sys.getrefcount(stringBuffer)
+
 qImage = QtGui.QImage(stringBuffer, self.renderer.width,
   self.renderer.height,
   QtGui.QImage.Format_ARGB32)
@@ -106,6 +113,11 @@ class FigureCanvasQTAgg( FigureCanvasQT, FigureCanvasAgg ):
 p.setPen( QtGui.QPen( QtCore.Qt.black, 1, QtCore.Qt.DotLine ) )
 p.drawRect( self.rect[0], self.rect[1], self.rect[2], 
self.rect[3] )
 p.end()
+
+del qImage
+if refcnt != sys.getrefcount(stringBuffer):
+# Fix a memory leak in PySide on Python 3
+decref(stringBuffer)
 else:
 bbox = self.blitbox
 l, b, r, t = bbox.extents
--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users