Revision: 4500
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4500&view=rev
Author:   mdboom
Date:     2007-11-29 05:50:25 -0800 (Thu, 29 Nov 2007)

Log Message:
-----------
Fix mri_with_eeg example

Modified Paths:
--------------
    branches/transforms/examples/mri_with_eeg.py

Modified: branches/transforms/examples/mri_with_eeg.py
===================================================================
--- branches/transforms/examples/mri_with_eeg.py        2007-11-28 21:01:01 UTC 
(rev 4499)
+++ branches/transforms/examples/mri_with_eeg.py        2007-11-29 13:50:25 UTC 
(rev 4500)
@@ -6,10 +6,8 @@
 from __future__ import division
 from pylab import *
 from matplotlib.lines import Line2D
-from matplotlib.transforms import get_bbox_transform, Point, Value, Bbox,\
-     unit_bbox
+from matplotlib.transforms import Bbox, BboxTransform, BboxTransformTo, 
Affine2D
 
-
 # I use if 1 to break up the different regions of code visually
 
 if 1:   # load the data
@@ -36,37 +34,32 @@
 
 if 1:   # plot the EEG
     # load the data
+
     numSamples, numRows = 800,4
     data = fromstring(file('data/eeg.dat', 'rb').read(), float)
     data.shape = numSamples, numRows
     t = arange(numSamples)/float(numSamples)*10.0
     ticklocs = []
     ax = subplot(212)
+    xlim(0,10)
+    xticks(arange(10))
 
-    boxin = Bbox(
-        Point(ax.viewLim.ll().x(), Value(-20)),
-        Point(ax.viewLim.ur().x(), Value(20)))
+    boxin = Bbox.from_extents(ax.viewLim.x0, -20, ax.viewLim.x1, 20)
 
+    height = ax.bbox.height
+    boxout = Bbox.from_extents(ax.bbox.x0, -1.0 * height,
+                               ax.bbox.x1,  1.0 * height)
 
-    height = ax.bbox.ur().y() - ax.bbox.ll().y()
-    boxout = Bbox(
-        Point(ax.bbox.ll().x(), Value(-1)*height),
-        Point(ax.bbox.ur().x(), Value(1) * height))
+    transOffset = BboxTransformTo(
+        Bbox.from_extents(0.0, ax.bbox.y0, 1.0, ax.bbox.y1))
 
 
-    transOffset = get_bbox_transform(
-        unit_bbox(),
-        Bbox( Point( Value(0), ax.bbox.ll().y()),
-              Point( Value(1), ax.bbox.ur().y())
-              ))
-
-
     for i in range(numRows):
         # effectively a copy of transData
-        trans = get_bbox_transform(boxin, boxout)
+        trans = BboxTransform(boxin, boxout)
         offset = (i+1)/(numRows+1)
 
-        trans.set_offset( (0, offset), transOffset)
+        trans += Affine2D().translate(*transOffset.transform_point((0, 
offset)))
 
         thisLine = Line2D(
             t, data[:,i]-data[0,i],
@@ -77,9 +70,6 @@
         ax.add_line(thisLine)
         ticklocs.append(offset)
 
-    xlim(0,10)
-    xticks(arange(10))
-
     setp(gca(), 'yticklabels', ['PG3', 'PG5', 'PG7', 'PG9'])
 
     # set the yticks to use axes coords on the y axis


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

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to