SF.net SVN: matplotlib:[6646] trunk/toolkits/basemap

2008-12-17 Thread jswhit
Revision: 6646
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6646&view=rev
Author:   jswhit
Date: 2008-12-17 12:59:50 + (Wed, 17 Dec 2008)

Log Message:
---
look for data in BASEMAPDATA

Modified Paths:
--
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
trunk/toolkits/basemap/src/pj_open_lib.c

Added Paths:
---
trunk/toolkits/basemap/src/pj_open_lib.c.orig

Modified: trunk/toolkits/basemap/Changelog
===
--- trunk/toolkits/basemap/Changelog2008-12-17 12:54:24 UTC (rev 6645)
+++ trunk/toolkits/basemap/Changelog2008-12-17 12:59:50 UTC (rev 6646)
@@ -1,4 +1,7 @@
 version 0.99.3 (not yet released)
+   * Basemap will now look for it's data in BASEMAPDATA.
+ If that env var not set, it will fall back to it's 
+ default location.
* if readshapefile is called with drawbounds=True, a
  LineCollection object is appended to the returned tuple.
* make sure drawmapscale method returns a list of objects that

Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-17 
12:54:24 UTC (rev 6645)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-17 
12:59:50 UTC (rev 6646)
@@ -39,7 +39,14 @@
 import _geoslib, netcdftime
 
 # basemap data files now installed in lib/matplotlib/toolkits/basemap/data
-basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data'])
+# check to see if environment variable BASEMAPDATA set to a directory,
+# and if so look for the data there.
+if 'BASEMAPDATA' in os.environ:
+basemap_datadir = os.environ['BASEMAPDATA']
+if not os.path.isdir(basemap_datadir):
+raise RuntimeError('Path in environment BASEMAPDATA not a directory')
+else:
+basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data'])
 
 __version__ = '0.99.3'
 

Modified: trunk/toolkits/basemap/src/pj_open_lib.c
===
--- trunk/toolkits/basemap/src/pj_open_lib.c2008-12-17 12:54:24 UTC (rev 
6645)
+++ trunk/toolkits/basemap/src/pj_open_lib.c2008-12-17 12:59:50 UTC (rev 
6646)
@@ -60,8 +60,8 @@
 static int path_count = 0;
 static char **search_path = NULL;
 static char * proj_lib_name =
-#ifdef PROJ_LIB
-PROJ_LIB;
+#ifdef BASEMAPDATA
+BASEMAPDATA;
 #else
 0;
 #endif
@@ -153,8 +153,8 @@
 else if( pj_finder != NULL && pj_finder( name ) != NULL )
 sysname = pj_finder( name );
 
-/* or is environment PROJ_LIB defined */
-else if ((sysname = getenv("PROJ_LIB")) || (sysname = proj_lib_name)) {
+/* or is environment BASEMAPDATA defined */
+else if ((sysname = getenv("BASEMAPDATA")) || (sysname = proj_lib_name)) {
 (void)strcpy(fname, sysname);
 fname[n = strlen(fname)] = DIR_CHAR;
 fname[++n] = '\0';

Added: trunk/toolkits/basemap/src/pj_open_lib.c.orig
===
--- trunk/toolkits/basemap/src/pj_open_lib.c.orig   
(rev 0)
+++ trunk/toolkits/basemap/src/pj_open_lib.c.orig   2008-12-17 12:59:50 UTC 
(rev 6646)
@@ -0,0 +1,191 @@
+/**
+ * $Id: pj_open_lib.c,v 1.9 2007/07/06 14:58:03 fwarmerdam Exp $
+ *
+ * Project:  PROJ.4
+ * Purpose:  Implementation of pj_open_lib(), and pj_set_finder().  These
+ *   provide a standard interface for opening projections support
+ *   data files.
+ * Author:   Gerald Evenden, Frank Warmerdam 
+ *
+ **
+ * Copyright (c) 1995, Gerald Evenden
+ * Copyright (c) 2002, Frank Warmerdam 
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH TH

SF.net SVN: matplotlib:[6653] trunk/toolkits/basemap/README

2008-12-17 Thread jswhit
Revision: 6653
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6653&view=rev
Author:   jswhit
Date: 2008-12-17 19:06:30 + (Wed, 17 Dec 2008)

Log Message:
---
updated install instructions

Modified Paths:
--
trunk/toolkits/basemap/README

Modified: trunk/toolkits/basemap/README
===
--- trunk/toolkits/basemap/README   2008-12-17 16:52:39 UTC (rev 6652)
+++ trunk/toolkits/basemap/README   2008-12-17 19:06:30 UTC (rev 6653)
@@ -71,7 +71,16 @@
 
 1) Then download basemap-X.Y.Z.tar.gz (approx 100 mb) from
 the sourceforge download site, unpack and cd to basemap-X.Y.Z.
+Note that most of that size consists of coastline data, which 
+does not change with every release.  When it does change, it is
+noted in the Changelog.  If you already have the latest data installed, 
+you can download basemap-nodata-X.Y.Z.tar.gz instead, which is
+*much* smaller.
 
+By default the data is installed in the same directory as the toolkit. 
+You may move it if you wish, and set the environment variable
+BASEMAPDATA to point to the new location.
+
 2) Install the GEOS library.  If you already have it on your
 system, just set the environment variable GEOS_DIR to point to the location 
 of libgeos_c and geos_c.h (if libgeos_c is in /usr/local/lib and


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6645] trunk/matplotlib

2008-12-17 Thread jdh2358
Revision: 6645
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6645&view=rev
Author:   jdh2358
Date: 2008-12-17 12:54:24 + (Wed, 17 Dec 2008)

Log Message:
---
Merged revisions 6644 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint


  r6644 | jdh2358 | 2008-12-17 06:51:22 -0600 (Wed, 17 Dec 2008) | 1 line
  
  added Jouni's pdf image dpi patch; apply fix to figimage


Modified Paths:
--
trunk/matplotlib/examples/pylab_examples/figimage_demo.py
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
trunk/matplotlib/lib/matplotlib/figure.py
trunk/matplotlib/lib/matplotlib/image.py

Property Changed:

trunk/matplotlib/


Property changes on: trunk/matplotlib
___
Modified: svnmerge-integrated
   - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6640
   + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6644

Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py
===
--- trunk/matplotlib/examples/pylab_examples/figimage_demo.py   2008-12-17 
12:51:22 UTC (rev 6644)
+++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py   2008-12-17 
12:54:24 UTC (rev 6645)
@@ -15,6 +15,11 @@
 im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower')
 im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower')
 
+dpi = 200
+plt.savefig('figimage.png', dpi=dpi)
+plt.savefig('figimage.pdf', dpi=dpi)
+plt.savefig('figimage.svg', dpi=dpi)
+plt.savefig('figimage.eps', dpi=dpi)
 plt.show()
 
 

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-17 
12:51:22 UTC (rev 6644)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-12-17 
12:54:24 UTC (rev 6645)
@@ -1184,13 +1184,14 @@
 truetype_font_cache = maxdict(50)
 afm_font_cache = maxdict(50)
 
-def __init__(self, file, dpi):
+def __init__(self, file, dpi, image_dpi):
 RendererBase.__init__(self)
 self.file = file
 self.gc = self.new_gc()
 self.file.used_characters = self.used_characters = {}
 self.mathtext_parser = MathTextParser("Pdf")
 self.dpi = dpi
+self.image_dpi = image_dpi
 self.tex_font_map = None
 
 def finalize(self):
@@ -1230,9 +1231,10 @@
 stat_key, (realpath, set()))
 used_characters[1].update(charset)
 
+def get_image_magnification(self):
+return self.image_dpi/72.0
+
 def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
-#print >>sys.stderr, "draw_image called"
-
 # MGDTODO: Support clippath here
 gc = self.new_gc()
 if bbox is not None:
@@ -1240,6 +1242,7 @@
 self.check_gc(gc)
 
 h, w = im.get_size_out()
+h, w = 72.0*h/self.image_dpi, 72.0*w/self.image_dpi
 imob = self.file.imageObject(im)
 self.file.output(Op.gsave, w, 0, 0, h, x, y, Op.concat_matrix,
  imob, Op.use_xobject, Op.grestore)
@@ -1873,13 +1876,13 @@
 return 'pdf'
 
 def print_pdf(self, filename, **kwargs):
-dpi = 72 # there are 72 Postscript points to an inch
-# TODO: use the dpi kwarg for images
-self.figure.set_dpi(dpi)
+ppi = 72 # Postscript points in an inch
+image_dpi = kwargs.get('dpi', 72) # dpi to use for images
+self.figure.set_dpi(ppi)
 width, height = self.figure.get_size_inches()
-file = PdfFile(width, height, dpi, filename)
+file = PdfFile(width, height, ppi, filename)
 renderer = MixedModeRenderer(
-width, height, dpi, RendererPdf(file, dpi))
+width, height, ppi, RendererPdf(file, ppi, image_dpi))
 self.figure.draw(renderer)
 renderer.finalize()
 file.close()

Modified: trunk/matplotlib/lib/matplotlib/figure.py
===
--- trunk/matplotlib/lib/matplotlib/figure.py   2008-12-17 12:51:22 UTC (rev 
6644)
+++ trunk/matplotlib/lib/matplotlib/figure.py   2008-12-17 12:54:24 UTC (rev 
6645)
@@ -755,7 +755,7 @@
 # make a composite image blending alpha
 # list of (_image.Image, ox, oy)
 mag = renderer.get_image_magnification()
-ims = [(im.make_image(mag), im.ox*mag, im.oy*mag)
+ims = [(im.make_image(mag), im.ox, im.oy)
for im in self.images]
 
 im = _image.from_images(self.bbox.height * mag,

Modified: trunk/matplotlib/lib/matplotlib/image.py
===
--- trunk/matplotlib/lib/matplotlib/image.py2008-12-17 12

SF.net SVN: matplotlib:[6643] trunk/matplotlib/lib/matplotlib/backends/ backend_gtk.py

2008-12-17 Thread jdh2358
Revision: 6643
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6643&view=rev
Author:   jdh2358
Date: 2008-12-17 11:20:35 + (Wed, 17 Dec 2008)

Log Message:
---
added per window icon from sf patch 2412313

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-17 
07:32:18 UTC (rev 6642)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-17 
11:20:35 UTC (rev 6643)
@@ -439,6 +439,8 @@
 
 self.window = gtk.Window()
 self.window.set_title("Figure %d" % num)
+if (window_icon):
+self.window.set_icon_from_file(window_icon)
 
 self.vbox = gtk.VBox()
 self.window.add(self.vbox)
@@ -694,6 +696,8 @@
 
 
 window = gtk.Window()
+if (window_icon):
+window.set_icon_from_file(window_icon)
 window.set_title("Subplot Configuration Tool")
 window.set_default_size(w, h)
 vbox = gtk.VBox()
@@ -1260,9 +1264,9 @@
 icon_filename = 'matplotlib.png'
 else:
 icon_filename = 'matplotlib.svg'
-gtk.window_set_default_icon_from_file (
-os.path.join (matplotlib.rcParams['datapath'], 'images', 
icon_filename))
+window_icon = os.path.join(matplotlib.rcParams['datapath'], 'images', 
icon_filename)
 except:
+window_icon = None
 verbose.report('Could not load matplotlib icon: %s' % sys.exc_info()[1])
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6649] trunk/matplotlib

2008-12-17 Thread jdh2358
Revision: 6649
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6649&view=rev
Author:   jdh2358
Date: 2008-12-17 14:58:42 + (Wed, 17 Dec 2008)

Log Message:
---
Merged revisions 6647 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint


  r6647 | jdh2358 | 2008-12-17 08:55:42 -0600 (Wed, 17 Dec 2008) | 1 line
  
  fix to figimage


Modified Paths:
--
trunk/matplotlib/examples/pylab_examples/figimage_demo.py
trunk/matplotlib/lib/matplotlib/image.py

Property Changed:

trunk/matplotlib/


Property changes on: trunk/matplotlib
___
Modified: svnmerge-integrated
   - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6644
   + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6648

Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py
===
--- trunk/matplotlib/examples/pylab_examples/figimage_demo.py   2008-12-17 
14:57:28 UTC (rev 6648)
+++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py   2008-12-17 
14:58:42 UTC (rev 6649)
@@ -7,7 +7,7 @@
 import matplotlib.pyplot as plt
 
 
-fig = plt.figure(frameon=False)
+fig = plt.figure()
 Z = np.arange(1.0)
 Z.shape = 100,100
 Z[:,50:] = 1.
@@ -15,11 +15,13 @@
 im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower')
 im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower')
 
-dpi = 200
-plt.savefig('figimage.png', dpi=dpi)
-plt.savefig('figimage.pdf', dpi=dpi)
-plt.savefig('figimage.svg', dpi=dpi)
-plt.savefig('figimage.eps', dpi=dpi)
+
+if 0:
+dpi = 72
+plt.savefig('figimage_%d.png'%dpi, dpi=dpi, facecolor='gray')
+plt.savefig('figimage_%d.pdf'%dpi, dpi=dpi, facecolor='gray')
+plt.savefig('figimage_%d.svg'%dpi, dpi=dpi, facecolor='gray')
+plt.savefig('figimage_%d.eps'%dpi, dpi=dpi, facecolor='gray')
 plt.show()
 
 

Modified: trunk/matplotlib/lib/matplotlib/image.py
===
--- trunk/matplotlib/lib/matplotlib/image.py2008-12-17 14:57:28 UTC (rev 
6648)
+++ trunk/matplotlib/lib/matplotlib/image.py2008-12-17 14:58:42 UTC (rev 
6649)
@@ -693,7 +693,7 @@
 if not self.get_visible(): return
 # todo: we should be able to do some cacheing here
 im = self.make_image(renderer.get_image_magnification())
-renderer.draw_image(round(self.ox/self.magnification), 
round(self.oy/self.magnification), im, self.figure.bbox,
+renderer.draw_image(round(self.ox), round(self.oy), im, 
self.figure.bbox,
 *self.get_transformed_clip_path_and_affine())
 
 def write_png(self, fname):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6651] trunk/matplotlib

2008-12-17 Thread jdh2358
Revision: 6651
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6651&view=rev
Author:   jdh2358
Date: 2008-12-17 16:00:44 + (Wed, 17 Dec 2008)

Log Message:
---
Merged revisions 6650 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint


  r6650 | jdh2358 | 2008-12-17 07:59:31 -0800 (Wed, 17 Dec 2008) | 1 line
  
  added piwik analytics javascript tag to header


Modified Paths:
--
trunk/matplotlib/doc/_templates/layout.html

Property Changed:

trunk/matplotlib/


Property changes on: trunk/matplotlib
___
Modified: svnmerge-integrated
   - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6648
   + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6650

Modified: trunk/matplotlib/doc/_templates/layout.html
===
--- trunk/matplotlib/doc/_templates/layout.html 2008-12-17 15:59:31 UTC (rev 
6650)
+++ trunk/matplotlib/doc/_templates/layout.html 2008-12-17 16:00:44 UTC (rev 
6651)
@@ -1,5 +1,6 @@
 {% extends "!layout.html" %}
 
+
 {% block rootrellink %}
 matplotlib home| 
 search| 
@@ -9,6 +10,20 @@
 
 
 {% block relbar1 %}
+
+
+var pkBaseURL = (("https:" == document.location.protocol) ? 
"https://apps.sourceforge.net/piwik/matplotlib/"; : 
"http://apps.sourceforge.net/piwik/matplotlib/";);
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' 
type='text/javascript'%3E%3C/script%3E"));
+
+piwik_action_name = '';
+piwik_idsite = 1;
+piwik_url = pkBaseURL + "piwik.php";
+piwik_log(piwik_action_name, piwik_idsite, piwik_url);
+
+http://apps.sourceforge.net/piwik/matplotlib/piwik.php?idsite=1"; 
alt="piwik"/>
+
+
+
 
 
@@ -20,5 +35,3 @@
 {% block sidebar1 %}{{ sidebar() }}{% endblock %}
 {% block sidebar2 %}{% endblock %}
 
-
-


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6648] trunk/matplotlib/lib/matplotlib/mlab.py

2008-12-17 Thread jdh2358
Revision: 6648
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6648&view=rev
Author:   jdh2358
Date: 2008-12-17 14:57:28 + (Wed, 17 Dec 2008)

Log Message:
---
added some threshold crossing helper funcs to mlab

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/mlab.py

Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-12-17 14:55:42 UTC (rev 
6647)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-12-17 14:57:28 UTC (rev 
6648)
@@ -54,6 +54,16 @@
 yourself stranded without scipy (and the far superior
 scipy.integrate tools)
 
+:meth:`contiguous_regions`
+return the indices of the regions spanned by some logical mask
+
+:meth:`cross_from_below`
+return the indices where a 1D array crosses a threshold from below
+
+:meth:`cross_from_above`
+return the indices where a 1D array crosses a threshold from above
+
+
 record array helper functions
 ---
 
@@ -3236,6 +3246,63 @@
 boundaries.append((in_region, i+1))
 return boundaries
 
+
+def cross_from_below(x, threshold):
+"""
+return the indices into *x* where *x* crosses some threshold from
+below, eg the i's where::
+
+  x[i-1]=threshold
+
+Example code::
+
+import matplotlib.pyplot as plt
+
+t = np.arange(0.0, 2.0, 0.1)
+s = np.sin(2*np.pi*t)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.plot(t, s, '-o')
+ax.axhline(0.5)
+ax.axhline(-0.5)
+
+ind = cross_from_below(s, 0.5)
+ax.vlines(t[ind], -1, 1)
+
+ind = cross_from_above(s, -0.5)
+ax.vlines(t[ind], -1, 1)
+
+plt.show()
+
+.. seealso::
+
+:func:`cross_from_above` and :func:`contiguous_regions`
+
+"""
+x = np.asarray(x)
+threshold = threshold
+ind = np.nonzero( (x[:-1]=threshold))[0]
+if len(ind): return ind+1
+else: return ind
+
+def cross_from_above(x, threshold):
+"""
+return the indices into *x* where *x* crosses some threshold from
+below, eg the i's where::
+
+  x[i-1]>threshold and x[i]<=threshold
+
+.. seealso::
+
+:func:`cross_from_below` and :func:`contiguous_regions`
+
+"""
+x = np.asarray(x)
+ind = np.nonzero( (x[:-1]>=threshold) & (x[1:]http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6644] branches/v0_98_5_maint

2008-12-17 Thread jdh2358
Revision: 6644
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6644&view=rev
Author:   jdh2358
Date: 2008-12-17 12:51:22 + (Wed, 17 Dec 2008)

Log Message:
---
added Jouni's pdf image dpi patch; apply fix to figimage

Modified Paths:
--
branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py
branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
branches/v0_98_5_maint/lib/matplotlib/figure.py
branches/v0_98_5_maint/lib/matplotlib/image.py

Modified: branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py
===
--- branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py 
2008-12-17 11:20:35 UTC (rev 6643)
+++ branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py 
2008-12-17 12:51:22 UTC (rev 6644)
@@ -15,6 +15,11 @@
 im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower')
 im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower')
 
+dpi = 200
+plt.savefig('figimage.png', dpi=dpi)
+plt.savefig('figimage.pdf', dpi=dpi)
+plt.savefig('figimage.svg', dpi=dpi)
+plt.savefig('figimage.eps', dpi=dpi)
 plt.show()
 
 

Modified: branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py
===
--- branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py   
2008-12-17 11:20:35 UTC (rev 6643)
+++ branches/v0_98_5_maint/lib/matplotlib/backends/backend_pdf.py   
2008-12-17 12:51:22 UTC (rev 6644)
@@ -1184,13 +1184,14 @@
 truetype_font_cache = maxdict(50)
 afm_font_cache = maxdict(50)
 
-def __init__(self, file, dpi):
+def __init__(self, file, dpi, image_dpi):
 RendererBase.__init__(self)
 self.file = file
 self.gc = self.new_gc()
 self.file.used_characters = self.used_characters = {}
 self.mathtext_parser = MathTextParser("Pdf")
 self.dpi = dpi
+self.image_dpi = image_dpi
 self.tex_font_map = None
 
 def finalize(self):
@@ -1230,9 +1231,10 @@
 stat_key, (realpath, set()))
 used_characters[1].update(charset)
 
+def get_image_magnification(self):
+return self.image_dpi/72.0
+
 def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
-#print >>sys.stderr, "draw_image called"
-
 # MGDTODO: Support clippath here
 gc = self.new_gc()
 if bbox is not None:
@@ -1240,6 +1242,7 @@
 self.check_gc(gc)
 
 h, w = im.get_size_out()
+h, w = 72.0*h/self.image_dpi, 72.0*w/self.image_dpi
 imob = self.file.imageObject(im)
 self.file.output(Op.gsave, w, 0, 0, h, x, y, Op.concat_matrix,
  imob, Op.use_xobject, Op.grestore)
@@ -1873,13 +1876,13 @@
 return 'pdf'
 
 def print_pdf(self, filename, **kwargs):
-dpi = 72 # there are 72 Postscript points to an inch
-# TODO: use the dpi kwarg for images
-self.figure.set_dpi(dpi)
+ppi = 72 # Postscript points in an inch
+image_dpi = kwargs.get('dpi', 72) # dpi to use for images
+self.figure.set_dpi(ppi)
 width, height = self.figure.get_size_inches()
-file = PdfFile(width, height, dpi, filename)
+file = PdfFile(width, height, ppi, filename)
 renderer = MixedModeRenderer(
-width, height, dpi, RendererPdf(file, dpi))
+width, height, ppi, RendererPdf(file, ppi, image_dpi))
 self.figure.draw(renderer)
 renderer.finalize()
 file.close()

Modified: branches/v0_98_5_maint/lib/matplotlib/figure.py
===
--- branches/v0_98_5_maint/lib/matplotlib/figure.py 2008-12-17 11:20:35 UTC 
(rev 6643)
+++ branches/v0_98_5_maint/lib/matplotlib/figure.py 2008-12-17 12:51:22 UTC 
(rev 6644)
@@ -755,7 +755,7 @@
 # make a composite image blending alpha
 # list of (_image.Image, ox, oy)
 mag = renderer.get_image_magnification()
-ims = [(im.make_image(mag), im.ox*mag, im.oy*mag)
+ims = [(im.make_image(mag), im.ox, im.oy)
for im in self.images]
 
 im = _image.from_images(self.bbox.height * mag,

Modified: branches/v0_98_5_maint/lib/matplotlib/image.py
===
--- branches/v0_98_5_maint/lib/matplotlib/image.py  2008-12-17 11:20:35 UTC 
(rev 6643)
+++ branches/v0_98_5_maint/lib/matplotlib/image.py  2008-12-17 12:51:22 UTC 
(rev 6644)
@@ -630,6 +630,7 @@
 self.ox = offsetx
 self.oy = offsety
 self.update(kwargs)
+self.magnification = 1.0
 
 def contains(self, mouseevent):
 """Test whether the mouse event occured within the image.
@@ -659,22 +660,30 @@
 -0.5+self.oy, numrows-0.5+self.oy)
 
 def

SF.net SVN: matplotlib:[6650] branches/v0_98_5_maint/doc/_templates/layout. html

2008-12-17 Thread jdh2358
Revision: 6650
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6650&view=rev
Author:   jdh2358
Date: 2008-12-17 15:59:31 + (Wed, 17 Dec 2008)

Log Message:
---
added piwik analytics javascript tag to header

Modified Paths:
--
branches/v0_98_5_maint/doc/_templates/layout.html

Modified: branches/v0_98_5_maint/doc/_templates/layout.html
===
--- branches/v0_98_5_maint/doc/_templates/layout.html   2008-12-17 14:58:42 UTC 
(rev 6649)
+++ branches/v0_98_5_maint/doc/_templates/layout.html   2008-12-17 15:59:31 UTC 
(rev 6650)
@@ -1,5 +1,6 @@
 {% extends "!layout.html" %}
 
+
 {% block rootrellink %}
 matplotlib home| 
 search| 
@@ -9,6 +10,20 @@
 
 
 {% block relbar1 %}
+
+
+var pkBaseURL = (("https:" == document.location.protocol) ? 
"https://apps.sourceforge.net/piwik/matplotlib/"; : 
"http://apps.sourceforge.net/piwik/matplotlib/";);
+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' 
type='text/javascript'%3E%3C/script%3E"));
+
+piwik_action_name = '';
+piwik_idsite = 1;
+piwik_url = pkBaseURL + "piwik.php";
+piwik_log(piwik_action_name, piwik_idsite, piwik_url);
+
+http://apps.sourceforge.net/piwik/matplotlib/piwik.php?idsite=1"; 
alt="piwik"/>
+
+
+
 
 
@@ -20,5 +35,3 @@
 {% block sidebar1 %}{{ sidebar() }}{% endblock %}
 {% block sidebar2 %}{% endblock %}
 
-
-


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6647] branches/v0_98_5_maint

2008-12-17 Thread jdh2358
Revision: 6647
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6647&view=rev
Author:   jdh2358
Date: 2008-12-17 14:55:42 + (Wed, 17 Dec 2008)

Log Message:
---
fix to figimage

Modified Paths:
--
branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py
branches/v0_98_5_maint/lib/matplotlib/image.py

Modified: branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py
===
--- branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py 
2008-12-17 12:59:50 UTC (rev 6646)
+++ branches/v0_98_5_maint/examples/pylab_examples/figimage_demo.py 
2008-12-17 14:55:42 UTC (rev 6647)
@@ -7,7 +7,7 @@
 import matplotlib.pyplot as plt
 
 
-fig = plt.figure(frameon=False)
+fig = plt.figure()
 Z = np.arange(1.0)
 Z.shape = 100,100
 Z[:,50:] = 1.
@@ -15,11 +15,13 @@
 im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower')
 im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower')
 
-dpi = 200
-plt.savefig('figimage.png', dpi=dpi)
-plt.savefig('figimage.pdf', dpi=dpi)
-plt.savefig('figimage.svg', dpi=dpi)
-plt.savefig('figimage.eps', dpi=dpi)
+
+if 0:
+dpi = 72
+plt.savefig('figimage_%d.png'%dpi, dpi=dpi, facecolor='gray')
+plt.savefig('figimage_%d.pdf'%dpi, dpi=dpi, facecolor='gray')
+plt.savefig('figimage_%d.svg'%dpi, dpi=dpi, facecolor='gray')
+plt.savefig('figimage_%d.eps'%dpi, dpi=dpi, facecolor='gray')
 plt.show()
 
 

Modified: branches/v0_98_5_maint/lib/matplotlib/image.py
===
--- branches/v0_98_5_maint/lib/matplotlib/image.py  2008-12-17 12:59:50 UTC 
(rev 6646)
+++ branches/v0_98_5_maint/lib/matplotlib/image.py  2008-12-17 14:55:42 UTC 
(rev 6647)
@@ -693,7 +693,7 @@
 if not self.get_visible(): return
 # todo: we should be able to do some cacheing here
 im = self.make_image(renderer.get_image_magnification())
-renderer.draw_image(round(self.ox/self.magnification), 
round(self.oy/self.magnification), im, self.figure.bbox,
+renderer.draw_image(round(self.ox), round(self.oy), im, 
self.figure.bbox,
 *self.get_transformed_clip_path_and_affine())
 
 def write_png(self, fname):


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6655] trunk/matplotlib/doc/make.py

2008-12-17 Thread dsdale
Revision: 6655
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6655&view=rev
Author:   dsdale
Date: 2008-12-17 21:48:26 + (Wed, 17 Dec 2008)

Log Message:
---
fixed a bug in doc/make.py, small_docs was not defined when make.py was 
run without options

Modified Paths:
--
trunk/matplotlib/doc/make.py

Modified: trunk/matplotlib/doc/make.py
===
--- trunk/matplotlib/doc/make.py2008-12-17 21:15:30 UTC (rev 6654)
+++ trunk/matplotlib/doc/make.py2008-12-17 21:48:26 UTC (rev 6655)
@@ -95,12 +95,12 @@
 }
 
 
+small_docs = False
+
 if len(sys.argv)>1:
 if '--small' in sys.argv[1:]:
 small_docs = True
 sys.argv.remove('--small')
-else:
-small_docs = False
 for arg in sys.argv[1:]:
 func = funcd.get(arg)
 if func is None:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[6657] trunk/toolkits/basemap/lib/mpl_toolkits/ basemap/__init__.py

2008-12-17 Thread jswhit
Revision: 6657
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6657&view=rev
Author:   jswhit
Date: 2008-12-17 23:37:18 + (Wed, 17 Dec 2008)

Log Message:
---
fix docstring typo

Modified Paths:
--
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py

Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-17 
23:00:03 UTC (rev 6656)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-12-17 
23:37:18 UTC (rev 6657)
@@ -322,11 +322,11 @@
   (size of y dimension / size of x dimension).
  llcrnrlonlongitude of lower left hand corner of the
   selected map domain.
- llcrnrlonlatitude of lower left hand corner of the 
+ llcrnrlatlatitude of lower left hand corner of the 
   selected map domain.
  urcrnrlonlongitude of upper right hand corner of the
   selected map domain.
- urcrnrlonlatitude of upper right hand corner of the
+ urcrnrlatlatitude of upper right hand corner of the
   selected map domain.
  llcrnrx  x value of lower left hand corner of the
   selected map domain in map projection coordinates.


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins