Revision: 7261
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7261&view=rev
Author: leejjoon
Date: 2009-07-14 21:18:58 +0000 (Tue, 14 Jul 2009)
Log Message:
-----------
axes_grid : minor improvements in anchored_artists and inset_locator.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-07-14 21:11:53 UTC (rev 7260)
+++ trunk/matplotlib/CHANGELOG 2009-07-14 21:18:58 UTC (rev 7261)
@@ -1,3 +1,6 @@
+2009-07-14 axes_grid : minor improvements in anchored_artists and
+ inset_locator. -JJL
+
2009-07-14 Fix a few bugs in ConnectionStyle algorithms. Add
ConnectionPatch class. -JJL
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py 2009-07-14
21:11:53 UTC (rev 7260)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/__init__.py 2009-07-14
21:18:58 UTC (rev 7261)
@@ -1,10 +1,6 @@
-"""
-AxesGrid
-"""
-
import axes_size as Size
from axes_divider import Divider, SubplotDivider, LocatableAxes, \
make_axes_locatable
-from axes_grid import AxesGrid
+from axes_grid import Grid, ImageGrid, AxesGrid
#from axes_divider import make_axes_locatable
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
2009-07-14 21:11:53 UTC (rev 7260)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py
2009-07-14 21:18:58 UTC (rev 7261)
@@ -21,34 +21,37 @@
**kwargs)
-class AnchoredSizeBar(AnchoredOffsetbox):
- def __init__(self, transform, size, label, loc,
- pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True):
- """
- Draw a horizontal bar with the size in data coordinate of the give
axes.
- A label will be drawn underneath (center-alinged).
- pad, borderpad in fraction of the legend font size (or prop)
- sep in points.
- """
- self.size_bar = AuxTransformBox(transform)
- self.size_bar.add_artist(Rectangle((0,0), size, 0, fc="none"))
+class AnchoredDrawingArea(AnchoredOffsetbox):
+ def __init__(self, width, height, xdescent, ydescent,
+ loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
+ **kwargs):
- self.txt_label = TextArea(label, minimumdescent=False)
+ self.da = DrawingArea(width, height, xdescent, ydescent, clip=True)
+ self.drawing_area = self.da
+
+ super(AnchoredDrawingArea, self).__init__(loc, pad=pad,
borderpad=borderpad,
+ child=self.da,
+ prop=None,
+ frameon=frameon,
+ **kwargs)
- self._box = VPacker(children=[self.size_bar, self.txt_label],
- align="center",
- pad=0, sep=sep)
+class AnchoredAuxTransformBox(AnchoredOffsetbox):
+ def __init__(self, transform, loc,
+ pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs):
+ self.drawing_area = AuxTransformBox(transform)
+
AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
- child=self._box,
+ child=self.drawing_area,
prop=prop,
- frameon=frameon)
+ frameon=frameon,
+ **kwargs)
class AnchoredEllipse(AnchoredOffsetbox):
def __init__(self, transform, width, height, angle, loc,
- pad=0.1, borderpad=0.1, prop=None, frameon=True):
+ pad=0.1, borderpad=0.1, prop=None, frameon=True, **kwargs):
"""
Draw an ellipse the size in data coordinate of the give axes.
@@ -61,20 +64,32 @@
AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
child=self._box,
prop=prop,
- frameon=frameon)
+ frameon=frameon, **kwargs)
-class AnchoredDrawingArea(AnchoredOffsetbox):
- def __init__(self, width, height, xdescent, ydescent,
- loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
+class AnchoredSizeBar(AnchoredOffsetbox):
+ def __init__(self, transform, size, label, loc,
+ pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True,
+ **kwargs):
+ """
+ Draw a horizontal bar with the size in data coordinate of the give
axes.
+ A label will be drawn underneath (center-alinged).
- self.da = DrawingArea(width, height, xdescent, ydescent, clip=True)
+ pad, borderpad in fraction of the legend font size (or prop)
+ sep in points.
+ """
+ self.size_bar = AuxTransformBox(transform)
+ self.size_bar.add_artist(Rectangle((0,0), size, 0, fc="none"))
- super(AnchoredDrawingArea, self).__init__(loc, pad=pad,
borderpad=borderpad,
- child=self.da,
- prop=None,
- frameon=frameon)
+ self.txt_label = TextArea(label, minimumdescent=False)
+ self._box = VPacker(children=[self.size_bar, self.txt_label],
+ align="center",
+ pad=0, sep=sep)
+ AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
+ child=self._box,
+ prop=prop,
+ frameon=frameon, **kwargs)
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py 2009-07-14
21:11:53 UTC (rev 7260)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py 2009-07-14
21:18:58 UTC (rev 7261)
@@ -168,7 +168,7 @@
axes_class=None,
):
"""
- Build an :class:`AxesGrid` instance with a grid nrows*ncols
+ Build an :class:`Grid` instance with a grid nrows*ncols
:class:`~matplotlib.axes.Axes` in
:class:`~matplotlib.figure.Figure` *fig* with
*rect=[left, bottom, width, height]* (in
@@ -184,7 +184,8 @@
axes_pad 0.02 float| pad betweein axes given in inches
add_all True [ True | False ]
share_all False [ True | False ]
- aspect True [ True | False ]
+ share_x True [ True | False ]
+ share_y True [ True | False ]
label_mode "L" [ "L" | "1" | "all" ]
axes_class None a type object which must be a subclass
of :class:`~matplotlib.axes.Axes`
@@ -406,14 +407,14 @@
_tick_only(ax, bottom_on=False, left_on=False)
-class AxesGrid(Grid):
+class ImageGrid(Grid):
"""
A class that creates a grid of Axes. In matplotlib, the axes
location (and size) is specified in the normalized figure
coordinates. This may not be ideal for images that needs to be
displayed with a given aspect ratio. For example, displaying
images of a same size with some fixed padding between them cannot
- be easily done in matplotlib. AxesGrid is used in such case.
+ be easily done in matplotlib. ImageGrid is used in such case.
"""
def __init__(self, fig,
@@ -433,7 +434,7 @@
axes_class=None,
):
"""
- Build an :class:`AxesGrid` instance with a grid nrows*ncols
+ Build an :class:`ImageGrid` instance with a grid nrows*ncols
:class:`~matplotlib.axes.Axes` in
:class:`~matplotlib.figure.Figure` *fig* with
*rect=[left, bottom, width, height]* (in
@@ -661,6 +662,7 @@
self._divider.set_vertical(v)
+AxesGrid = ImageGrid
@@ -689,7 +691,7 @@
F.subplots_adjust(left=0.05, right=0.98)
- grid = AxesGrid(F, 131, # similar to subplot(111)
+ grid = ImageGrid(F, 131, # similar to subplot(111)
nrows_ncols = (2, 2),
direction="row",
axes_pad = 0.05,
@@ -708,7 +710,7 @@
plt.ion()
- grid = AxesGrid(F, 132, # similar to subplot(111)
+ grid = ImageGrid(F, 132, # similar to subplot(111)
nrows_ncols = (2, 2),
direction="row",
axes_pad = 0.0,
@@ -733,7 +735,7 @@
- grid = AxesGrid(F, 133, # similar to subplot(122)
+ grid = ImageGrid(F, 133, # similar to subplot(122)
nrows_ncols = (2, 2),
direction="row",
axes_pad = 0.1,
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
2009-07-14 21:11:53 UTC (rev 7260)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
2009-07-14 21:18:58 UTC (rev 7261)
@@ -239,6 +239,23 @@
self.loc1, self.loc2)
+class BboxConnectorPatch(BboxConnector):
+
+ def __init__(self, bbox1, bbox2, loc1a, loc2a, loc1b, loc2b, **kwargs):
+ if "transform" in kwargs:
+ raise ValueError("transform should not be set")
+ BboxConnector.__init__(self, bbox1, bbox2, loc1a, loc2a, **kwargs)
+ self.loc1b = loc1b
+ self.loc2b = loc2b
+
+ def get_path(self):
+ path1 = self.connect_bbox(self.bbox1, self.bbox2, self.loc1, self.loc2)
+ path2 = self.connect_bbox(self.bbox2, self.bbox1, self.loc2b,
self.loc1b)
+ path_merged = list(path1.vertices) + list (path2.vertices) +
[path1.vertices[0]]
+ return Path(path_merged)
+
+
+
def _add_inset_axes(parent_axes, inset_axes):
parent_axes.figure.add_axes(inset_axes)
inset_axes.set_navigate(False)
@@ -285,7 +302,9 @@
inset_axes = axes_class(parent_axes.figure, parent_axes.get_position(),
**axes_kwargs)
- axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc)
+ axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc,
+ bbox_to_anchor=None, bbox_transform=None,
+ **kwargs)
inset_axes.set_axes_locator(axes_locator)
_add_inset_axes(parent_axes, inset_axes)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins