Revision: 5556
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5556&view=rev
Author:   mdboom
Date:     2008-06-16 06:04:07 -0700 (Mon, 16 Jun 2008)

Log Message:
-----------
Fix title placement in polar plots.  Remove broken auto layout code.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/axes.py
    trunk/matplotlib/lib/matplotlib/config/mplconfig.py
    trunk/matplotlib/lib/matplotlib/config/rcsetup.py
    trunk/matplotlib/lib/matplotlib/figure.py
    trunk/matplotlib/lib/matplotlib/projections/geo.py
    trunk/matplotlib/lib/matplotlib/projections/polar.py
    trunk/matplotlib/lib/matplotlib/rcsetup.py
    trunk/matplotlib/matplotlibrc.template

Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py     2008-06-16 12:51:33 UTC (rev 
5555)
+++ trunk/matplotlib/lib/matplotlib/axes.py     2008-06-16 13:04:07 UTC (rev 
5556)
@@ -1403,32 +1403,6 @@
             YL = self.yaxis.get_major_locator().autoscale()
             self.set_ybound(YL)
 
-    def update_layout(self, renderer):
-        pad_pixels = rcParams['xtick.major.pad'] * self.figure.dpi / 72.0
-        inverse_transFigure = self.figure.transFigure.inverted()
-        t_text, b_text = self.xaxis.get_text_heights(renderer)
-        l_text, r_text = self.yaxis.get_text_widths(renderer)
-        title_height = self.title.get_window_extent(renderer).height
-        title_height += pad_pixels * 2.0
-        original_t_text = t_text
-
-        ((l_text, t_text),
-         (r_text, b_text),
-         (dummy, title_height)) = inverse_transFigure.transform(
-            ((l_text, t_text),
-             (r_text, b_text),
-             (0.0, title_height)))
-        x0, y0, x1, y1 = self.get_position(True).extents
-        # Adjust the title
-        self.titleOffsetTrans.clear().translate(
-            0, original_t_text + pad_pixels * 2.0)
-
-        new_position = mtransforms.Bbox.from_extents(
-            x0 + l_text, y0 + b_text,
-            x1 - r_text, y1 - t_text - title_height)
-
-        self.set_position(new_position, 'active')
-
     #### Drawing
 
     def draw(self, renderer=None, inframe=False):
@@ -5654,7 +5628,7 @@
         ax2.xaxis.set_label_position('top')
         self.xaxis.tick_bottom()
         return ax2
-    
+
     def get_shared_x_axes(self):
         'Return a copy of the shared axes Grouper object for x axes'
         return self._shared_x_axes

Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-06-16 12:51:33 UTC 
(rev 5555)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-06-16 13:04:07 UTC 
(rev 5556)
@@ -238,7 +238,6 @@
         dpi = T.Float(80)
         facecolor = T.Trait('0.75', mplT.ColorHandler())
         edgecolor = T.Trait('white', mplT.ColorHandler())
-        autolayout = T.false
 
         class subplot(TConfig):
             """The figure subplot parameters.  All dimensions are fraction
@@ -408,7 +407,6 @@
         'figure.dpi' : (self.tconfig.figure, 'dpi'),
         'figure.facecolor' : (self.tconfig.figure, 'facecolor'),
         'figure.edgecolor' : (self.tconfig.figure, 'edgecolor'),
-        'figure.autolayout' : (self.tconfig.figure, 'autolayout'),
 
         'figure.subplot.left' : (self.tconfig.figure.subplot, 'left'),
         'figure.subplot.right' : (self.tconfig.figure.subplot, 'right'),

Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py   2008-06-16 12:51:33 UTC 
(rev 5555)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py   2008-06-16 13:04:07 UTC 
(rev 5556)
@@ -439,7 +439,6 @@
     'figure.dpi'        : [80, validate_float],   # DPI
     'figure.facecolor'  : ['0.75', validate_color], # facecolor; scalar gray
     'figure.edgecolor'  : ['w', validate_color],  # edgecolor; white
-    'figure.autolayout' : [False, validate_bool],
 
     'figure.subplot.left'   : [0.125, ValidateInterval(0, 1, closedmin=False, 
closedmax=False)],
     'figure.subplot.right'  : [0.9, ValidateInterval(0, 1, closedmin=False, 
closedmax=False)],

Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py   2008-06-16 12:51:33 UTC (rev 
5555)
+++ trunk/matplotlib/lib/matplotlib/figure.py   2008-06-16 13:04:07 UTC (rev 
5556)
@@ -240,7 +240,6 @@
         self.clf()
 
         self._cachedRenderer = None
-        self._autoLayout = rcParams['figure.autolayout']
 
     def _get_dpi(self):
         return self._dpi
@@ -250,9 +249,6 @@
         self.callbacks.process('dpi_changed', self)
     dpi = property(_get_dpi, _set_dpi)
 
-    def enable_auto_layout(self, setting=True):
-        self._autoLayout = setting
-
     def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
         """
         Date ticklabels often overlap, so it is useful to rotate them
@@ -284,7 +280,7 @@
                             label.set_visible(False)
                         ax.set_xlabel('')
 
-        if allsubplots and not self._autoLayout:
+        if allsubplots:
             self.subplots_adjust(bottom=bottom)
 
     def get_children(self):
@@ -765,62 +761,6 @@
             renderer.draw_image(l, b, im, self.bbox,
                                 *self.get_transformed_clip_path_and_affine())
 
-        # update the positions of the axes
-        # This gives each of the axes the opportunity to resize itself
-        # based on the tick and axis labels etc., and then makes sure
-        # that any axes that began life aligned to another axes remains
-        # aligned after these adjustments
-        if self._autoLayout and len(self.axes) > 1:
-            aligned_positions = [{}, {}, {}, {}]
-            sizes = [{}, {}]
-            for a in self.axes:
-                a.update_layout(renderer)
-                orig_pos = a.get_position(True)
-                curr_pos = a.get_position()
-                for pos, orig, curr in zip(aligned_positions,
-                                           orig_pos.get_points().flatten(),
-                                           curr_pos.get_points().flatten()):
-                    if orig in pos:
-                        pos[orig][0].append(a)
-                        pos[orig][1].add(curr)
-                    else:
-                        pos[orig] = [[a], set([curr])]
-                for size, orig, curr in zip(sizes,
-                                            orig_pos.size,
-                                            curr_pos.size):
-                    orig = round(orig * 1000.0) / 1000.0
-                    if orig in size:
-                        size[orig][0].append(a)
-                        size[orig][1].add(curr)
-                    else:
-                        size[orig] = [[a], set([curr])]
-
-            for i, pos in enumerate(aligned_positions):
-                for axes, places in pos.values():
-                    if len(places) > 1:
-                        if i < 2:
-                            curr = max(places)
-                        else:
-                            curr = min(places)
-                        for a in axes:
-                            curr_pos = a.get_position().frozen()
-                            curr_pos.get_points()[i/2, i%2] = curr
-                            a.set_position(curr_pos, 'active')
-
-            for i, size in enumerate(sizes):
-                for axes, dims in size.values():
-                    new = min(dims)
-                    for a in axes:
-                        curr_pos = a.get_position().frozen()
-                        curr = curr_pos.size[i]
-                        if curr > new:
-                            extra = (curr - new) * 0.5
-                            curr_pos.get_points()[0, i] += extra
-                            curr_pos.get_points()[1, i] -= extra
-                            a.set_position(curr_pos, 'active')
-        elif self._autoLayout:
-            for a in self.axes: a.update_layout(renderer)
-
         # render the axes
         for a in self.axes: a.draw(renderer)
 

Modified: trunk/matplotlib/lib/matplotlib/projections/geo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/geo.py  2008-06-16 12:51:33 UTC 
(rev 5555)
+++ trunk/matplotlib/lib/matplotlib/projections/geo.py  2008-06-16 13:04:07 UTC 
(rev 5556)
@@ -109,14 +109,6 @@
             .scale(0.5 / xscale, 0.5 / yscale) \
             .translate(0.5, 0.5)
 
-    def update_layout(self, renderer):
-        t_text, b_text = self.xaxis.get_text_heights(renderer)
-        l_text, r_text = self.yaxis.get_text_widths(renderer)
-        originalPosition = self.get_position(True)
-        title_offset = (b_text - originalPosition.transformed(
-                self.figure.transFigure).height) / 2.0
-        self.titleOffsetTrans.clear().translate(0, title_offset)
-
     def get_xaxis_transform(self):
         return self._xaxis_transform
 

Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/polar.py        2008-06-16 
12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py        2008-06-16 
13:04:07 UTC (rev 5556)
@@ -176,6 +176,8 @@
     def cla(self):
         Axes.cla(self)
 
+        self.title.set_y(1.05)
+
         self.xaxis.set_major_formatter(self.ThetaFormatter())
         angles = npy.arange(0.0, 360.0, 45.0)
         self.set_thetagrids(angles)
@@ -241,14 +243,6 @@
             self._yaxis_transform
             )
 
-    def update_layout(self, renderer):
-        t_text, b_text = self.xaxis.get_text_heights(renderer)
-        l_text, r_text = self.yaxis.get_text_widths(renderer)
-        originalPosition = self.get_position(True)
-        title_offset = (b_text - originalPosition.transformed(
-                self.figure.transFigure).height) / 2.0
-        self.titleOffsetTrans.clear().translate(0, title_offset)
-
     def get_xaxis_transform(self):
         return self._xaxis_transform
 

Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py  2008-06-16 12:51:33 UTC (rev 
5555)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py  2008-06-16 13:04:07 UTC (rev 
5556)
@@ -457,8 +457,6 @@
     'figure.subplot.wspace' : [0.2, ValidateInterval(0, 1, closedmin=True, 
closedmax=False)],
     'figure.subplot.hspace' : [0.2, ValidateInterval(0, 1, closedmin=True, 
closedmax=False)],
 
-    'figure.autolayout'   : [False, validate_bool],
-
     'savefig.dpi'         : [100, validate_float],   # DPI
     'savefig.facecolor'   : ['w', validate_color],  # facecolor; white
     'savefig.edgecolor'   : ['w', validate_color],  # edgecolor; white

Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template      2008-06-16 12:51:33 UTC (rev 
5555)
+++ trunk/matplotlib/matplotlibrc.template      2008-06-16 13:04:07 UTC (rev 
5556)
@@ -249,8 +249,6 @@
 #figure.subplot.wspace : 0.2   # the amount of width reserved for blank space 
between subplots
 #figure.subplot.hspace : 0.2   # the amount of height reserved for white space 
between subplots
 
-#figure.autolayout : False     # when True, adjust the axes so that text 
doesn't overlap
-
 ### IMAGES
 #image.aspect : equal             # equal | auto | a number
 #image.interpolation  : bilinear  # see help(imshow) for options


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to