SF.net SVN: matplotlib: [4954] trunk/matplotlib/lib/matplotlib

2008-02-12 Thread efiring
Revision: 4954
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4954&view=rev
Author:   efiring
Date: 2008-02-12 17:30:03 -0800 (Tue, 12 Feb 2008)

Log Message:
---
Make colorbar work regardless of "hold" state

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/figure.py

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-02-12 14:10:41 UTC (rev 
4953)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-02-13 01:30:03 UTC (rev 
4954)
@@ -748,7 +748,6 @@
 
 def cla(self):
 'Clear the current axes'
-
 self.xaxis.cla()
 self.yaxis.cla()
 

Modified: trunk/matplotlib/lib/matplotlib/figure.py
===
--- trunk/matplotlib/lib/matplotlib/figure.py   2008-02-12 14:10:41 UTC (rev 
4953)
+++ trunk/matplotlib/lib/matplotlib/figure.py   2008-02-13 01:30:03 UTC (rev 
4954)
@@ -98,8 +98,8 @@
 
 
 class BlockingMouseInput(object):
-""" Class that creates a callable object to retrieve mouse clicks in a 
-blocking way. 
+""" Class that creates a callable object to retrieve mouse clicks in a
+blocking way.
 """
 def __init__(self, fig):
 self.fig = fig
@@ -123,8 +123,8 @@
 elif event.inaxes:
 # If it's a valid click, append the coordinates to the list
 self.clicks.append((event.xdata, event.ydata))
-if self.verbose: 
-print "input %i: %f,%f" % (len(self.clicks), 
+if self.verbose:
+print "input %i: %f,%f" % (len(self.clicks),
 event.xdata, event.ydata)
 if self.show_clicks:
 self.marks.extend(
@@ -135,7 +135,7 @@
 
 
 def __call__(self, n=1, timeout=30, verbose=False, show_clicks=True):
-""" Blocking call to retrieve n coordinate pairs through mouse 
+""" Blocking call to retrieve n coordinate pairs through mouse
 clicks.
 """
 self.verbose = verbose
@@ -147,10 +147,10 @@
 assert isinstance(n, int), "Requires an integer argument"
 self.n = n
 
-# Ensure that the figure is shown 
+# Ensure that the figure is shown
 self.fig.show()
 # connect the click events to the on_click function call
-self.callback = self.fig.canvas.mpl_connect('button_press_event', 
+self.callback = self.fig.canvas.mpl_connect('button_press_event',
 self.on_click)
 # wait for n clicks
 counter = 0
@@ -160,8 +160,8 @@
 
 # check for a timeout
 counter += 1
-if timeout > 0 and counter > timeout/0.01: 
-print "ginput timeout"; 
+if timeout > 0 and counter > timeout/0.01:
+print "ginput timeout";
 break;
 
 # Disconnect the event, clean the figure, and return what we have
@@ -936,6 +936,7 @@
 ax = self.gca()
 if cax is None:
 cax, kw = cbar.make_axes(ax, **kw)
+cax.hold(True)
 cb = cbar.Colorbar(cax, mappable, **kw)
 mappable.add_observer(cb)
 mappable.set_colorbar(cb, cax)
@@ -973,10 +974,10 @@
 def ginput(self, n=1, timeout=30, verbose=False, show_clicks=True):
 """
 ginput(self, n=1, timeout=30, verbose=False, show_clicks=True)
-
-Blocking call to interact with the figure. 
 
-This will wait for n clicks from the user and return a list of the 
+Blocking call to interact with the figure.
+
+This will wait for n clicks from the user and return a list of the
 coordinates of each click. If timeout is negative, does not
 timeout. If n is negative, accumulate clicks until a middle
 click terminates the input. Right clicking cancels last input.


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

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4957] trunk/matplotlib/lib/matplotlib/axes.py

2008-02-12 Thread efiring
Revision: 4957
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4957&view=rev
Author:   efiring
Date: 2008-02-12 18:31:45 -0800 (Tue, 12 Feb 2008)

Log Message:
---
Fix bug in pcolorfast with single argument

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

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-02-13 02:10:23 UTC (rev 
4956)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-02-13 02:31:45 UTC (rev 
4957)
@@ -5020,8 +5020,8 @@
 nr, nc = C.shape
 if len(args) == 1:
 style = "image"
-x = [0, nc+1]
-y = [0, nr+1]
+x = [0, nc]
+y = [0, nr]
 elif len(args) == 3:
 x, y = args[:2]
 x = npy.asarray(x)


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

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


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

2008-02-12 Thread jdh2358
Revision: 4956
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4956&view=rev
Author:   jdh2358
Date: 2008-02-12 18:10:23 -0800 (Tue, 12 Feb 2008)

Log Message:
---
committed eriks span selector patch

Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/widgets.py

Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG  2008-02-13 02:09:06 UTC (rev 4955)
+++ trunk/matplotlib/CHANGELOG  2008-02-13 02:10:23 UTC (rev 4956)
@@ -1,3 +1,5 @@
+2008-02-12  - Applied Erik Tollerud's span selector patch - JDH
+
 2008-02-11 Update plotting() doc string to refer to getp/setp. - JKS
 
 2008-02-10 Fixed a problem with square roots in the pdf backend with

Modified: trunk/matplotlib/lib/matplotlib/widgets.py
===
--- trunk/matplotlib/lib/matplotlib/widgets.py  2008-02-13 02:09:06 UTC (rev 
4955)
+++ trunk/matplotlib/lib/matplotlib/widgets.py  2008-02-13 02:10:23 UTC (rev 
4956)
@@ -827,16 +827,14 @@
 assert direction in ['horizontal', 'vertical'], 'Must choose 
horizontal or vertical for direction'
 self.direction = direction
 
-self.ax = ax
+self.ax = None
+self.canvas = None
 self.visible = True
-self.canvas = ax.figure.canvas
-self.canvas.mpl_connect('motion_notify_event', self.onmove)
-self.canvas.mpl_connect('button_press_event', self.press)
-self.canvas.mpl_connect('button_release_event', self.release)
-self.canvas.mpl_connect('draw_event', self.update_background)
+self.cids=[]
 
 self.rect = None
 self.background = None
+self.pressv = None
 
 self.rectprops = rectprops
 self.onselect = onselect
@@ -847,8 +845,23 @@
 # Needed when dragging out of axes
 self.buttonDown = False
 self.prev = (0, 0)
-
-if self.direction == 'horizontal':
+
+self.new_axes(ax)
+
+
+def new_axes(self,ax):
+self.ax = ax
+if self.canvas is not ax.figure.canvas:
+for cid in self.cids:
+self.canvas.mpl_disconnect(cid)
+
+self.canvas = ax.figure.canvas
+
+self.cids.append(self.canvas.mpl_connect('motion_notify_event', 
self.onmove))
+self.cids.append(self.canvas.mpl_connect('button_press_event', 
self.press))
+   self.cids.append(self.canvas.mpl_connect('button_release_event', 
self.release))
+   self.cids.append(self.canvas.mpl_connect('draw_event', 
self.update_background))
+   if self.direction == 'horizontal':
 trans = blended_transform_factory(self.ax.transData, 
self.ax.transAxes)
 w,h = 0,1
 else:
@@ -859,9 +872,8 @@
visible=False,
**self.rectprops
)
-
+   
 if not self.useblit: self.ax.add_patch(self.rect)
-self.pressv = None
 
 def update_background(self, event):
 'force an update of the background'
@@ -931,10 +943,10 @@
 minv, maxv = v, self.pressv
 if minv>maxv: minv, maxv = maxv, minv
 if self.direction == 'horizontal':
-self.rect.xy[0] = minv
+self.rect.set_x(minv)
 self.rect.set_width(maxv-minv)
 else:
-self.rect.xy[1] = minv
+self.rect.set_y(minv)
 self.rect.set_height(maxv-minv)
 
 if self.onmove_callback is not None:
@@ -1155,8 +1167,8 @@
 miny, maxy = self.eventpress.ydata, y # click-y and actual mouse-y
 if minx>maxx: minx, maxx = maxx, minx # get them in the right order
 if miny>maxy: miny, maxy = maxy, miny
-self.to_draw.xy[0] = minx # set lower left of box
-self.to_draw.xy[1] = miny
+self.to_draw.set_x(minx) # set lower left of box
+self.to_draw.set_y(miny)
 self.to_draw.set_width(maxx-minx) # set width and height of box
 self.to_draw.set_height(maxy-miny)
 self.update()


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

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4955] trunk/matplotlib/lib/matplotlib/colorbar.py

2008-02-12 Thread efiring
Revision: 4955
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4955&view=rev
Author:   efiring
Date: 2008-02-12 18:09:06 -0800 (Tue, 12 Feb 2008)

Log Message:
---
Improve colorbar handling of "hold" state

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

Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2008-02-13 01:30:03 UTC (rev 
4954)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2008-02-13 02:09:06 UTC (rev 
4955)
@@ -272,15 +272,20 @@
 '''
 Draw the colors using pcolor; optionally add separators.
 '''
-## Change to pcolormesh if/when it is fixed to handle alpha
-## correctly.
+## Change to pcolorfast after fixing bugs in some backends...
 if self.orientation == 'vertical':
 args = (X, Y, C)
 else:
 args = (npy.transpose(Y), npy.transpose(X), npy.transpose(C))
 kw = {'cmap':self.cmap, 'norm':self.norm,
 'shading':'flat', 'alpha':self.alpha}
+# Save, set, and restore hold state to keep pcolor from
+# clearing the axes. Ordinarily this will not be needed,
+# since the axes object should already have hold set.
+_hold = self.ax.ishold()
+self.ax.hold(True)
 col = self.ax.pcolor(*args, **kw)
+self.ax.hold(_hold)
 #self.add_observer(col) # We should observe, not be observed...
 self.solids = col
 if self.drawedges:


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

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib: [4953] trunk/py4science

2008-02-12 Thread jdh2358
Revision: 4953
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4953&view=rev
Author:   jdh2358
Date: 2008-02-12 06:10:41 -0800 (Tue, 12 Feb 2008)

Log Message:
---
applied stefans intro patch

Modified Paths:
--
trunk/py4science/doc/rest_basics.txt
trunk/py4science/intro_talk/intro_python_scicomp.lyx

Modified: trunk/py4science/doc/rest_basics.txt
===
--- trunk/py4science/doc/rest_basics.txt2008-02-11 19:46:52 UTC (rev 
4952)
+++ trunk/py4science/doc/rest_basics.txt2008-02-12 14:10:41 UTC (rev 
4953)
@@ -1,6 +1,6 @@
-_=
+=
  reST (reSTructured Text) basics
-=k
+=
 .. Author:  Fernando Perez
 .. Contact: [EMAIL PROTECTED]
 .. Time-stamp: "2007-08-29 15:50:06 fperez"

Modified: trunk/py4science/intro_talk/intro_python_scicomp.lyx
===
--- trunk/py4science/intro_talk/intro_python_scicomp.lyx2008-02-11 
19:46:52 UTC (rev 4952)
+++ trunk/py4science/intro_talk/intro_python_scicomp.lyx2008-02-12 
14:10:41 UTC (rev 4953)
@@ -1261,7 +1261,7 @@
 \begin_layout Standard
 \align center
 \begin_inset Graphics
-   filename ../../../talks/0708_ncar/fig/Fluidlab5.png
+   filename fig/Fluidlab5.png
lyxscale 50
width 90text%
keepAspectRatio
@@ -1278,7 +1278,7 @@
 \begin_layout Standard
 \align center
 \begin_inset Graphics
-   filename ../../../talks/0708_ncar/fig/Fluidlab6.png
+   filename fig/Fluidlab6.png
lyxscale 50
width 90text%
keepAspectRatio
@@ -1313,7 +1313,7 @@
 \begin_layout Standard
 \align center
 \begin_inset Graphics
-   filename ../../../talks/0708_ncar/fig/sage-cube5plot-medium.jpg
+   filename fig/sage_notebook-medium.jpg
lyxscale 50
width 90text%
keepAspectRatio


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

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins