Re: [matplotlib-devel] setupext.py chooses tk on mac OS X incorrectly

2009-02-07 Thread John Hunter
On Wed, Feb 4, 2009 at 5:08 PM, Jayson Barr  wrote:

> 4).  I don't mind helping write the patch.  I am only worried about
> not knowing the intricacies of all the random supported platforms that
> you all look out for.  For example: I know jack about Windows linking.
>  Either way, I'll update it if you have someone look at it.  I'll work
> on it sometimes this week when I'm not too busy at work and send it
> in.


The problem is that the code is already messy, and Adam describes his
solution as messy, and it is difficult if not impossible to get people
to test on all the required platforms.  I can test on OS X w/o
macports and a linux box, Charlie would probably be able to test on
win32, and Adam can test on macports.  Perhaps you and Adam can
collaborate on a patch and we'll see if we can get it properly tested.
 There are lots of tcl/tk combinations out there on different
platforms, so it is a trick issue.

JDH

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] imsave function

2009-02-07 Thread Gary Ruben

Hi,

I've attached a patch against the mpl head in response to John's 
suggestion and helpful pointers on the users list. This adds a new 
function imsave to complement imread in the image module. I've also 
exposed it in the pyplot interface.
If this is presumptuous, feel free to remove it from the patch or ask me 
to remove it. This is my first contribution to matplotlib for a while 
and my first attempt at a patch like this.


Because I don't build matplotlib from source, I've done what testing I 
can without fully rebuilding matplotlib. I'd be reluctant to have this 
patch applied without someone else checking it first. It's pretty simple 
so applying it locally and running the demo file should be a good enough 
test.


thanks,
Gary Ruben
Index: matplotlib/CHANGELOG
===
--- matplotlib/CHANGELOG(revision 6889)
+++ matplotlib/CHANGELOG(working copy)
@@ -1,3 +1,6 @@
+2009-02-08 Added a new imsave function to image.py and exposed it in
+   the pyplot interface - GR
+
 2009-02-04 Some reorgnization of the legend code. anchored_text.py
added as an example. - JJL
 
Index: matplotlib/doc/_templates/index.html
===
--- matplotlib/doc/_templates/index.html(revision 6889)
+++ matplotlib/doc/_templates/index.html(working copy)
@@ -567,6 +567,17 @@
 
 
   
+imsave
+
+  
+
+  
+save array as an image file
+  
+
+
+
+  
 imshow
 
   
Index: matplotlib/doc/api/api_changes.rst
===
--- matplotlib/doc/api/api_changes.rst  (revision 6889)
+++ matplotlib/doc/api/api_changes.rst  (working copy)
@@ -19,6 +19,9 @@
 
 Changes for 0.98.x
 ==
+* Added new :func:`matplotlib.image.imsave` and exposed it to the
+  :mod:`matplotlib.pyplot` interface.
+
 * Remove support for pyExcelerator in exceltools -- use xlwt
   instead 
 
Index: matplotlib/lib/matplotlib/pyplot.py
===
--- matplotlib/lib/matplotlib/pyplot.py (revision 6889)
+++ matplotlib/lib/matplotlib/pyplot.py (working copy)
@@ -6,6 +6,7 @@
 from matplotlib.figure import Figure, figaspect
 from matplotlib.backend_bases import FigureCanvasBase
 from matplotlib.image import imread as _imread
+from matplotlib.image import imsave as _imsave
 from matplotlib import rcParams, rcParamsDefault, get_backend
 from matplotlib.rcsetup import interactive_bk as _interactive_bk
 from matplotlib.artist import getp, get, Artist
@@ -1181,6 +1182,7 @@
 legend  add a legend to the axes
 loglog  a log log plot
 imread  load image file into array
+imsave  save array as an image file
 imshow  plot image data
 matshow display a matrix in a new figure preserving aspect
 pcolor  make a pseudocolor plot
@@ -1230,7 +1232,7 @@
 def get_plot_commands(): return ( 'axes', 'axis', 'bar', 'boxplot', 'cla', 
'clf',
 'close', 'colorbar', 'cohere', 'csd', 'draw', 'errorbar',
 'figlegend', 'figtext', 'figimage', 'figure', 'fill', 'gca',
-'gcf', 'gci', 'get', 'gray', 'barh', 'jet', 'hist', 'hold', 'imread',
+'gcf', 'gci', 'get', 'gray', 'barh', 'jet', 'hist', 'hold', 'imread', 
'imsave',
 'imshow', 'legend', 'loglog', 'quiver', 'rc', 'pcolor', 'pcolormesh', 
'plot', 'psd',
 'savefig', 'scatter', 'set', 'semilogx', 'semilogy', 'show',
 'specgram', 'stem', 'subplot', 'table', 'text', 'title', 'xlabel',
@@ -1370,6 +1372,11 @@
 if _imread.__doc__ is not None:
 imread.__doc__ = dedent(_imread.__doc__)
 
+def imsave(*args, **kwargs):
+return _imsave(*args, **kwargs)
+if _imsave.__doc__ is not None:
+imsave.__doc__ = dedent(_imsave.__doc__)
+
 def matshow(A, fignum=None, **kw):
 """
 Display an array as a matrix in a new figure window.
Index: matplotlib/lib/matplotlib/pylab.py
===
--- matplotlib/lib/matplotlib/pylab.py  (revision 6889)
+++ matplotlib/lib/matplotlib/pylab.py  (working copy)
@@ -50,6 +50,7 @@
   ion  - turn interaction mode on
   isinteractive - return True if interaction mode is on
   imread   - load image file into array
+  imsave   - save array as an image file
   imshow   - plot image data
   ishold   - return the hold state of the current axes
   legend   - make an axes legend
Index: matplotlib/lib/matplotlib/image.py
===
--- matplotlib/lib/matplotlib/image.py  (revision 6889)
+++ matplotlib/lib/matplotlib/image.py  (working copy)
@@ -747,7 +747,49 @@
 return handler(fname)
 
 
+def imsave(fname, arr, clims=None, cmap=None, format=None, origin=None):
+"""
+Saves a 2D :class:`numpy.array` as an image with one pixel per element.
+The output formats

Re: [matplotlib-devel] imsave function

2009-02-07 Thread Andrew Straw
Hi Gary, I have a couple comments:

1) No need for:

+ax = fig.add_subplot(111)
+ax.set_axis_off()

2) It's probably best to have maximum compatibility with imshow().
Therefore, use vmin=None and vmax=None as keyword arguments (rather than
clims).

Otherwise, I tested and it works for me.

-Andrew

Gary Ruben wrote:
> Hi,
> 
> I've attached a patch against the mpl head in response to John's
> suggestion and helpful pointers on the users list. This adds a new
> function imsave to complement imread in the image module. I've also
> exposed it in the pyplot interface.
> If this is presumptuous, feel free to remove it from the patch or ask me
> to remove it. This is my first contribution to matplotlib for a while
> and my first attempt at a patch like this.
> 
> Because I don't build matplotlib from source, I've done what testing I
> can without fully rebuilding matplotlib. I'd be reluctant to have this
> patch applied without someone else checking it first. It's pretty simple
> so applying it locally and running the demo file should be a good enough
> test.
> 
> thanks,
> Gary Ruben
> 
> 
> 
> 
> --
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> 
> 
> 
> 
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel