You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <mme...@us...> - 2008-06-06 16:34:10
|
Revision: 5411
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5411&view=rev
Author: mmetz_bn
Date: 2008-06-06 09:34:00 -0700 (Fri, 06 Jun 2008)
Log Message:
-----------
a further hist() update
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-06-06 12:57:24 UTC (rev 5410)
+++ trunk/matplotlib/CHANGELOG 2008-06-06 16:34:00 UTC (rev 5411)
@@ -1,3 +1,9 @@
+2008-06-06 hist() revision, applied ideas proposed by Erik Tollerud and
+ Olle Engdegard: make histtype='step' unfilled by default
+ and introduce histtype='stepfilled'; use default color
+ cycle; introduce reverse cumulative histogram; new align
+ keyword - MM
+
2008-06-06 Fix closed polygon patch and also provide the option to
not close the polygon - MGD
Modified: trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py 2008-06-06 12:57:24 UTC (rev 5410)
+++ trunk/matplotlib/examples/pylab_examples/histogram_demo_extended.py 2008-06-06 16:34:00 UTC (rev 5411)
@@ -12,7 +12,7 @@
x = mu + sigma*P.randn(10000)
# the histogram of the data with histtype='step'
-n, bins, patches = P.hist(x, 50, normed=1, histtype='step')
+n, bins, patches = P.hist(x, 50, normed=1, histtype='stepfilled')
P.setp(patches, 'facecolor', 'g', 'alpha', 0.75)
# add a line showing the expected distribution
@@ -35,7 +35,6 @@
P.figure()
n, bins, patches = P.hist(x, 50, normed=1, histtype='step', cumulative=True)
-P.setp(patches, 'facecolor', 'b', 'alpha', 0.75)
# add a line showing the expected distribution
y = P.normpdf( bins, mu, sigma).cumsum()
@@ -47,13 +46,17 @@
x = mu + sigma2*P.randn(10000)
n, bins, patches = P.hist(x, bins=bins, normed=1, histtype='step', cumulative=True)
-P.setp(patches, 'facecolor', 'r', 'alpha', 0.5)
# add a line showing the expected distribution
y = P.normpdf( bins, mu, sigma2).cumsum()
y /= y[-1]
l = P.plot(bins, y, 'r--', linewidth=1.5)
+# finally overplot a reverted cumulative histogram
+n, bins, patches = P.hist(x, bins=bins, normed=1,
+ histtype='step', cumulative=-1)
+
+
P.grid(True)
P.ylim(0, 1.05)
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-06 12:57:24 UTC (rev 5410)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-06 16:34:00 UTC (rev 5411)
@@ -5634,7 +5634,7 @@
def hist(self, x, bins=10, normed=False, cumulative=False,
- bottom=None, histtype='bar', align='edge',
+ bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False, **kwargs):
"""
call signature::
@@ -5667,20 +5667,26 @@
cumulative:
if True then a histogram is computed where each bin
gives the counts in that bin plus all bins for smaller values.
- The last bin gives the total number of datapoints. If normed is
- also True then the histogram is normalized such that the last bin
- equals one.
+ The last bin gives the total number of datapoints. If normed
+ is also True then the histogram is normalized such that the
+ last bin equals one. If cumulative evaluates to less that one
+ (e.g. -1), the direction of accumulation is reversed. In this
+ case, If normed is also True then the histogram is normalized
+ such that the first bin equals one.
histtype:
- [ 'bar' | 'barstacked' | 'step' ] The type of histogram
- to draw. 'bar' is a traditional bar-type histogram,
+ [ 'bar' | 'barstacked' | 'step' | 'stepfilled' ] The type of
+ histogram to draw. 'bar' is a traditional bar-type histogram,
'barstacked' is a bar-type histogram where multiple data are
- stacked on top of each other, and 'step' generates a lineplot.
+ stacked on top of each other. step' generates a lineplot that
+ is by default unfilled, and 'stepfilled' generates a lineplot
+ that this by default filled.
align:
- ['edge' | 'center' ] Controles how the histogram is plotted.
- If 'edge', bars are centered between the bin edges.
- If 'center', bars are centered on the left bin edges
+ ['left' | 'mid' | 'right' ] Controles how the histogram is
+ plotted. If 'left', bars are centered on the left bin edges.
+ If 'mid', bars are centered between the bin edges. If 'right',
+ bars are centered on the right bin edges.
orientation:
[ 'horizontal' | 'vertical' ] If horizontal, barh will be used
@@ -5716,7 +5722,6 @@
warnings.warn('2D hist should be nsamples x nvariables; this looks transposed')
if len(x.shape)==2:
-
n = []
for i in xrange(x.shape[1]):
# this will automatically overwrite bins,
@@ -5730,13 +5735,16 @@
n = [n,]
if cumulative:
+ slc = slice(None)
+ if cbook.is_numlike(cumulative):
+ if cumulative < 0:
+ slc = slice(None,None,-1)
+
if normed:
- n = [(m * np.diff(bins)).cumsum() for m in n]
+ n = [(m * np.diff(bins))[slc].cumsum()[slc] for m in n]
else:
- n = [m.cumsum() for m in n]
+ n = [m[slc].cumsum()[slc] for m in n]
- ccount = 0
- colors = _process_plot_var_args.defaultColors[:]
patches = []
if histtype.startswith('bar'):
@@ -5763,14 +5771,16 @@
else:
raise ValueError, 'invalid histtype: %s' % histtype
- if align=='edge':
+ if align == 'mid' or align == 'edge':
boffset += 0.5*totwidth
- elif align != 'center':
+ elif align == 'right':
+ boffset += totwidth
+ elif align != 'left' and align != 'center':
raise ValueError, 'invalid align: %s' % align
if orientation == 'horizontal':
for m in n:
- color = colors[ccount % len(colors)]
+ color = self._get_lines._get_next_cycle_color()
patch = self.barh(bins[:-1]+boffset, m, height=width,
left=bottom, align='center', log=log,
color=color)
@@ -5779,10 +5789,9 @@
if bottom is None: bottom = 0.0
bottom += m
boffset += dw
- ccount += 1
elif orientation == 'vertical':
for m in n:
- color = colors[ccount % len(colors)]
+ color = self._get_lines._get_next_cycle_color()
patch = self.bar(bins[:-1]+boffset, m, width=width,
bottom=bottom, align='center', log=log,
color=color)
@@ -5791,19 +5800,20 @@
if bottom is None: bottom = 0.0
bottom += m
boffset += dw
- ccount += 1
else:
raise ValueError, 'invalid orientation: %s' % orientation
- elif histtype == 'step':
+ elif histtype.startswith('step'):
x = np.zeros( 2*len(bins), np.float_ )
y = np.zeros( 2*len(bins), np.float_ )
x[0::2], x[1::2] = bins, bins
- if align == 'center':
+ if align == 'left' or align == 'center':
x -= 0.5*(bins[1]-bins[0])
- elif align != 'edge':
+ elif align == 'right':
+ x += 0.5*(bins[1]-bins[0])
+ elif align != 'mid' and align != 'edge':
raise ValueError, 'invalid align: %s' % align
if log:
@@ -5812,6 +5822,12 @@
self.set_xscale('log')
elif orientation == 'vertical':
self.set_yscale('log')
+
+ fill = False
+ if histtype == 'stepfilled':
+ fill = True
+ elif histtype != 'step':
+ raise ValueError, 'invalid histtype: %s' % histtype
for m in n:
y[1:-1:2], y[2::2] = m, m
@@ -5819,7 +5835,14 @@
x,y = y,x
elif orientation != 'vertical':
raise ValueError, 'invalid orientation: %s' % orientation
- patches.append( self.fill(x,y,closed=False) )
+
+ color = self._get_lines._get_next_cycle_color()
+ if fill:
+ patches.append( self.fill(x, y,
+ closed=False, facecolor=color) )
+ else:
+ patches.append( self.fill(x, y,
+ closed=False, edgecolor=color, fill=False) )
# adopted from adjust_x/ylim part of the bar method
if orientation == 'horizontal':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-06 12:57:51
|
Revision: 5410
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5410&view=rev
Author: mdboom
Date: 2008-06-06 05:57:24 -0700 (Fri, 06 Jun 2008)
Log Message:
-----------
Fix polygon closing and provide option not to close (used by hist(histtype="step"))
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-06-06 12:07:53 UTC (rev 5409)
+++ trunk/matplotlib/CHANGELOG 2008-06-06 12:57:24 UTC (rev 5410)
@@ -1,3 +1,6 @@
+2008-06-06 Fix closed polygon patch and also provide the option to
+ not close the polygon - MGD
+
2008-06-05 Fix some dpi-changing-related problems with PolyCollection,
as called by Axes.scatter() - MGD
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-06 12:07:53 UTC (rev 5409)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-06 12:57:24 UTC (rev 5410)
@@ -345,12 +345,16 @@
seg = mpatches.Polygon(zip(x, y),
facecolor = facecolor,
fill=True,
+ closed=closed
)
self.set_patchprops(seg, **kwargs)
ret.append(seg)
- if self.command == 'plot': func = makeline
- else: func = makefill
+ if self.command == 'plot':
+ func = makeline
+ else:
+ closed = kwargs.pop("closed")
+ func = makefill
if multicol:
for j in range(y.shape[1]):
func(x[:,j], y[:,j])
@@ -387,12 +391,16 @@
seg = mpatches.Polygon(zip(x, y),
facecolor = facecolor,
fill=True,
+ closed=closed
)
self.set_patchprops(seg, **kwargs)
ret.append(seg)
- if self.command == 'plot': func = makeline
- else: func = makefill
+ if self.command == 'plot':
+ func = makeline
+ else:
+ closed = kwargs.pop('closed')
+ func = makefill
if multicol:
for j in range(y.shape[1]):
@@ -4934,6 +4942,8 @@
See examples/fill_between.py for more examples.
+ The closed kwarg will close the polygon when True (default).
+
kwargs control the Polygon properties:
%(Polygon)s
"""
@@ -5809,7 +5819,7 @@
x,y = y,x
elif orientation != 'vertical':
raise ValueError, 'invalid orientation: %s' % orientation
- patches.append( self.fill(x,y) )
+ patches.append( self.fill(x,y,closed=False) )
# adopted from adjust_x/ylim part of the bar method
if orientation == 'horizontal':
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-06-06 12:07:53 UTC (rev 5409)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-06-06 12:57:24 UTC (rev 5410)
@@ -531,7 +531,7 @@
def __str__(self):
return "Poly((%g, %g) ...)" % tuple(self._path.vertices[0])
- def __init__(self, xy, **kwargs):
+ def __init__(self, xy, closed=True, **kwargs):
"""
xy is a numpy array with shape Nx2
@@ -541,7 +541,7 @@
"""
Patch.__init__(self, **kwargs)
xy = np.asarray(xy, np.float_)
- if len(xy) and xy[0] != xy[-1]:
+ if closed and len(xy) and (xy[0] != xy[-1]).any():
xy = np.concatenate([xy, [xy[0]]])
self._path = Path(xy)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-06 12:08:09
|
Revision: 5409
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5409&view=rev
Author: mdboom
Date: 2008-06-06 05:07:53 -0700 (Fri, 06 Jun 2008)
Log Message:
-----------
Fix bug in recent PolyCollection sizing change.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-06-06 03:45:57 UTC (rev 5408)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-06-06 12:07:53 UTC (rev 5409)
@@ -492,7 +492,7 @@
renderer.close_group(self.__class__.__name__)
class PolyCollection(Collection):
- def __init__(self, verts, sizes = (1, ), **kwargs):
+ def __init__(self, verts, sizes = None, **kwargs):
"""
verts is a sequence of ( verts0, verts1, ...) where verts_i is
a sequence of xy tuples of vertices, or an equivalent
@@ -518,10 +518,11 @@
def draw(self, renderer):
# sizes is the area of the circle circumscribing the polygon
# in points^2
- self._transforms = [
- transforms.Affine2D().scale(
- (np.sqrt(x) * renderer.dpi / 72.0))
- for x in self._sizes]
+ if self._sizes is not None:
+ self._transforms = [
+ transforms.Affine2D().scale(
+ (np.sqrt(x) * renderer.dpi / 72.0))
+ for x in self._sizes]
return Collection.draw(self, renderer)
class BrokenBarHCollection(PolyCollection):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-06 03:45:59
|
Revision: 5408
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5408&view=rev
Author: jdh2358
Date: 2008-06-05 20:45:57 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
added draft outline
Modified Paths:
--------------
trunk/matplotlib/doc/devel/index.rst
Added Paths:
-----------
trunk/matplotlib/doc/devel/outline.rst
Modified: trunk/matplotlib/doc/devel/index.rst
===================================================================
--- trunk/matplotlib/doc/devel/index.rst 2008-06-05 22:23:50 UTC (rev 5407)
+++ trunk/matplotlib/doc/devel/index.rst 2008-06-06 03:45:57 UTC (rev 5408)
@@ -13,4 +13,4 @@
documenting_mpl.rst
transformations.rst
add_new_projection.rst
-
+ outline.rst
Added: trunk/matplotlib/doc/devel/outline.rst
===================================================================
--- trunk/matplotlib/doc/devel/outline.rst (rev 0)
+++ trunk/matplotlib/doc/devel/outline.rst 2008-06-06 03:45:57 UTC (rev 5408)
@@ -0,0 +1,99 @@
+.. _outline:
+
+************
+Docs outline
+************
+
+Proposed chapters for the docs, who has responsibility for them, and
+who reviews them. The "unit" doesn't have to be a full chapter
+(though in some cases it will be), it may be a chapter or a section in
+a chapter.
+
+=============================== ==================== =========== ===================
+User's guide unit Author Status Reviewer
+=============================== ==================== =========== ===================
+contouring Eric ? no author Perry ?
+quiver plots Eric ? no author ?
+quadmesh ? no author ?
+images ? no author ?
+histograms Manuel ? no author Erik Tollerud ?
+bar / errorbar ? no author ?
+x-y plots ? no author ?
+time series plots ? no author ?
+date plots John has author ?
+working with data John has author ?
+custom ticking ? no author ?
+masked data Eric ? no author ?
+text ? no author ?
+patches ? no author ?
+legends ? no author ?
+animation John has author ?
+collections ? no author ?
+mathtext Michael ? submitted John
+fonts et al Michael ? no author ?
+pyplot tut John submitted Eric ?
+usetex Darren ? no author ?
+configuration Darren ? preliminary ?
+colormapping Perry ? no author Eric ?
+win32 install Charlie ? no author ?
+os x install Charlie ? no author ?
+linux install ? no author ?
+artist api John submitted ?
+event handling John submitted ?
+navigation John submitted ?
+interactive usage ? no author ?
+widgets ? no author ?
+ui - gtk ? no author ?
+ui - wx ? no author ?
+ui - tk ? no author ?
+ui - qt Darren ? no author ?
+backend - pdf Jouni ? no author ?
+backend - ps Darren ? no author ?
+backend - svg ? no author ?
+backend - agg ? no author ?
+backend - cairo ? no author ?
+=============================== ==================== =========== ===================
+
+Here is the ouline for the dev guide, much less fleshed out
+
+=============================== ==================== =========== ===================
+Developer's guide unit Author Status Reviewer
+=============================== ==================== =========== ===================
+the renderer John has author Michael ?
+the canvas John has author ?
+the artist John has author ?
+transforms Michael submitted John
+documenting mpl Darren submitted ?
+coding guide John submitted ?
+and_much_more ? ? ?
+=============================== ==================== =========== ===================
+
+And we might want to do a similar table for the FAQ, but that may also be overkill...
+
+If you agree to author a unit, remove the question mark by your name
+(or add your name if there is no candidate), and change the status to
+"has author". Once you have completed draft and checked it in, you
+can change the status to "submitted" and try to find a reviewer if you
+don't have one. The reviewer should read your chapter, test it for
+correctness (eg try your examples) and change the status to "complete"
+when done.
+
+You are free to lift and convert as much material from the web site or
+the existing latex user's guide as you see fit. The more the better.
+
+The UI chapters should give an example or two of using mpl with your
+GUI and any relevant info, such as version, installation, config,
+etc... The backend chapters should cover backend specific
+configuration (eg PS only options), what features are missing, etc...
+
+Please feel free to add units, volunteer to review or author a
+chapter, etc...
+
+It is probably easiest to be an editor. Once you have signed up to be
+an editor, if you have an author pester the author for a submission
+every so often. If you don't have an author, find one, and then pester
+them! Your only two responsibilities are getting your author to
+produce and checking their work, so don't be shy. You *do not* need
+to be an expert in the subject you are editing -- you should know
+something about it and be willing to read, test, give feedback and
+pester!
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-05 22:23:52
|
Revision: 5407
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5407&view=rev
Author: jdh2358
Date: 2008-06-05 15:23:50 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
added api histogram demo which comments on the new bins return value
Added Paths:
-----------
trunk/matplotlib/examples/api/histogram_demo.py
Added: trunk/matplotlib/examples/api/histogram_demo.py
===================================================================
--- trunk/matplotlib/examples/api/histogram_demo.py (rev 0)
+++ trunk/matplotlib/examples/api/histogram_demo.py 2008-06-05 22:23:50 UTC (rev 5407)
@@ -0,0 +1,35 @@
+"""
+Make a histogram of normally distributed random numbers and plot the
+analytic PDF over it
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.mlab as mlab
+
+mu, sigma = 100, 15
+x = mu + sigma * np.random.randn(10000)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+
+# the histogram of the data
+n, bins, patches = ax.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
+
+# hist uses np.histogram under the hood to create 'n' and 'bins'.
+# np.histogram returns the bin edges, so there will be 50 probability
+# density values in n, 51 bin edges in bins and 50 patches. To get
+# everything lined up, we'll compute the bin centers
+bincenters = 0.5*(bins[1:]+bins[:-1])
+# add a 'best fit' line for the normal PDF
+y = mlab.normpdf( bincenters, mu, sigma)
+l = ax.plot(bincenters, y, 'r--', linewidth=1)
+
+ax.set_xlabel('Smarts')
+ax.set_ylabel('Probability')
+#ax.set_title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
+ax.set_xlim(40, 160)
+ax.set_ylim(0, 0.03)
+ax.grid(True)
+
+#fig.savefig('histogram_demo',dpi=72)
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 19:34:58
|
Revision: 5406
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5406&view=rev
Author: mdboom
Date: 2008-06-05 12:34:57 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Add newline to end of file.
Modified Paths:
--------------
trunk/matplotlib/doc/_static/matplotlib.css
Modified: trunk/matplotlib/doc/_static/matplotlib.css
===================================================================
--- trunk/matplotlib/doc/_static/matplotlib.css 2008-06-05 19:14:53 UTC (rev 5405)
+++ trunk/matplotlib/doc/_static/matplotlib.css 2008-06-05 19:34:57 UTC (rev 5406)
@@ -6,4 +6,4 @@
dl.method, dl.attribute {
border-top: 1px solid #aaa;
-}
\ No newline at end of file
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 19:14:55
|
Revision: 5405
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5405&view=rev
Author: mdboom
Date: 2008-06-05 12:14:53 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Close polygons.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-06-05 17:33:24 UTC (rev 5404)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-06-05 19:14:53 UTC (rev 5405)
@@ -540,6 +540,9 @@
See Patch documentation for additional kwargs
"""
Patch.__init__(self, **kwargs)
+ xy = np.asarray(xy, np.float_)
+ if len(xy) and xy[0] != xy[-1]:
+ xy = np.concatenate([xy, [xy[0]]])
self._path = Path(xy)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 17:33:58
|
Revision: 5404
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5404&view=rev
Author: mdboom
Date: 2008-06-05 10:33:24 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Add some CSS so that there are lines above classes and methods in the
auto-generated docs.
Modified Paths:
--------------
trunk/matplotlib/doc/conf.py
Added Paths:
-----------
trunk/matplotlib/doc/_static/matplotlib.css
Added: trunk/matplotlib/doc/_static/matplotlib.css
===================================================================
--- trunk/matplotlib/doc/_static/matplotlib.css (rev 0)
+++ trunk/matplotlib/doc/_static/matplotlib.css 2008-06-05 17:33:24 UTC (rev 5404)
@@ -0,0 +1,9 @@
+@import "default.css";
+
+dl.class, dl.function {
+ border-top: 2px solid #888;
+}
+
+dl.method, dl.attribute {
+ border-top: 1px solid #aaa;
+}
\ No newline at end of file
Modified: trunk/matplotlib/doc/conf.py
===================================================================
--- trunk/matplotlib/doc/conf.py 2008-06-05 17:09:04 UTC (rev 5403)
+++ trunk/matplotlib/doc/conf.py 2008-06-05 17:33:24 UTC (rev 5404)
@@ -80,7 +80,7 @@
# The style sheet to use for HTML and HTML Help pages. A file of that name
# must exist either in Sphinx' static/ path, or in one of the custom paths
# given in html_static_path.
-html_style = 'default.css'
+html_style = 'matplotlib.css'
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 17:09:10
|
Revision: 5403
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5403&view=rev
Author: mdboom
Date: 2008-06-05 10:09:04 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Fix dpi-changing-related bugs in Axes.scatter()
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/api/collections_demo.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-06-05 17:06:16 UTC (rev 5402)
+++ trunk/matplotlib/CHANGELOG 2008-06-05 17:09:04 UTC (rev 5403)
@@ -1,3 +1,6 @@
+2008-06-05 Fix some dpi-changing-related problems with PolyCollection,
+ as called by Axes.scatter() - MGD
+
2008-06-05 Fix image drawing so there is no extra space to the right
or bottom - MGD
Modified: trunk/matplotlib/examples/api/collections_demo.py
===================================================================
--- trunk/matplotlib/examples/api/collections_demo.py 2008-06-05 17:06:16 UTC (rev 5402)
+++ trunk/matplotlib/examples/api/collections_demo.py 2008-06-05 17:09:04 UTC (rev 5403)
@@ -33,8 +33,9 @@
spiral = zip(xx,yy)
# Make some offsets
-xo = N.random.randn(npts)
-yo = N.random.randn(npts)
+rs = N.random.RandomState([12345678])
+xo = rs.randn(npts)
+yo = rs.randn(npts)
xyo = zip(xo, yo)
# Make a list of colors cycling through the rgbcmyk series.
@@ -45,7 +46,7 @@
a = fig.add_subplot(2,2,1)
col = collections.LineCollection([spiral], offsets=xyo,
transOffset=a.transData)
-trans = transforms.Affine2D().scale(fig.dpi/72.0)
+trans = fig.dpi_scale_trans + transforms.Affine2D().scale(1.0/72.0)
col.set_transform(trans) # the points to pixels transform
# Note: the first argument to the collection initializer
# must be a list of sequences of x,y tuples; we have only
@@ -112,7 +113,7 @@
xx = (0.2 + (ym-yy)/ym)**2 * N.cos(yy-0.4) * 0.5
segs = []
for i in range(ncurves):
- xxx = xx + 0.02*N.random.randn(nverts)
+ xxx = xx + 0.02*rs.randn(nverts)
curve = zip(xxx, yy*100)
segs.append(curve)
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-05 17:06:16 UTC (rev 5402)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-05 17:09:04 UTC (rev 5403)
@@ -4603,15 +4603,8 @@
rescale = np.sqrt(max(verts[:,0]**2+verts[:,1]**2))
verts /= rescale
- scales = np.asarray(scales)
- scales = np.sqrt(scales * self.figure.dpi / 72.)
- if len(scales)==1:
- verts = [scales[0]*verts]
- else:
- # todo -- make this nx friendly
- verts = [verts*s for s in scales]
collection = mcoll.PolyCollection(
- verts,
+ verts, scales,
facecolors = colors,
edgecolors = edgecolors,
linewidths = linewidths,
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-06-05 17:06:16 UTC (rev 5402)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-06-05 17:09:04 UTC (rev 5403)
@@ -492,15 +492,19 @@
renderer.close_group(self.__class__.__name__)
class PolyCollection(Collection):
- def __init__(self, verts, **kwargs):
+ def __init__(self, verts, sizes = (1, ), **kwargs):
"""
verts is a sequence of ( verts0, verts1, ...) where verts_i is
a sequence of xy tuples of vertices, or an equivalent
numpy array of shape (nv,2).
+ sizes gives the area of the circle circumscribing the
+ polygon in points^2
+
%(Collection)s
"""
Collection.__init__(self,**kwargs)
+ self._sizes = sizes
self.set_verts(verts)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
@@ -511,6 +515,15 @@
def get_paths(self):
return self._paths
+ def draw(self, renderer):
+ # sizes is the area of the circle circumscribing the polygon
+ # in points^2
+ self._transforms = [
+ transforms.Affine2D().scale(
+ (np.sqrt(x) * renderer.dpi / 72.0))
+ for x in self._sizes]
+ return Collection.draw(self, renderer)
+
class BrokenBarHCollection(PolyCollection):
"""
A colleciton of horizontal bars spanning yrange with a sequence of
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 17:06:18
|
Revision: 5402
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5402&view=rev
Author: mdboom
Date: 2008-06-05 10:06:16 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Fix one-pixel space between images and axes border.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-06-05 16:17:57 UTC (rev 5401)
+++ trunk/matplotlib/CHANGELOG 2008-06-05 17:06:16 UTC (rev 5402)
@@ -1,3 +1,6 @@
+2008-06-05 Fix image drawing so there is no extra space to the right
+ or bottom - MGD
+
2006-06-04 Added a figure title command subtitle as a Figure method
and pyplot command -- see examples/figure_title.py - JDH
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2008-06-05 16:17:57 UTC (rev 5401)
+++ trunk/matplotlib/lib/matplotlib/image.py 2008-06-05 17:06:16 UTC (rev 5402)
@@ -205,7 +205,9 @@
tx = (xmin-self.axes.viewLim.x0)/dxintv * numcols
ty = (ymin-self.axes.viewLim.y0)/dyintv * numrows
- l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds
+ l, b, r, t = self.axes.bbox.extents
+ widthDisplay = (round(r) + 0.5) - (round(l) - 0.5)
+ heightDisplay = (round(t) + 0.5) - (round(b) - 0.5)
widthDisplay *= magnification
heightDisplay *= magnification
im.apply_translation(tx, ty)
@@ -226,7 +228,7 @@
warnings.warn("Images are not supported on non-linear axes.")
im = self.make_image(renderer.get_image_magnification())
l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds
- renderer.draw_image(l, b, im, self.axes.bbox.frozen(),
+ renderer.draw_image(round(l), round(b), im, self.axes.bbox.frozen(),
*self.get_transformed_clip_path_and_affine())
def contains(self, mouseevent):
@@ -378,7 +380,9 @@
raise RuntimeError('You must first set the image array')
x0, y0, v_width, v_height = self.axes.viewLim.bounds
- l, b, width, height = self.axes.bbox.bounds
+ l, b, r, t = self.axes.bbox.extents
+ width = (round(r) + 0.5) - (round(l) - 0.5)
+ height = (round(t) + 0.5) - (round(b) - 0.5)
width *= magnification
height *= magnification
im = _image.pcolor(self._Ax, self._Ay, self._A,
@@ -487,8 +491,11 @@
fc = self.axes.get_frame().get_facecolor()
bg = mcolors.colorConverter.to_rgba(fc, 0)
bg = (np.array(bg)*255).astype(np.uint8)
- width = self.axes.bbox.width * magnification
- height = self.axes.bbox.height * magnification
+ l, b, r, t = self.axes.bbox.extents
+ width = (round(r) + 0.5) - (round(l) - 0.5)
+ height = (round(t) + 0.5) - (round(b) - 0.5)
+ width = width * magnification
+ height = height * magnification
if self.check_update('array'):
A = self.to_rgba(self._A, alpha=self._alpha, bytes=True)
self._rgbacache = A
@@ -508,8 +515,8 @@
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
im = self.make_image(renderer.get_image_magnification())
- renderer.draw_image(self.axes.bbox.xmin,
- self.axes.bbox.ymin,
+ renderer.draw_image(round(self.axes.bbox.xmin),
+ round(self.axes.bbox.ymin),
im,
self.axes.bbox.frozen(),
*self.get_transformed_clip_path_and_affine())
@@ -638,7 +645,7 @@
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
im = self.make_image()
- renderer.draw_image(self.ox, self.oy, 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.
|
|
From: <jd...@us...> - 2008-06-05 16:18:00
|
Revision: 5401
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5401&view=rev
Author: jdh2358
Date: 2008-06-05 09:17:57 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
fixed collection demo to remove deprecated dpi
Modified Paths:
--------------
trunk/matplotlib/doc/users/navigation_toolbar.rst
trunk/matplotlib/examples/api/collections_demo.py
Added Paths:
-----------
trunk/matplotlib/doc/_static/toolbar.png
Added: trunk/matplotlib/doc/_static/toolbar.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/doc/_static/toolbar.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/matplotlib/doc/users/navigation_toolbar.rst
===================================================================
--- trunk/matplotlib/doc/users/navigation_toolbar.rst 2008-06-05 15:08:28 UTC (rev 5400)
+++ trunk/matplotlib/doc/users/navigation_toolbar.rst 2008-06-05 16:17:57 UTC (rev 5401)
@@ -3,6 +3,9 @@
Interactive navigation
======================
+.. image:: ../_static/toolbar.png
+ :scale: 100
+
All figure windows come with a navigation toolbar, which can be used
to navigate through the data set. Here is a description of each of
the buttons at the bottom of the toolbar
Modified: trunk/matplotlib/examples/api/collections_demo.py
===================================================================
--- trunk/matplotlib/examples/api/collections_demo.py 2008-06-05 15:08:28 UTC (rev 5400)
+++ trunk/matplotlib/examples/api/collections_demo.py 2008-06-05 16:17:57 UTC (rev 5401)
@@ -86,7 +86,7 @@
a = fig.add_subplot(2,2,3)
-col = collections.RegularPolyCollection(fig.dpi, 7,
+col = collections.RegularPolyCollection(7,
sizes = N.fabs(xx)*10.0, offsets=xyo,
transOffset=a.transData)
trans = transforms.Affine2D().scale(fig.dpi/72.0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 15:08:33
|
Revision: 5400
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5400&view=rev
Author: mdboom
Date: 2008-06-05 08:08:28 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Forgot to commit this file
Added Paths:
-----------
trunk/matplotlib/doc/_static/transforms.png
Added: trunk/matplotlib/doc/_static/transforms.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/doc/_static/transforms.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-05 15:05:57
|
Revision: 5399
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5399&view=rev
Author: jdh2358
Date: 2008-06-05 08:05:47 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
tried to fix some api table formatting problems but these apparently were not the ones triggering the sphinx doc warnings. we need to figure out a way to make sphinx generate some context in its api warnings since the line numbers are not helpful
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-05 14:47:50 UTC (rev 5398)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-05 15:05:47 UTC (rev 5399)
@@ -748,6 +748,8 @@
which:
========== ====================
+ value description
+ ========== ====================
'active' to change the first
'original' to change the second
'both' to change both
@@ -914,6 +916,8 @@
aspect:
======== ================================================
+ value description
+ ======== ================================================
'auto' automatic; fill position rectangle with data
'normal' same as 'auto'; deprecated
'equal' same scaling from data to plot units for x and y
@@ -925,6 +929,8 @@
adjustable:
======== ============================
+ value description
+ ======== ============================
'box' change physical size of axes
'datalim' change xlim or ylim
======== ============================
@@ -932,6 +938,8 @@
anchor:
==== =====================
+ value description
+ ==== =====================
'C' centered
'SW' lower left corner
'S' middle of bottom edge
@@ -971,7 +979,9 @@
"""
anchor:
- ==== ============
+ ===== ============
+ value description
+ ===== ============
'C' Center
'SW' bottom left
'S' bottom
@@ -981,7 +991,7 @@
'N' top
'NW' top left
'W' left
- ==== ============
+ ===== ============
"""
if anchor in mtransforms.Bbox.coefs.keys() or len(anchor) == 2:
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-06-05 14:47:50 UTC (rev 5398)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-06-05 15:05:47 UTC (rev 5399)
@@ -1024,7 +1024,7 @@
in cartesian plots. Note that if you
are using a polar axes, you do not need
to specify polar for the coordinate
- system since that is the native"data" coordinate
+ system since that is the native "data" coordinate
system.
================= ===================================================
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-05 14:47:53
|
Revision: 5398
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5398&view=rev
Author: jdh2358
Date: 2008-06-05 07:47:50 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
updated backend driver to point to the right figtitle demo
Modified Paths:
--------------
trunk/matplotlib/examples/tests/backend_driver.py
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py 2008-06-05 14:44:07 UTC (rev 5397)
+++ trunk/matplotlib/examples/tests/backend_driver.py 2008-06-05 14:47:50 UTC (rev 5398)
@@ -48,7 +48,7 @@
'errorbar_limits.py',
'figimage_demo.py',
'figlegend_demo.py',
- 'figtext.py',
+ 'figure_title.py',
'fill_demo.py',
'finance_demo.py',
'fonts_demo_kw.py',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-05 14:44:13
|
Revision: 5397
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5397&view=rev
Author: jdh2358
Date: 2008-06-05 07:44:07 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
getting classic toolbar in sync on branch and trunk for svnmerge
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Name: svnmerge-integrated
- /branches/v0_91_maint:1-5385
+ /branches/v0_91_maint:1-5396
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-06-05 14:37:03 UTC (rev 5396)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-06-05 14:44:07 UTC (rev 5397)
@@ -386,6 +386,7 @@
def get_default_filetype(self):
return 'png'
+
def flush_events(self):
gtk.gdk.threads_enter()
while gtk.events_pending():
@@ -393,7 +394,6 @@
gtk.gdk.flush()
gtk.gdk.threads_leave()
-
class FigureManagerGTK(FigureManagerBase):
"""
Public attributes
@@ -950,6 +950,7 @@
except Exception, e:
error_msg_gtk(str(e), parent=self)
+
if gtk.pygtk_version >= (2,4,0):
class FileChooserDialog(gtk.FileChooserDialog):
"""GTK+ 2.4 file selector which remembers the last file/directory
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-05 14:37:29
|
Revision: 5396
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5396&view=rev
Author: jdh2358
Date: 2008-06-05 07:37:03 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
fixed classic toolbar bugs
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py
branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py 2008-06-05 14:18:31 UTC (rev 5395)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py 2008-06-05 14:37:03 UTC (rev 5396)
@@ -353,12 +353,12 @@
# for self.window(for pixmap) and has a side effect of altering
# figure width,height (via configure-event?)
gtk.DrawingArea.realize(self)
-
+
width, height = self.get_width_height()
pixmap = gdk.Pixmap (self.window, width, height)
self._renderer.set_pixmap (pixmap)
self._render_figure(pixmap, width, height)
-
+
# jpg colors don't match the display very well, png colors match
# better
pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, 0, 8, width, height)
@@ -382,11 +382,11 @@
raise ValueError("Saving to a Python file-like object is only supported by PyGTK >= 2.8")
else:
raise ValueError("filename must be a path or a file-like object")
-
+
def get_default_filetype(self):
return 'png'
-
+
class FigureManagerGTK(FigureManagerBase):
"""
Public attributes
@@ -403,7 +403,7 @@
self.window = gtk.Window()
self.window.set_title("Figure %d" % num)
-
+
self.vbox = gtk.VBox()
self.window.add(self.vbox)
self.vbox.show()
@@ -455,7 +455,7 @@
def show(self):
# show the figure window
self.window.show()
-
+
def full_screen_toggle (self):
self._full_screen_flag = not self._full_screen_flag
if self._full_screen_flag:
@@ -735,8 +735,8 @@
self.fileselect = FileChooserDialog(
title='Save the figure',
parent=self.win,
- formats=self.canvas.get_supported_filetypes(),
- default_type=self.canvas.get_default_filetype())
+ filetypes=self.canvas.get_supported_filetypes(),
+ default_filetype=self.canvas.get_default_filetype())
else:
self._create_toolitems_2_2()
self.update = self._update_2_2
@@ -905,53 +905,32 @@
self._ind = ind
self._active = [ self._axes[i] for i in self._ind ]
- def panx(self, button, arg):
- """arg is either user callback data or a scroll event
- """
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
+ def panx(self, button, direction):
+ 'panx in direction'
for a in self._active:
- a.panx(direction)
+ a.xaxis.pan(direction)
self.canvas.draw()
return True
- def pany(self, button, arg):
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
-
+ def pany(self, button, direction):
+ 'pany in direction'
for a in self._active:
- a.pany(direction)
+ a.yaxis.pan(direction)
self.canvas.draw()
return True
- def zoomx(self, button, arg):
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
-
+ def zoomx(self, button, direction):
+ 'zoomx in direction'
for a in self._active:
- a.zoomx(direction)
+ a.xaxis.zoom(direction)
self.canvas.draw()
return True
- def zoomy(self, button, arg):
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
-
+ def zoomy(self, button, direction):
+ 'zoomy in direction'
for a in self._active:
- a.zoomy(direction)
+ a.yaxis.zoom(direction)
self.canvas.draw()
return True
@@ -964,6 +943,7 @@
except Exception, e:
error_msg_gtk(str(e), parent=self)
+
if gtk.pygtk_version >= (2,4,0):
class FileChooserDialog(gtk.FileChooserDialog):
"""GTK+ 2.4 file selector which remembers the last file/directory
@@ -1036,7 +1016,7 @@
break
filename = self.get_filename()
break
-
+
self.hide()
return filename, self.ext
else:
@@ -1068,8 +1048,8 @@
if ext.startswith('.'):
ext = ext[1:]
return filename, ext
-
+
class DialogLineprops:
"""
A GUI dialog for controlling lineprops
Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py 2008-06-05 14:18:31 UTC (rev 5395)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py 2008-06-05 14:37:03 UTC (rev 5396)
@@ -486,46 +486,26 @@
self._ind = ind
self._active = [ self._axes[i] for i in self._ind ]
- def panx(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def panx(self, direction):
for a in self._active:
- a.panx(direction)
+ a.xaxis.pan(direction)
self.canvas.draw()
- def pany(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def pany(self, direction):
for a in self._active:
- a.pany(direction)
+ a.yaxis.pan(direction)
self.canvas.draw()
- def zoomx(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def zoomx(self, direction):
for a in self._active:
- a.zoomx(direction)
+ a.xaxis.zoom(direction)
self.canvas.draw()
- def zoomy(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def zoomy(self, direction):
for a in self._active:
- a.zoomy(direction)
+ a.yaxis.zoom(direction)
self.canvas.draw()
def save_figure(self):
@@ -665,14 +645,14 @@
# so we just have to put it first
default_filetype_name = filetypes[default_filetype]
del filetypes[default_filetype]
-
+
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
sorted_filetypes.insert(0, (default_filetype, default_filetype_name))
-
+
tk_filetypes = [
(name, '*.%s' % ext) for (ext, name) in sorted_filetypes]
-
+
fname = asksaveasfilename(
master=self.window,
title='Save the figure',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-05 14:18:43
|
Revision: 5395
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5395&view=rev
Author: jdh2358
Date: 2008-06-05 07:18:31 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
some fixes for classic toolbar
Modified Paths:
--------------
trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py
===================================================================
--- trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py 2008-06-05 13:45:27 UTC (rev 5394)
+++ trunk/matplotlib/examples/user_interfaces/embedding_in_gtk2.py 2008-06-05 14:18:31 UTC (rev 5395)
@@ -14,8 +14,8 @@
#from matplotlib.backends.backend_gtkcairo import FigureCanvasGTKCairo as FigureCanvas
# or NavigationToolbar for classic
-from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar
-#from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
+#from matplotlib.backends.backend_gtk import NavigationToolbar2GTK as NavigationToolbar
+from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
win = gtk.Window()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-06-05 13:45:27 UTC (rev 5394)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-06-05 14:18:31 UTC (rev 5395)
@@ -353,12 +353,12 @@
# for self.window(for pixmap) and has a side effect of altering
# figure width,height (via configure-event?)
gtk.DrawingArea.realize(self)
-
+
width, height = self.get_width_height()
pixmap = gdk.Pixmap (self.window, width, height)
self._renderer.set_pixmap (pixmap)
self._render_figure(pixmap, width, height)
-
+
# jpg colors don't match the display very well, png colors match
# better
pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, 0, 8, width, height)
@@ -382,18 +382,18 @@
raise ValueError("Saving to a Python file-like object is only supported by PyGTK >= 2.8")
else:
raise ValueError("filename must be a path or a file-like object")
-
+
def get_default_filetype(self):
return 'png'
def flush_events(self):
- gtk.gdk.threads_enter()
+ gtk.gdk.threads_enter()
while gtk.events_pending():
gtk.main_iteration(True)
gtk.gdk.flush()
gtk.gdk.threads_leave()
-
-
+
+
class FigureManagerGTK(FigureManagerBase):
"""
Public attributes
@@ -410,7 +410,7 @@
self.window = gtk.Window()
self.window.set_title("Figure %d" % num)
-
+
self.vbox = gtk.VBox()
self.window.add(self.vbox)
self.vbox.show()
@@ -462,7 +462,7 @@
def show(self):
# show the figure window
self.window.show()
-
+
def full_screen_toggle (self):
self._full_screen_flag = not self._full_screen_flag
if self._full_screen_flag:
@@ -742,8 +742,8 @@
self.fileselect = FileChooserDialog(
title='Save the figure',
parent=self.win,
- formats=self.canvas.get_supported_filetypes(),
- default_type=self.canvas.get_default_filetype())
+ filetypes=self.canvas.get_supported_filetypes(),
+ default_filetype=self.canvas.get_default_filetype())
else:
self._create_toolitems_2_2()
self.update = self._update_2_2
@@ -912,53 +912,32 @@
self._ind = ind
self._active = [ self._axes[i] for i in self._ind ]
- def panx(self, button, arg):
- """arg is either user callback data or a scroll event
- """
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
+ def panx(self, button, direction):
+ 'panx in direction'
for a in self._active:
- a.panx(direction)
+ a.xaxis.pan(direction)
self.canvas.draw()
return True
- def pany(self, button, arg):
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
-
+ def pany(self, button, direction):
+ 'pany in direction'
for a in self._active:
- a.pany(direction)
+ a.yaxis.pan(direction)
self.canvas.draw()
return True
- def zoomx(self, button, arg):
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
-
+ def zoomx(self, button, direction):
+ 'zoomx in direction'
for a in self._active:
- a.zoomx(direction)
+ a.xaxis.zoom(direction)
self.canvas.draw()
return True
- def zoomy(self, button, arg):
- try:
- if arg.direction == gdk.SCROLL_UP: direction=1
- else: direction=-1
- except AttributeError:
- direction = arg
-
+ def zoomy(self, button, direction):
+ 'zoomy in direction'
for a in self._active:
- a.zoomy(direction)
+ a.yaxis.zoom(direction)
self.canvas.draw()
return True
@@ -1043,7 +1022,7 @@
break
filename = self.get_filename()
break
-
+
self.hide()
return filename, self.ext
else:
@@ -1075,8 +1054,8 @@
if ext.startswith('.'):
ext = ext[1:]
return filename, ext
-
+
class DialogLineprops:
"""
A GUI dialog for controlling lineprops
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-06-05 13:45:27 UTC (rev 5394)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-06-05 14:18:31 UTC (rev 5395)
@@ -487,46 +487,26 @@
self._ind = ind
self._active = [ self._axes[i] for i in self._ind ]
- def panx(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def panx(self, direction):
for a in self._active:
- a.panx(direction)
+ a.xaxis.pan(direction)
self.canvas.draw()
- def pany(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def pany(self, direction):
for a in self._active:
- a.pany(direction)
+ a.yaxis.pan(direction)
self.canvas.draw()
- def zoomx(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def zoomx(self, direction):
for a in self._active:
- a.zoomx(direction)
+ a.xaxis.zoom(direction)
self.canvas.draw()
- def zoomy(self, arg):
- try: arg.direction
- except AttributeError: direction = arg
- else:
- if arg.direction == Tk.SCROLL_UP: direction=1
- else: direction=-1
+ def zoomy(self, direction):
for a in self._active:
- a.zoomy(direction)
+ a.yaxis.zoom(direction)
self.canvas.draw()
def save_figure(self):
@@ -666,14 +646,14 @@
# so we just have to put it first
default_filetype_name = filetypes[default_filetype]
del filetypes[default_filetype]
-
+
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
sorted_filetypes.insert(0, (default_filetype, default_filetype_name))
-
+
tk_filetypes = [
(name, '*.%s' % ext) for (ext, name) in sorted_filetypes]
-
+
fname = asksaveasfilename(
master=self.window,
title='Save the figure',
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2008-06-05 13:45:27 UTC (rev 5394)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-06-05 14:18:31 UTC (rev 5395)
@@ -639,17 +639,17 @@
ticks = self()
numticks = len(ticks)
+ vmin, vmax = self.axis.get_view_interval()
+ vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander = 0.05)
if numticks>2:
step = numsteps*abs(ticks[0]-ticks[1])
else:
- vmin, vmax = self.axis.get_view_interval()
- vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander = 0.05)
d = abs(vmax-vmin)
step = numsteps*d/6.
vmin += step
vmax += step
- self.axis.set_view_interval(vmin, vmax)
+ self.axis.set_view_interval(vmin, vmax, ignore=True)
def zoom(self, direction):
@@ -658,12 +658,9 @@
vmin, vmax = self.axis.get_view_interval()
vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander = 0.05)
interval = abs(vmax-vmin)
- interval = self.viewInterval.span()
step = 0.1*interval*direction
+ self.axis.set_view_interval(vmin + step, vmax - step, ignore=True)
-
- self.axis.set_view_interval(vmin + step, vmax - step)
-
def refresh(self):
'refresh internal information based on current lim'
pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-05 13:45:29
|
Revision: 5394
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5394&view=rev
Author: mdboom
Date: 2008-06-05 06:45:27 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
Add transformations/paths information to developer docs.
Modified Paths:
--------------
trunk/matplotlib/doc/conf.py
trunk/matplotlib/doc/devel/index.rst
trunk/matplotlib/lib/matplotlib/path.py
trunk/matplotlib/lib/matplotlib/transforms.py
Added Paths:
-----------
trunk/matplotlib/doc/devel/transformations.rst
Modified: trunk/matplotlib/doc/conf.py
===================================================================
--- trunk/matplotlib/doc/conf.py 2008-06-05 11:57:31 UTC (rev 5393)
+++ trunk/matplotlib/doc/conf.py 2008-06-05 13:45:27 UTC (rev 5394)
@@ -159,3 +159,7 @@
latex_use_modindex = True
latex_use_parts = True
+
+# Show both class-level docstring and __init__ docstring in class
+# documentation
+autoclass_content = 'both'
Modified: trunk/matplotlib/doc/devel/index.rst
===================================================================
--- trunk/matplotlib/doc/devel/index.rst 2008-06-05 11:57:31 UTC (rev 5393)
+++ trunk/matplotlib/doc/devel/index.rst 2008-06-05 13:45:27 UTC (rev 5394)
@@ -11,4 +11,6 @@
coding_guide.rst
documenting_mpl.rst
+ transformations.rst
add_new_projection.rst
+
Added: trunk/matplotlib/doc/devel/transformations.rst
===================================================================
--- trunk/matplotlib/doc/devel/transformations.rst (rev 0)
+++ trunk/matplotlib/doc/devel/transformations.rst 2008-06-05 13:45:27 UTC (rev 5394)
@@ -0,0 +1,21 @@
+==============================
+ Working with transformations
+==============================
+
+:mod:`matplotlib.transforms`
+=============================
+
+.. automodule:: matplotlib.transforms
+ :members: TransformNode, BboxBase, Bbox, TransformedBbox, Transform,
+ TransformWrapper, AffineBase, Affine2DBase, Affine2D, IdentityTransform,
+ BlendedGenericTransform, BlendedAffine2D, blended_transform_factory,
+ CompositeGenericTransform, CompositeAffine2D,
+ composite_transform_factory, BboxTransform, BboxTransformTo,
+ BboxTransformFrom, ScaledTranslation, TransformedPath, nonsingular,
+ interval_contains, interval_contains_open
+
+:mod:`matplotlib.path`
+=============================
+
+.. automodule:: matplotlib.path
+ :members: Path, get_path_collection_extents
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py 2008-06-05 11:57:31 UTC (rev 5393)
+++ trunk/matplotlib/lib/matplotlib/path.py 2008-06-05 13:45:27 UTC (rev 5394)
@@ -1,7 +1,5 @@
"""
Contains a class for managing paths (polylines).
-
-October 2007 Michael Droettboom
"""
import math
@@ -21,42 +19,42 @@
closed, line and curve segments.
The underlying storage is made up of two parallel numpy arrays:
- vertices: an Nx2 float array of vertices
- codes: an N-length uint8 array of vertex types
+ - vertices: an Nx2 float array of vertices
+ - codes: an N-length uint8 array of vertex types
These two arrays always have the same length in the first
- dimension. Therefore, to represent a cubic curve, you must
+ dimension. For example, to represent a cubic curve, you must
provide three vertices as well as three codes "CURVE3".
The code types are:
- STOP : 1 vertex (ignored)
- A marker for the end of the entire path (currently not
- required and ignored)
+ - ``STOP`` : 1 vertex (ignored)
+ A marker for the end of the entire path (currently not
+ required and ignored)
- MOVETO : 1 vertex
- Pick up the pen and move to the given vertex.
+ - ``MOVETO`` : 1 vertex
+ Pick up the pen and move to the given vertex.
- LINETO : 1 vertex
- Draw a line from the current position to the given vertex.
+ - ``LINETO`` : 1 vertex
+ Draw a line from the current position to the given vertex.
- CURVE3 : 1 control point, 1 endpoint
+ - ``CURVE3`` : 1 control point, 1 endpoint
Draw a quadratic Bezier curve from the current position,
with the given control point, to the given end point.
- CURVE4 : 2 control points, 1 endpoint
+ - ``CURVE4`` : 2 control points, 1 endpoint
Draw a cubic Bezier curve from the current position, with
the given control points, to the given end point.
- CLOSEPOLY : 1 vertex (ignored)
+ - ``CLOSEPOLY`` : 1 vertex (ignored)
Draw a line segment to the start point of the current
polyline.
Users of Path objects should not access the vertices and codes
- arrays directly. Instead, they should use iter_segments to get
- the vertex/code pairs. This is important since many Paths do not
- store a codes array at all, but have a default one provided for
- them by iter_segments.
+ arrays directly. Instead, they should use :meth:`iter_segments`
+ to get the vertex/code pairs. This is important since many Paths,
+ as an optimization, do not store a codes array at all, but have a
+ default one provided for them by :meth:`iter_segments`.
"""
# Path codes
@@ -81,9 +79,6 @@
codes is an N-length numpy array or Python sequence of type
Path.code_type.
- See the docstring of Path for a description of the various
- codes.
-
These two arrays must have the same length in the first
dimension.
@@ -133,8 +128,8 @@
#@staticmethod
def make_compound_path(*args):
"""
- Make a compound path from a list of Path objects. Only
- polygons (not curves) are supported.
+ (staticmethod) Make a compound path from a list of Path
+ objects. Only polygons (not curves) are supported.
"""
for p in args:
assert p.codes is None
@@ -162,7 +157,10 @@
def iter_segments(self):
"""
- Iterates over all of the curve segments in the path.
+ Iterates over all of the curve segments in the path. Each
+ iteration returns a 2-tuple ``(vertices, code)``, where
+ vertices is a sequence of 1 - 3 coordinate pairs, and code is
+ one of the ``Path`` codes.
"""
vertices = self.vertices
if not len(vertices):
@@ -213,9 +211,9 @@
"""
Return a transformed copy of the path.
- See transforms.TransformedPath for a path that will cache the
- transformed result and automatically update when the transform
- changes.
+ See :class:`matplotlib.transforms.TransformedPath` for a path
+ that will cache the transformed result and automatically
+ update when the transform changes.
"""
return Path(transform.transform(self.vertices), self.codes)
@@ -233,6 +231,9 @@
def contains_path(self, path, transform=None):
"""
Returns True if this path completely contains the given path.
+
+ If transform is not None, the path will be transformed before
+ performing the test.
"""
if transform is not None:
transform = transform.frozen()
@@ -259,7 +260,8 @@
def intersects_bbox(self, bbox):
"""
- Returns True if this path intersects a given Bbox.
+ Returns True if this path intersects a given
+ :class:`~matplotlib.transforms.Bbox`.
"""
from transforms import BboxTransformTo
rectangle = self.unit_rectangle().transformed(
@@ -285,7 +287,9 @@
"""
Convert this path to a list of polygons. Each polygon is an
Nx2 array of vertices. In other words, each polygon has no
- "move to" instructions or curves.
+ ``MOVETO`` instructions or curves. This is useful for
+ displaying in backends that do not support compound paths or
+ Bezier curves, such as GDK.
"""
if transform is not None:
transform = transform.frozen()
@@ -302,7 +306,8 @@
#@classmethod
def unit_rectangle(cls):
"""
- Returns a Path of the unit rectangle from (0, 0) to (1, 1).
+ (staticmethod) Returns a :class:`Path` of the unit rectangle
+ from (0, 0) to (1, 1).
"""
if cls._unit_rectangle is None:
cls._unit_rectangle = \
@@ -314,8 +319,9 @@
#@classmethod
def unit_regular_polygon(cls, numVertices):
"""
- Returns a Path for a unit regular polygon with the given
- numVertices and radius of 1.0, centered at (0, 0).
+ (staticmethod) Returns a :class:`Path` for a unit regular
+ polygon with the given numVertices and radius of 1.0, centered
+ at (0, 0).
"""
if numVertices <= 16:
path = cls._unit_regular_polygons.get(numVertices)
@@ -337,8 +343,9 @@
#@classmethod
def unit_regular_star(cls, numVertices, innerCircle=0.5):
"""
- Returns a Path for a unit regular star with the given
- numVertices and radius of 1.0, centered at (0, 0).
+ (staticmethod) Returns a :class:`Path` for a unit regular star
+ with the given numVertices and radius of 1.0, centered at (0,
+ 0).
"""
if numVertices <= 16:
path = cls._unit_regular_stars.get((numVertices, innerCircle))
@@ -361,8 +368,9 @@
#@classmethod
def unit_regular_asterisk(cls, numVertices):
"""
- Returns a Path for a unit regular asterisk with the given
- numVertices and radius of 1.0, centered at (0, 0).
+ (staticmethod) Returns a :class:`Path` for a unit regular
+ asterisk with the given numVertices and radius of 1.0,
+ centered at (0, 0).
"""
return cls.unit_regular_star(numVertices, 0.0)
unit_regular_asterisk = classmethod(unit_regular_asterisk)
@@ -371,14 +379,13 @@
#@classmethod
def unit_circle(cls):
"""
- Returns a Path of the unit circle. The circle is approximated
- using cubic Bezier curves. This uses 8 splines around the
- circle using the approach presented here:
+ (staticmethod) Returns a :class:`Path` of the unit circle.
+ The circle is approximated using cubic Bezier curves. This
+ uses 8 splines around the circle using the approach presented
+ here:
- Lancaster, Don. Approximating a Circle or an Ellipse Using Four
- Bezier Cubic Splines.
-
- http://www.tinaja.com/glib/ellipse4.pdf
+ Lancaster, Don. `Approximating a Circle or an Ellipse Using Four
+ Bezier Cubic Splines <http://www.tinaja.com/glib/ellipse4.pdf>`_.
"""
if cls._unit_circle is None:
MAGIC = 0.2652031
@@ -434,18 +441,17 @@
#@classmethod
def arc(cls, theta1, theta2, n=None, is_wedge=False):
"""
- Returns an arc on the unit circle from angle theta1 to angle
- theta2 (in degrees).
+ (staticmethod) Returns an arc on the unit circle from angle
+ theta1 to angle theta2 (in degrees).
If n is provided, it is the number of spline segments to make.
- If n is not provided, the number of spline segments is determined
- based on the delta between theta1 and theta2.
+ If n is not provided, the number of spline segments is
+ determined based on the delta between theta1 and theta2.
+
+ Masionobe, L. 2003. `Drawing an elliptical arc using
+ polylines, quadratic or cubic Bezier curves
+ <http://www.spaceroots.org/documents/ellipse/index.html>`_.
"""
- # From Masionobe, L. 2003. "Drawing an elliptical arc using
- # polylines, quadratic or cubic Bezier curves".
- #
- # http://www.spaceroots.org/documents/ellipse/index.html
-
# degrees to radians
theta1 *= np.pi / 180.0
theta2 *= np.pi / 180.0
@@ -514,14 +520,18 @@
#@classmethod
def wedge(cls, theta1, theta2, n=None):
"""
- Returns a wedge of the unit circle from angle theta1 to angle
- theta2 (in degrees).
+ (staticmethod) Returns a wedge of the unit circle from angle
+ theta1 to angle theta2 (in degrees).
"""
return cls.arc(theta1, theta2, n, True)
wedge = classmethod(wedge)
_get_path_collection_extents = get_path_collection_extents
def get_path_collection_extents(*args):
+ """
+ Given a sequence of :class:`Path` objects, returns the bounding
+ box that encapsulates all of them.
+ """
from transforms import Bbox
if len(args[1]) == 0:
raise ValueError("No paths provided")
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2008-06-05 11:57:31 UTC (rev 5393)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-06-05 13:45:27 UTC (rev 5394)
@@ -1,26 +1,32 @@
"""
-This module contains a framework for arbitrary transformations.
+matplotlib includes a framework for arbitrary geometric
+transformations that is used determine the final position of all
+elements drawn on the canvas.
-Transforms are composed into a 'transform tree', made of transforms
-whose value depends on other transforms (their children). When the
-contents of children change, their parents are automatically updated
-to reflect those changes. To do this an "invalidation" method is
-used: when children change, all of their ancestors are marked as
-"invalid". When the value of a transform is accessed at a later time,
-its value is recomputed only if it is invalid, otherwise a cached
-value may be used. This prevents unnecessary recomputations of
-transforms, and contributes to better interactive performance.
+Transforms are composed into trees of ``TransformNode`` objects whose
+actual value depends on their children. When the contents of children
+change, their parents are automatically invalidated. The next time an
+invalidated transform is accessed, it is recomputed to reflect those
+changes. This invalidation/caching approach prevents unnecessary
+recomputations of transforms, and contributes to better interactive
+performance.
+For example, here is a graph of the transform tree used to plot data
+to the graph:
+
+.. image:: ../_static/transforms.png
+
The framework can be used for both affine and non-affine
transformations. However, for speed, we want use the backend
renderers to perform affine transformations whenever possible.
Therefore, it is possible to perform just the affine or non-affine
part of a transformation on a set of data. The affine is always
-assumed to occur after the non-affine. For any transform:
+assumed to occur after the non-affine. For any transform::
- full transform == non-affine + affine
+ full transform == non-affine part + affine part
-2007 Michael Droettboom
+The backends are not expected to handle non-affine transformations
+themselves.
"""
import numpy as np
@@ -30,6 +36,7 @@
from weakref import WeakKeyDictionary
import warnings
+import sets
import cbook
from path import Path
@@ -43,11 +50,11 @@
class TransformNode(object):
"""
- TransformNode is the base class for anything that participates in
- the transform tree and needs to invalidate its parents or be
- invalidated. It can include classes that are not technically
- transforms, such as bounding boxes, since some transforms depend
- on bounding boxes to compute their values.
+ :class:`TransformNode` is the base class for anything that
+ participates in the transform tree and needs to invalidate its
+ parents or be invalidated. This includes classes that are not
+ really transforms, such as bounding boxes, since some transforms
+ depend on bounding boxes to compute their values.
"""
_gid = 0
@@ -88,8 +95,8 @@
def invalidate(self):
"""
- Invalidate this transform node and all of its parents. Should
- be called anytime the transform changes.
+ Invalidate this transform node and all of its ancestors.
+ Should be called any time the transform changes.
"""
# If we are an affine transform being changed, we can set the
# flag to INVALID_AFFINE_ONLY
@@ -116,8 +123,10 @@
def set_children(self, *children):
"""
- Set the children of the transform. Should be called from the
- constructor of any transforms that depend on other transforms.
+ Set the children of the transform, to let the invalidation
+ system know which transforms can invalidate this transform.
+ Should be called from the constructor of any transforms that
+ depend on other transforms.
"""
for child in children:
child._parents[self] = None
@@ -127,6 +136,7 @@
def set_children(self, *children):
self._set_children(*children)
self._children = children
+ set_children.__doc__ = _set_children.__doc__
def frozen(self):
"""
@@ -151,7 +161,7 @@
fobj: A Python file-like object
"""
- seen = cbook.set()
+ seen = sets.Set()
def recurse(root):
if root in seen:
@@ -163,10 +173,7 @@
label = '[%s]' % label
if root in highlight:
props['style'] = 'bold'
- if root.is_affine:
- props['shape'] = 'parallelogram'
- if root.is_bbox:
- props['shape'] = 'box'
+ props['shape'] = 'box'
props['label'] = '"%s"' % label
props = ' '.join(['%s=%s' % (key, val) for key, val in props.items()])
@@ -197,7 +204,13 @@
class BboxBase(TransformNode):
"""
This is the base class of all bounding boxes, and provides
- read-only access to its data.
+ read-only access to its data. A mutable bounding box is provided
+ by the :class:`Bbox` class.
+
+ The canonical representation is as two points, with no
+ restrictions on their ordering. Convenience properties are
+ provided to get the left, bottom, right and top edges and width
+ and height, but these are not stored explicity.
"""
is_bbox = True
is_affine = True
@@ -225,109 +238,165 @@
return self.get_points()
def is_unit(self):
+ """
+ Returns True if the Bbox is the unit bounding box from (0, 0)
+ to (1, 1).
+ """
return list(self.get_points().flatten()) == [0., 0., 1., 1.]
def _get_x0(self):
return self.get_points()[0, 0]
- x0 = property(_get_x0)
+ x0 = property(_get_x0, None, None, """
+ (property) :attr:`x0` is the first of the pair of *x* coordinates that
+ define the bounding box. :attr:`x0` is not guaranteed to be
+ less than :attr:`x1`. If you require that, use :attr:`xmin`.""")
def _get_y0(self):
return self.get_points()[0, 1]
- y0 = property(_get_y0)
+ y0 = property(_get_y0, None, None, """
+ (property) :attr:`y0` is the first of the pair of *y* coordinates that
+ define the bounding box. :attr:`y0` is not guaranteed to be
+ less than :attr:`y1`. If you require that, use :attr:`ymin`.""")
def _get_x1(self):
return self.get_points()[1, 0]
- x1 = property(_get_x1)
+ x1 = property(_get_x1, None, None, """
+ (property) :attr:`x1` is the second of the pair of *x* coordinates that
+ define the bounding box. :attr:`x1` is not guaranteed to be
+ greater than :attr:`x0`. If you require that, use :attr:`xmax`.""")
def _get_y1(self):
return self.get_points()[1, 1]
- y1 = property(_get_y1)
+ y1 = property(_get_y1, None, None, """
+ (property) :attr:`y1` is the second of the pair of *y* coordinates that
+ define the bounding box. :attr:`y1` is not guaranteed to be
+ greater than :attr:`y0`. If you require that, use :attr:`ymax`.""")
def _get_p0(self):
return self.get_points()[0]
- p0 = property(_get_p0)
+ p0 = property(_get_p0, None, None, """
+ (property) :attr:`p0` is the first pair of (*x*, *y*) coordinates that
+ define the bounding box. It is not guaranteed to be the bottom-left
+ corner. For that, use :attr:`min`.""")
def _get_p1(self):
return self.get_points()[1]
- p1 = property(_get_p1)
+ p1 = property(_get_p1, None, None, """
+ (property) :attr:`p1` is the second pair of (*x*, *y*) coordinates that
+ define the bounding box. It is not guaranteed to be the top-right
+ corner. For that, use :attr:`max`.""")
def _get_xmin(self):
return min(self.get_points()[:, 0])
- xmin = property(_get_xmin)
+ xmin = property(_get_xmin, None, None, """
+ (property) :attr:`xmin` is the left edge of the bounding box.""")
def _get_ymin(self):
return min(self.get_points()[:, 1])
- ymin = property(_get_ymin)
+ ymin = property(_get_ymin, None, None, """
+ (property) :attr:`ymin` is the bottom edge of the bounding box.""")
def _get_xmax(self):
return max(self.get_points()[:, 0])
- xmax = property(_get_xmax)
+ xmax = property(_get_xmax, None, None, """
+ (property) :attr:`xmax` is the right edge of the bounding box.""")
def _get_ymax(self):
return max(self.get_points()[:, 1])
- ymax = property(_get_ymax)
+ ymax = property(_get_ymax, None, None, """
+ (property) :attr:`ymax` is the top edge of the bounding box.""")
def _get_min(self):
return [min(self.get_points()[:, 0]),
min(self.get_points()[:, 1])]
- min = property(_get_min)
+ min = property(_get_min, None, None, """
+ (property) :attr:`min` is the bottom-left corner of the bounding box.""")
def _get_max(self):
return [max(self.get_points()[:, 0]),
max(self.get_points()[:, 1])]
- max = property(_get_max)
+ max = property(_get_max, None, None, """
+ (property) :attr:`max` is the top-right corner of the bounding box.""")
def _get_intervalx(self):
return self.get_points()[:, 0]
- intervalx = property(_get_intervalx)
+ intervalx = property(_get_intervalx, None, None, """
+ (property) :attr:`intervalx` is the pair of *x* coordinates that define the
+ bounding box. It is not guaranteed to be sorted from left to right.""")
def _get_intervaly(self):
return self.get_points()[:, 1]
- intervaly = property(_get_intervaly)
+ intervaly = property(_get_intervaly, None, None, """
+ (property) :attr:`intervaly` is the pair of *y* coordinates that define the
+ bounding box. It is not guaranteed to be sorted from bottom to top.""")
def _get_width(self):
points = self.get_points()
return points[1, 0] - points[0, 0]
- width = property(_get_width)
+ width = property(_get_width, None, None, """
+ (property) The width of the bounding box. It may be negative if :attr:`x1` <
+ :attr:`x0`.""")
def _get_height(self):
points = self.get_points()
return points[1, 1] - points[0, 1]
- height = property(_get_height)
+ height = property(_get_height, None, None, """
+ (property) The height of the bounding box. It may be negative if :attr:`y1` <
+ :attr:`y0`.""")
def _get_size(self):
points = self.get_points()
return points[1] - points[0]
- size = property(_get_size)
+ size = property(_get_size, None, None, """
+ (property) The width and height of the bounding box. May be negative, in the same
+ way as :attr:`width` and :attr:`height`.""")
def _get_bounds(self):
x0, y0, x1, y1 = self.get_points().flatten()
return (x0, y0, x1 - x0, y1 - y0)
- bounds = property(_get_bounds)
+ bounds = property(_get_bounds, None, None, """
+ (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`).""")
def _get_extents(self):
return self.get_points().flatten().copy()
- extents = property(_get_extents)
+ extents = property(_get_extents, None, None, """
+ (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`).""")
def get_points(self):
return NotImplementedError()
def containsx(self, x):
+ """
+ Returns True if x is between or equal to :attr:`x0` and
+ :attr:`x1`.
+ """
x0, x1 = self.intervalx
return ((x0 < x1
and (x >= x0 and x <= x1))
or (x >= x1 and x <= x0))
def containsy(self, y):
+ """
+ Returns True if y is between or equal to :attr:`y0` and
+ :attr:`y1`.
+ """
y0, y1 = self.intervaly
return ((y0 < y1
and (y >= y0 and y <= y1))
or (y >= y1 and y <= y0))
def contains(self, x, y):
+ """
+ Returns True if (x, y) is a coordinate inside the bounding
+ box or on its edge.
+ """
return self.containsx(x) and self.containsy(y)
def overlaps(self, other):
+ """
+ Returns True if this bounding box overlaps with the given
+ bounding box ``other``.
+ """
ax1, ay1, ax2, ay2 = self._get_extents()
bx1, by1, bx2, by2 = other._get_extents()
@@ -346,22 +415,37 @@
(by1 > ay2))
def fully_containsx(self, x):
+ """
+ Returns True if x is between but not equal to :attr:`x0` and
+ :attr:`x1`.
+ """
x0, x1 = self.intervalx
return ((x0 < x1
and (x > x0 and x < x1))
or (x > x1 and x < x0))
def fully_containsy(self, y):
+ """
+ Returns True if y is between but not equal to :attr:`y0` and
+ :attr:`y1`.
+ """
y0, y1 = self.intervaly
return ((y0 < y1
and (x > y0 and x < y1))
or (x > y1 and x < y0))
def fully_contains(self, x, y):
+ """
+ Returns True if (x, y) is a coordinate inside the bounding
+ box, but not on its edge.
+ """
return self.fully_containsx(x) \
and self.fully_containsy(y)
def fully_overlaps(self, other):
+ """
+ Returns True if this bounding box overlaps with the given
+ bounding box ``other``, but not on its edge alone."""
ax1, ay1, ax2, ay2 = self._get_extents()
bx1, by1, bx2, by2 = other._get_extents()
@@ -381,14 +465,15 @@
def transformed(self, transform):
"""
- Return a new Bbox object, transformed by the given transform.
+ Return a new :class:`Bbox` object, statically transformed by
+ the given transform.
"""
return Bbox(transform.transform(self.get_points()))
def inverse_transformed(self, transform):
"""
- Return a new Bbox object, transformed by the inverse of the
- given transform.
+ Return a new :class:`Bbox` object, statically transformed by
+ the inverse of the given transform.
"""
return Bbox(transform.inverted().transform(self.get_points()))
@@ -406,13 +491,20 @@
Return a copy of the Bbox, shifted to position c within a
container.
- c: may be either a) a sequence (cx, cy) where cx, cy range
- from 0 to 1, where 0 is left or bottom and 1 is right or top;
- or b) a string: C for centered, S for bottom-center, SE for
- bottom-left, E for left, etc.
+ c: may be either:
- Optional arg container is the box within which the BBox
- is positioned; it defaults to the initial BBox.
+ * a sequence (cx, cy) where cx, cy range
+ from 0 to 1, where 0 is left or bottom and 1 is right or top
+
+ * a string:
+ - C for centered
+ - S for bottom-center
+ - SE for bottom-left
+ - E for left
+ - etc.
+
+ Optional argument ``container`` is the box within which the :class:`Bbox`
+ is positioned; it defaults to the initial :class:`Bbox`.
"""
if container is None:
container = self
@@ -428,10 +520,10 @@
def shrunk(self, mx, my):
"""
- Return a copy of the Bbox, shurnk by the factor mx in the x
- direction and the factor my in the y direction. The lower
- left corner of the box remains unchanged. Normally mx and my
- will be <= 1, but this is not enforced.
+ Return a copy of the :class:`Bbox`, shurnk by the factor mx in
+ the *x* direction and the factor my in the *y* direction. The
+ lower left corner of the box remains unchanged. Normally mx
+ and my will be less than 1, but this is not enforced.
"""
w, h = self.size
return Bbox([self._points[0],
@@ -439,13 +531,13 @@
def shrunk_to_aspect(self, box_aspect, container = None, fig_aspect = 1.0):
"""
- Return a copy of the Bbox, shrunk so that it is as large as it
- can be while having the desired aspect ratio, box_aspect. If
- the box coordinates are relative--that is, fractions of a
- larger box such as a figure--then the physical aspect ratio of
- that figure is specified with fig_aspect, so that box_aspect
- can also be given as a ratio of the absolute dimensions, not
- the relative dimensions.
+ Return a copy of the :class:`Bbox`, shrunk so that it is as
+ large as it can be while having the desired aspect ratio,
+ ``box_aspect``. If the box coordinates are relative---that
+ is, fractions of a larger box such as a figure---then the
+ physical aspect ratio of that figure is specified with
+ ``fig_aspect``, so that ``box_aspect`` can also be given as a
+ ratio of the absolute dimensions, not the relative dimensions.
"""
assert box_aspect > 0 and fig_aspect > 0
if container is None:
@@ -462,11 +554,11 @@
def splitx(self, *args):
"""
- e.g., bbox.splitx(f1, f2, ...)
+ e.g., ``bbox.splitx(f1, f2, ...)``
- Returns a list of new BBoxes formed by
- splitting the original one with vertical lines
- at fractional positions f1, f2, ...
+ Returns a list of new :class:`Bbox` objects formed by
+ splitting the original one with vertical lines at fractional
+ positions f1, f2, ...
"""
boxes = []
xf = [0] + list(args) + [1]
@@ -478,11 +570,11 @@
def splity(self, *args):
"""
- e.g., bbox.splitx(f1, f2, ...)
+ e.g., ``bbox.splitx(f1, f2, ...)``
- Returns a list of new PBoxes formed by
- splitting the original one with horizontal lines
- at fractional positions f1, f2, ...
+ Returns a list of new :class:`Bbox` objects formed by
+ splitting the original one with horizontal lines at fractional
+ positions f1, f2, ...
"""
boxes = []
yf = [0] + list(args) + [1]
@@ -513,14 +605,15 @@
"""
Count the number of bounding boxes that overlap this one.
- bboxes is a sequence of Bbox objects
+ bboxes is a sequence of :class:`BboxBase` objects
"""
return count_bboxes_overlapping_bbox(self, bboxes)
def expanded(self, sw, sh):
"""
- Return a new Bbox which is this Bbox expanded around its
- center by the given factors sw and sh.
+ Return a new :class:`Bbox` which is this :class:`Bbox`
+ expanded around its center by the given factors ``sw`` and
+ ``sh``.
"""
width = self.width
height = self.height
@@ -531,31 +624,34 @@
def padded(self, p):
"""
- Return a new Bbox that is padded on all four sides by the
- given value.
+ Return a new :class:`Bbox` that is padded on all four sides by
+ the given value.
"""
points = self._points
return Bbox(points + [[-p, -p], [p, p]])
def translated(self, tx, ty):
"""
- Return a copy of the Bbox, translated by tx and ty.
+ Return a copy of the :class:`Bbox`, statically translated by
+ tx and ty.
"""
return Bbox(self._points + (tx, ty))
def corners(self):
"""
Return an array of points which are the four corners of this
- rectangle.
+ rectangle. For example, if this :class:`Bbox` is defined by
+ the points (a, b) and (c, d), ``corners`` returns (a, b), (a,
+ d), (c, b) and (c, d).
"""
l, b, r, t = self.get_points().flatten()
return np.array([[l, b], [l, t], [r, b], [r, t]])
def rotated(self, radians):
"""
- Return a new bounding box that bounds a rotated version of this
- bounding box. The new bounding box is still aligned with the
- axes, of course.
+ Return a new bounding box that bounds a rotated version of
+ this bounding box by the given radians. The new bounding box
+ is still aligned with the axes, of course.
"""
corners = self.corners()
corners_rotated = Affine2D().rotate(radians).transform(corners)
@@ -566,7 +662,7 @@
#@staticmethod
def union(bboxes):
"""
- Return a Bbox that contains all of the given bboxes.
+ Return a :class:`Bbox` that contains all of the given bboxes.
"""
assert(len(bboxes))
@@ -592,14 +688,17 @@
class Bbox(BboxBase):
+ """
+ A mutable bounding box.
+ """
+
def __init__(self, points):
"""
- Create a new bounding box.
-
points: a 2x2 numpy array of the form [[x0, y0], [x1, y1]]
- If you need to create Bbox from another form of data, consider the
- class methods unit, from_bounds and from_extents.
+ If you need to create a :class:`Bbox` object from another form
+ of data, consider the static methods unit, from_bounds and
+ from_extents.
"""
BboxBase.__init__(self)
self._points = np.asarray(points, np.float_)
@@ -620,7 +719,8 @@
#@staticmethod
def unit():
"""
- Create a new unit BBox from (0, 0) to (1, 1).
+ (staticmethod) Create a new unit :class:`Bbox` from (0, 0) to
+ (1, 1).
"""
return Bbox(Bbox._unit_values.copy())
unit = staticmethod(unit)
@@ -628,7 +728,8 @@
#@staticmethod
def from_bounds(x0, y0, width, height):
"""
- Create a new Bbox from x0, y0, width and height.
+ (staticmethod) Create a new :class:`Bbox` from x0, y0, width
+ and height.
width and height may be negative.
"""
@@ -638,7 +739,8 @@
#@staticmethod
def from_extents(*args):
"""
- Create a new Bbox from left, bottom, right and top.
+ (staticmethod) Create a new Bbox from left, bottom, right and
+ top.
The y-axis increases upwards.
"""
@@ -653,26 +755,32 @@
def ignore(self, value):
"""
Set whether the existing bounds of the box should be ignored
- by subsequent calls to update_from_data or
- update_from_data_xy.
+ by subsequent calls to :meth:`update_from_data` or
+ :meth:`update_from_data_xy`.
- value: When True, subsequent calls to update_from_data will
- ignore the existing bounds of the Bbox.
- When False, subsequent calls to update_from_data will
- include the existing bounds of the Bbox.
+ value:
+
+ - When True, subsequent calls to :meth:`update_from_data`
+ will ignore the existing bounds of the :class:`Bbox`.
+
+ - When False, subsequent calls to :meth:`update_from_data`
+ will include the existing bounds of the :class:`Bbox`.
"""
self._ignore = value
def update_from_data(self, x, y, ignore=None):
"""
- Update the bounds of the Bbox based on the passed in data.
+ Update the bounds of the :class:`Bbox` based on the passed in
+ data.
x: a numpy array of x-values
+
y: a numpy array of y-values
+
ignore:
- when True, ignore the existing bounds of the Bbox.
- when False, include the existing bounds of the Bbox.
- when None, use the last value passed to Bbox.ignore().
+ - when True, ignore the existing bounds of the Bbox.
+ - when False, include the existing bounds of the Bbox.
+ - when None, use the last value passed to :meth:`ignore`.
"""
warnings.warn("update_from_data requires a memory copy -- please replace with update_from_data_xy")
xy = np.hstack((x.reshape((len(x), 1)), y.reshape((len(y), 1))))
@@ -680,13 +788,15 @@
def update_from_data_xy(self, xy, ignore=None):
"""
- Update the bounds of the Bbox based on the passed in data.
+ Update the bounds of the :class:`Bbox` based on the passed in
+ data.
xy: a numpy array of 2D points
+
ignore:
- when True, ignore the existing bounds of the Bbox.
- when False, include the existing bounds of the Bbox.
- when None, use the last value passed to Bbox.ignore().
+ - when True, ignore the existing bounds of the Bbox.
+ - when False, include the existing bounds of the Bbox.
+ - when None, use the last value passed to :meth:`ignore`.
"""
if ignore is None:
ignore = self._ignore
@@ -767,7 +877,7 @@
def get_points(self):
"""
- Set the points of the bounding box directly as a numpy array
+ Get the points of the bounding box directly as a numpy array
of the form: [[x0, y0], [x1, y1]].
"""
self._invalid = 0
@@ -794,13 +904,14 @@
class TransformedBbox(BboxBase):
"""
- A Bbox that is automatically transformed by a given Transform. When
- either the child bbox or transform changes, the bounds of this bbox
- will update accordingly.
+ A :class:`Bbox` that is automatically transformed by a given
+ transform. When either the child bounding box or transform
+ changes, the bounds of this bbox will update accordingly.
"""
def __init__(self, bbox, transform):
"""
bbox: a child bbox
+
transform: a 2D transform
"""
assert bbox.is_bbox
@@ -827,6 +938,7 @@
self._points = points
self._invalid = 0
return self._points
+ get_points.__doc__ = Bbox.get_points.__doc__
if DEBUG:
_get_points = get_points
@@ -840,24 +952,25 @@
The base class of all TransformNodes that actually perform a
transformation.
- All non-affine transformations should be subclass this class. New
- affine transformations should subclass Affine2D.
+ All non-affine transformations should be subclasses of this class.
+ New affine transformations should be subclasses of
+ :class:`Affine2D`.
Subclasses of this class should override the following members (at
minimum):
- input_dims
- output_dims
- transform
- is_separable
- has_inverse
- inverted (if has_inverse will return True)
+ - :attr:`input_dims`
+ - :attr:`output_dims`
+ - :meth:`transform`
+ - :attr:`is_separable`
+ - :attr:`has_inverse`
+ - :meth:`inverted` (if :meth:`has_inverse` can return True)
- If the transform needs to do something non-standard with Paths,
- such as adding curves where there were once line segments, it
- should override:
+ If the transform needs to do something non-standard with
+ :class:`mathplotlib.path.Path` objects, such as adding curves
+ where there were once line segments, it should override:
- transform_path
+ - :meth:`transform_path`
"""
# The number of input and output dimensions for this transform.
# These must be overridden (with integers) in the subclass.
@@ -885,6 +998,9 @@
"Can not add Transform to object of type '%s'" % type(other))
def __radd__(self, other):
+ """
+ Composes two transforms together such that self is followed by other.
+ """
if isinstance(other, Transform):
return composite_transform_factory(other, self)
raise TypeError(
@@ -900,8 +1016,8 @@
"""
Performs the transformation on the given array of values.
- Accepts a numpy array of shape (N x self.input_dims) and
- returns a numpy array of shape (N x self.output_dims).
+ Accepts a numpy array of shape (N x :attr:`input_dims`) and
+ returns a numpy array of shape (N x :attr:`output_dims`).
"""
raise NotImplementedError()
@@ -910,15 +1026,15 @@
Performs only the affine part of this transformation on the
given array of values.
- transform(values) is equivalent to
- transform_affine(transform_non_affine(values)).
+ ``transform(values)`` is always equivalent to
+ ``transform_affine(transform_non_affine(values))``.
In non-affine transformations, this is generally a no-op. In
affine transformations, this is equivalent to
- transform(values).
+ ``transform(values)``.
- Accepts a numpy array of shape (N x self.input_dims) and
- returns a numpy array of shape (N x self.output_dims).
+ Accepts a numpy array of shape (N x :attr:`input_dims`) and
+ returns a numpy array of shape (N x :attr:`output_dims`).
"""
return values
@@ -926,15 +1042,15 @@
"""
Performs only the non-affine part of the transformation.
- transform(values) is equivalent to
- transform_affine(transform_non_affine(values)).
+ ``transform(values)`` is always equivalent to
+ ``transform_affine(transform_non_affine(values))``.
In non-affine transformations, this is generally equivalent to
- transform(values). In affine transformations, this is a
- no-op.
+ ``transform(values)``. In affine transformations, this is
+ always a no-op.
- Accepts a numpy array of shape (N x self.input_dims) and
- returns a numpy array of shape (N x self.output_dims).
+ Accepts a numpy array of shape (N x :attr:`input_dims`) and
+ returns a numpy array of shape (N x :attr:`output_dims`).
"""
return self.transform(points)
@@ -949,11 +1065,11 @@
A convenience function that returns the transformed copy of a
single point.
- The point is given as a sequence of length self.input_dims.
+ The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
- self.output_dims.
+ :attr:`output_dims`.
"""
- assert len(point) == 2
+ assert len(point) == self.input_dims
return self.transform(np.asarray([point]))[0]
def transform_path(self, path):
@@ -974,8 +1090,8 @@
path: a Path instance
- transform_path(path) is equivalent to
- transform_path_affine(transform_path_non_affine(values)).
+ ``transform_path(path)`` is equivalent to
+ ``transform_path_affine(transform_path_non_affine(values))``.
"""
return path
@@ -986,8 +1102,8 @@
path: a Path instance
- transform_path(path) is equivalent to
- transform_path_affine(transform_path_non_affine(values)).
+ ``transform_path(path)`` is equivalent to
+ ``transform_path_affine(transform_path_non_affine(values))``.
"""
return Path(self.transform_non_affine(path.vertices), path.codes)
@@ -999,7 +1115,7 @@
temporary. An update to 'self' does not cause a corresponding
update to its inverted copy.
- x === self.inverted().transform(self.transform(x))
+ ``x === self.inverted().transform(self.transform(x))``
"""
raise NotImplementedError()
@@ -1013,17 +1129,17 @@
run time with a transform of a different type. This class allows
that replacement to correctly trigger invalidation.
- Note that TransformWrapper instances must have the same input and
- output dimensions during their entire lifetime, so the child
- transform may only be replaced with another child transform of the
- same dimensions.
+ Note that :class:`TransformWrapper` instances must have the same
+ input and output dimensions during their entire lifetime, so the
+ child transform may only be replaced with another child transform
+ of the same dimensions.
"""
pass_through = True
def __init__(self, child):
"""
child: A Transform instance. This child may later be replaced
- with set().
+ with :meth:`set`.
"""
assert isinstance(child, Transform)
@@ -1133,13 +1249,14 @@
"""
The base class of all 2D affine transformations.
- 2D affine transformations are performed using a 3x3 numpy array:
+ 2D affine transformations are performed using a 3x3 numpy array::
a c e
b d f
0 0 1
- Provides the read-only interface.
+ This class provides the read-only interface. For a mutable 2D
+ affine transformation, use :class:`Affine2D`.
Subclasses of this class will generally only need to override a
constructor and 'get_matrix' that generates a custom 3x3 matrix.
@@ -1175,7 +1292,8 @@
#@staticmethod
def matrix_from_values(a, b, c, d, e, f):
"""
- Create a new transformation matrix as a 3x3 numpy array of the form:
+ (staticmethod) Create a new transformation matrix as a 3x3
+ numpy array of the form::
a c e
b d f
@@ -1194,6 +1312,7 @@
def transform_point(self, point):
mtx = self.get_matrix()
return affine_transform(point, mtx)
+ transform_point.__doc__ = AffineBase.transform_point.__doc__
if DEBUG:
_transform = transform
@@ -1223,9 +1342,13 @@
class Affine2D(Affine2DBase):
+ """
+ A mutable 2D affine transformation.
+ """
+
def __init__(self, matrix = None):
"""
- Initialize an Affine transform from a 3x3 numpy float array:
+ Initialize an Affine transform from a 3x3 numpy float array::
a c e
b d f
@@ -1255,7 +1378,8 @@
#@staticmethod
def from_values(a, b, c, d, e, f):
"""
- Create a new Affine2D instance from the given values:
+ (staticmethod) Create a new Affine2D instance from the given
+ values::
a c e
b d f
@@ -1268,7 +1392,7 @@
def get_matrix(self):
"""
- Get the underlying transformation matrix as a 3x3 numpy array:
+ Get the underlying transformation matrix as a 3x3 numpy array::
a c e
b d f
@@ -1279,7 +1403,7 @@
def set_matrix(self, mtx):
"""
- Set the underlying transformation matrix from a 3x3 numpy array:
+ Set the underlying transformation matrix from a 3x3 numpy array::
a c e
b d f
@@ -1291,7 +1415,7 @@
def set(self, other):
"""
Set this transformation from the frozen copy of another
- Affine2DBase instance.
+ :class:`Affine2DBase` object.
"""
assert isinstance(other, Affine2DBase)
self._mtx = other.get_matrix()
@@ -1300,10 +1424,11 @@
#@staticmethod
def identity():
"""
- Return a new Affine2D instance that is the identity transform.
+ (staticmethod) Return a new :class:`Affine2D` object that is
+ the identity transform.
Unless this transform will be mutated later on, consider using
- the faster IdentityTransform class instead.
+ the faster :class:`IdentityTransform` class instead.
"""
return Affine2D(np.identity(3))
identity = staticmethod(identity)
@@ -1321,7 +1446,8 @@
Add a rotation (in radians) to this transform in place.
Returns self, so this method can easily be chained with more
- calls to rotate(), rotate_deg(), translate() and scale().
+ calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
+ and :meth:`scale`.
"""
a = np.cos(theta)
b = np.sin(theta)
@@ -1337,7 +1463,8 @@
Add a rotation (in degrees) to this transform in place.
Returns self, so this method can easily be chained with more
- calls to rotate(), rotate_deg(), translate() and scale().
+ calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
+ and :meth:`scale`.
"""
return self.rotate(degrees*np.pi/180.)
@@ -1346,7 +1473,8 @@
Add a rotation (in radians) around the point (x, y) in place.
Returns self, so this method can easily be chained with more
- calls to rotate(), rotate_deg(), translate() and scale().
+ calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
+ and :meth:`scale`.
"""
return self.translate(-x, -y).rotate(theta).translate(x, y)
@@ -1355,7 +1483,8 @@
Add a rotation (in degrees) around the point (x, y) in place.
Returns self, so this method can easily be chained with more
- calls to rotate(), rotate_deg(), translate() and scale().
+ calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
+ and :meth:`scale`.
"""
return self.translate(-x, -y).rotate_deg(degrees).translate(x, y)
@@ -1364,7 +1493,8 @@
Adds a translation in place.
Returns self, so this method can easily be chained with more
- calls to rotate(), rotate_deg(), translate() and scale().
+ calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
+ and :meth:`scale`.
"""
translate_mtx = np.array(
[[1.0, 0.0, tx], [0.0, 1.0, ty], [0.0, 0.0, 1.0]],
@@ -1381,7 +1511,8 @@
y-directions.
Returns self, so this method can easily be chained with more
- calls to rotate(), rotate_deg(), translate() and scale().
+ calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
+ and :meth:`scale`.
"""
if sy is None:
sy = sx
@@ -1464,8 +1595,8 @@
transform the x-axis and y_transform to transform the y_axis.
You will generally not call this constructor directly but use
- the blended_transform_factory function instead, which can
- determine automatically which kind of blended transform to
+ the :func:`blended_transform_factory` function instead, which
+ can determine automatically which kind of blended transform to
create.
"""
# Here we ask: "Does it blend?"
@@ -1565,8 +1696,8 @@
Both x_transform and y_transform must be 2D affine transforms.
You will generally not call this constructor directly but use
- the blended_transform_factory function instead, which can
- determine automatically which kind of blended transform to
+ the :func:`blended_transform_factory` function instead, which
+ can determine automatically which kind of blended transform to
create.
"""
assert x_transform.is_affine
@@ -1608,8 +1739,8 @@
Create a new "blended" transform using x_transform to
transform the x-axis and y_transform to transform the y_axis.
- Shortcut versions of the blended transform are provided for the
- case where both child transforms are affine.
+ A faster version of the blended transform is returned for the case
+ where both child transforms are affine.
"""
if (isinstance(x_transform, Affine2DBase)
and isinstance(y_transform, Affine2DBase)):
@@ -1631,9 +1762,9 @@
applying transform a then transform b.
You will generally not call this constructor directly but use
- the composite_transform_factory function instead, which can
- automatically choose the best kind of composite transform
- instance to create.
+ the :func:`composite_transform_factory` function instead,
+ which can automatically choose the best kind of composite
+ transform instance to create.
"""
assert a.output_dims == b.input_dims
self.input_dims = a.input_dims
@@ -1722,12 +1853,12 @@
Create a new composite transform that is the result of
applying transform a then transform b.
- Both a and b must be instances of Affine2DBase.
+ Both a and b must be instances of :class:`Affine2DBase`.
You will generally not call this constructor directly but use
- the composite_transform_factory function instead, which can
- automatically choose the best kind of composite transform
- instance to create.
+ the :func:`composite_transform_factory` function instead,
+ which can automatically choose the best kind of composite
+ transform instance to create.
"""
assert a.output_dims == b.input_dims
self.input_dims = a.input_dims
@@ -1765,7 +1896,8 @@
case where both child transforms are affine, or one or the other
is the identity transform.
- Composite TransformNodes may also be created using the '+' operator, e.g.:
+ Composite transforms may also be created using the '+' operator,
+ e.g.:
c = a + b
"""
@@ -1823,15 +1955,15 @@
class BboxTransformTo(Affine2DBase):
"""
- BboxTransformSimple linearly transforms points from the unit Bbox
- to another Bbox.
+ BboxTransformTo is a transformation that linearly transforms
+ points from the unit bounding box to a given :class:`Bbox`.
"""
is_separable = True
def __init__(self, boxout):
"""
- Create a new BboxTransform that linearly transforms points
- from the unit Bbox to boxout.
+ Create a new :class:`BboxTransformTo` that linearly transforms
+ points from the unit bounding box to boxout.
"""
assert boxout.is_bbox
@@ -1862,16 +1994,12 @@
class BboxTransformFrom(Affine2DBase):
"""
- BboxTransform linearly transforms points from one Bbox to the unit
- Bbox.
+ BboxTransform linearly transforms points from a given
+ :class:`Bbox` to the unit bounding box.
"""
is_separable = True
def __init__(self, boxin):
- """
- Create a new BboxTransform that linearly transforms points
- from boxin to the unit Bbox.
- """
assert boxin.is_bbox
Affine2DBase.__init__(self)
@@ -1902,6 +2030,10 @@
class ScaledTranslation(Affine2DBase):
+ """
+ A transformation that translates by xt and yt, after xt and yt
+ have been transformaed by the given transform scale_trans.
+ """
def __init__(self, xt, yt, scale_trans):
Affine2DBase.__init__(self)
self._t = (xt, yt)
@@ -1978,7 +2110,7 @@
Ensure the endpoints of a range are not too close together.
"too close" means the interval is smaller than 'tiny' times
- the maximum absolute value.
+ the maximum absolute value.
If they are too close, each will be moved by the 'expander'.
If 'increasing' is True and vmin > vmax, they will be swapped,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-05 11:57:33
|
Revision: 5393
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5393&view=rev
Author: jswhit
Date: 2008-06-05 04:57:31 -0700 (Thu, 05 Jun 2008)
Log Message:
-----------
adjust for new num2date defaults.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/fcstmaps.py
trunk/toolkits/basemap/examples/pnganim.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py 2008-06-05 01:18:55 UTC (rev 5392)
+++ trunk/toolkits/basemap/examples/fcstmaps.py 2008-06-05 11:57:31 UTC (rev 5393)
@@ -37,7 +37,7 @@
times = fcsttimes[0:6] # first 6 forecast times.
ntimes = len(times)
# convert times for datetime instances.
-fdates = num2date(times,fcsttimes.units)
+fdates = num2date(times,units=fcsttimes.units,calendar='standard')
# make a list of YYYYMMDDHH strings.
verifdates = [fdate.strftime('%Y%m%d%H') for fdate in fdates]
# convert times to forecast hours.
Modified: trunk/toolkits/basemap/examples/pnganim.py
===================================================================
--- trunk/toolkits/basemap/examples/pnganim.py 2008-06-05 01:18:55 UTC (rev 5392)
+++ trunk/toolkits/basemap/examples/pnganim.py 2008-06-05 11:57:31 UTC (rev 5393)
@@ -42,7 +42,7 @@
longitudes = data.variables['lon'][:].tolist()
times = data.variables['time']
# convert numeric time values to datetime objects.
-fdates = num2date(times[:],times.units)
+fdates = num2date(times[:],units=times.units,calendar='standard')
# put times in YYYYMMDDHH format.
dates = [fdate.strftime('%Y%m%d%H') for fdate in fdates]
if YYYYMMDDHH1 not in dates or YYYYMMDDHH2 not in dates:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-05 01:19:02
|
Revision: 5392
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5392&view=rev
Author: jswhit
Date: 2008-06-04 18:18:55 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
change num2date/date2num default behavior so it is same as matplotlib's.
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-06-04 19:11:39 UTC (rev 5391)
+++ trunk/toolkits/basemap/Changelog 2008-06-05 01:18:55 UTC (rev 5392)
@@ -1,3 +1,5 @@
+ * change default behaviour of num2date and date2num to be
+ the same as matplotlib counterparts.
version 0.99 (svn revision 5344)
* fix to warpimage method for API change in matplotlib 0.98.0.
* updated pyproj to 1.8.6.
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-04 19:11:39 UTC (rev 5391)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-05 01:18:55 UTC (rev 5392)
@@ -3263,7 +3263,7 @@
f = pupynere._LocalFile(file,maskandscale)
return f
-def num2date(times,units,calendar='standard'):
+def num2date(times,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'):
"""
Return datetime objects given numeric time values. The units
of the numeric time values are described by the units argument
@@ -3271,10 +3271,9 @@
UTC with no time-zone offset, even if the specified
units contain a time-zone offset.
- Like the matplotlib num2date function, except that it allows
- for different units and calendars. Behaves the same if
- units = 'days since 001-01-01 00:00:00' and
- calendar = 'proleptic_gregorian'.
+ Default behavior is the same as the matplotlib num2date function
+ but the reference time and calendar can be changed via the
+ 'units' and 'calendar' keywords.
Arguments:
@@ -3282,8 +3281,8 @@
units - a string of the form '<time units> since <reference time>'
describing the time units. <time units> can be days, hours, minutes
- or seconds. <reference time> is the time origin. A valid choice
- would be units='hours since 1800-01-01 00:00:00 -6:00'.
+ or seconds. <reference time> is the time origin.
+ Default is 'days since 0001-01-01 00:00:00'.
calendar - describes the calendar used in the time calculations.
All the values currently defined in the CF metadata convention
@@ -3291,7 +3290,7 @@
Valid calendars 'standard', 'gregorian', 'proleptic_gregorian'
'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'.
Default is 'standard'/'gregorian', which is a mixed
- Julian/Gregorian calendar.
+ Julian/Gregorian calendar. Defalut 'proleptic_gregorian'.
Returns a datetime instance, or an array of datetime instances.
@@ -3306,7 +3305,7 @@
cdftime = netcdftime.utime(units,calendar=calendar)
return cdftime.num2date(times)
-def date2num(dates,units,calendar='standard'):
+def date2num(dates,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'):
"""
Return numeric time values given datetime objects. The units
of the numeric time values are described by the units argument
@@ -3315,10 +3314,9 @@
time-zone offset in units, it will be applied to the
returned numeric values.
- Like the matplotlib date2num function, except that it allows
- for different units and calendars. Behaves the same if
- units = 'days since 0001-01-01 00:00:00' and
- calendar = 'proleptic_gregorian'.
+ Default behavior is the same as the matplotlib date2num function
+ but the reference time and calendar can be changed via the
+ 'units' and 'calendar' keywords.
Arguments:
@@ -3327,8 +3325,8 @@
units - a string of the form '<time units> since <reference time>'
describing the time units. <time units> can be days, hours, minutes
- or seconds. <reference time> is the time origin. A valid choice
- would be units='hours since 1800-01-01 00:00:00 -6:00'.
+ or seconds. <reference time> is the time origin.
+ Default is 'days since 0001-01-01 00:00:00'.
calendar - describes the calendar used in the time calculations.
All the values currently defined in the CF metadata convention
@@ -3336,7 +3334,7 @@
Valid calendars 'standard', 'gregorian', 'proleptic_gregorian'
'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'.
Default is 'standard'/'gregorian', which is a mixed
- Julian/Gregorian calendar.
+ Julian/Gregorian calendar. Default 'proleptic_gregorian'.
Returns a numeric time value, or an array of numeric time values.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-04 19:11:48
|
Revision: 5391
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5391&view=rev
Author: jdh2358
Date: 2008-06-04 12:11:39 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
rename figure title demo
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/figure_title.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab_examples/figtext.py
Deleted: trunk/matplotlib/examples/pylab_examples/figtext.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/figtext.py 2008-06-04 19:11:16 UTC (rev 5390)
+++ trunk/matplotlib/examples/pylab_examples/figtext.py 2008-06-04 19:11:39 UTC (rev 5391)
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-from matplotlib.font_manager import FontProperties
-from pylab import *
-
-def f(t):
- s1 = cos(2*pi*t)
- e1 = exp(-t)
- return multiply(s1,e1)
-
-t1 = arange(0.0, 5.0, 0.1)
-t2 = arange(0.0, 5.0, 0.02)
-t3 = arange(0.0, 2.0, 0.01)
-
-
-subplot(121)
-plot(t1, f(t1), 'bo', t2, f(t2), 'k')
-title('subplot 1')
-ylabel('Damped oscillation')
-suptitle('This is a somewhat long figure title', fontsize=16)
-
-
-subplot(122)
-plot(t3, cos(2*pi*t3), 'r--')
-xlabel('time (s)')
-title('subplot 2')
-ylabel('Undamped')
-
-#savefig('figtext')
-show()
-
Copied: trunk/matplotlib/examples/pylab_examples/figure_title.py (from rev 5390, trunk/matplotlib/examples/pylab_examples/figtext.py)
===================================================================
--- trunk/matplotlib/examples/pylab_examples/figure_title.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/figure_title.py 2008-06-04 19:11:39 UTC (rev 5391)
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+from matplotlib.font_manager import FontProperties
+from pylab import *
+
+def f(t):
+ s1 = cos(2*pi*t)
+ e1 = exp(-t)
+ return multiply(s1,e1)
+
+t1 = arange(0.0, 5.0, 0.1)
+t2 = arange(0.0, 5.0, 0.02)
+t3 = arange(0.0, 2.0, 0.01)
+
+
+subplot(121)
+plot(t1, f(t1), 'bo', t2, f(t2), 'k')
+title('subplot 1')
+ylabel('Damped oscillation')
+suptitle('This is a somewhat long figure title', fontsize=16)
+
+
+subplot(122)
+plot(t3, cos(2*pi*t3), 'r--')
+xlabel('time (s)')
+title('subplot 2')
+ylabel('Undamped')
+
+#savefig('figtext')
+show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-04 19:11:19
|
Revision: 5390
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5390&view=rev
Author: jdh2358
Date: 2008-06-04 12:11:16 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
added suptitle
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/figtext.py
trunk/matplotlib/lib/matplotlib/figure.py
trunk/matplotlib/lib/matplotlib/pylab.py
trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-06-04 18:52:07 UTC (rev 5389)
+++ trunk/matplotlib/CHANGELOG 2008-06-04 19:11:16 UTC (rev 5390)
@@ -1,3 +1,6 @@
+2006-06-04 Added a figure title command subtitle as a Figure method
+ and pyplot command -- see examples/figure_title.py - JDH
+
2008-06-02 Added support for log to hist with histtype='step' and fixed
a bug for log-scale stacked histograms - MM
Modified: trunk/matplotlib/examples/pylab_examples/figtext.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/figtext.py 2008-06-04 18:52:07 UTC (rev 5389)
+++ trunk/matplotlib/examples/pylab_examples/figtext.py 2008-06-04 19:11:16 UTC (rev 5390)
@@ -16,10 +16,7 @@
plot(t1, f(t1), 'bo', t2, f(t2), 'k')
title('subplot 1')
ylabel('Damped oscillation')
-figtitle = 'This is a somewhat long figure title'
-t = gcf().text(0.5, 0.95, figtitle,
- horizontalalignment='center',
- fontproperties=FontProperties(size=16))
+suptitle('This is a somewhat long figure title', fontsize=16)
subplot(122)
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py 2008-06-04 18:52:07 UTC (rev 5389)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2008-06-04 19:11:16 UTC (rev 5390)
@@ -313,6 +313,35 @@
'get the figure bounding box in display space; kwargs are void'
return self.bbox
+ def suptitle(self, t, **kwargs):
+ """
+ add a centered title to the figure
+
+ kwargs are matplotlib.text.Text properties. Using figure
+ coordinates, the defaults are
+
+ x = 0.5
+ y = 0.98
+ horizontalalignment = 'center'
+ verticalalignment = 'top'
+
+ The matplotlib.text.Text instance is returned
+
+ Example:
+
+ fig.subtitle('this is the figure title', fontsize=12)
+ """
+ x = kwargs.pop('x', 0.5)
+ y = kwargs.pop('y', 0.98)
+ if ('horizontalalignment' not in kwargs) and ('ha' not in kwargs):
+ kwargs['horizontalalignment'] = 'center'
+
+ if ('verticalalignment' not in kwargs) and ('va' not in kwargs):
+ kwargs['verticalalignment'] = 'top'
+
+ t = self.text(x, y, t, **kwargs)
+ return t
+
def set_canvas(self, canvas):
"""
Set the canvas the contains the figure
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py 2008-06-04 18:52:07 UTC (rev 5389)
+++ trunk/matplotlib/lib/matplotlib/pylab.py 2008-06-04 19:11:16 UTC (rev 5390)
@@ -78,6 +78,7 @@
subplot - make a subplot (numrows, numcols, axesnum)
subplots_adjust - change the params controlling the subplot positions of current figure
subplot_tool - launch the subplot configuration tool
+ suptitle - add a figure title
table - add a table to the plot
text - add some text at location x,y to the current axes
thetagrids - customize the radial theta grids and labels for polar
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-06-04 18:52:07 UTC (rev 5389)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-06-04 19:11:16 UTC (rev 5390)
@@ -303,6 +303,13 @@
if Figure.text.__doc__ is not None:
figtext.__doc__ = dedent(Figure.text.__doc__)
+def suptitle(*args, **kwargs):
+ ret = gcf().suptitle(*args, **kwargs)
+ draw_if_interactive()
+ return ret
+if Figure.suptitle.__doc__ is not None:
+ suptitle.__doc__ = dedent(Figure.suptitle.__doc__)
+
def figimage(*args, **kwargs):
# allow callers to override the hold state by passing hold=True|False
ret = gcf().figimage(*args, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-04 18:52:26
|
Revision: 5389
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5389&view=rev
Author: mdboom
Date: 2008-06-04 11:52:07 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
Fix typo in docs.
Modified Paths:
--------------
trunk/matplotlib/doc/users/mathtext.rst
Modified: trunk/matplotlib/doc/users/mathtext.rst
===================================================================
--- trunk/matplotlib/doc/users/mathtext.rst 2008-06-04 18:31:19 UTC (rev 5388)
+++ trunk/matplotlib/doc/users/mathtext.rst 2008-06-04 18:52:07 UTC (rev 5389)
@@ -193,7 +193,7 @@
``\breve a`` :math:`\breve a`
``\ddot a`` or ``\"a`` :math:`\ddot a`
``\dot a`` or ``\.a`` :math:`\dot a`
- ``\grave a`` or ``\\`a`` :math:`\grave a`
+ ``\grave a`` or ``\`a`` :math:`\grave a`
``\hat a`` or ``\^a`` :math:`\hat a`
``\tilde a`` or ``\~a`` :math:`\tilde a`
``\vec a`` :math:`\vec a`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-04 18:31:20
|
Revision: 5388
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5388&view=rev
Author: mdboom
Date: 2008-06-04 11:31:19 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
Removing some debugging output.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-06-04 18:25:41 UTC (rev 5387)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-06-04 18:31:19 UTC (rev 5388)
@@ -2108,16 +2108,6 @@
+ (group | Error("Expected \sqrt{value}"))
).setParseAction(self.sqrt).setName("sqrt")
- print (accent
- ^ function
- ^ (c_over_c | symbol)
- ^ group
- ^ frac
- ^ sqrt
- ) | Error("Expected symbol or group")
-
- print Error("Expected symbol or group")
-
placeable <<(accent
^ function
^ (c_over_c | symbol)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-06-04 18:25:44
|
Revision: 5387
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5387&view=rev
Author: jdh2358
Date: 2008-06-04 11:25:41 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
fixed backend driver to see the new pylab_examples dir
Modified Paths:
--------------
trunk/matplotlib/examples/tests/backend_driver.py
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py 2008-06-04 18:21:35 UTC (rev 5386)
+++ trunk/matplotlib/examples/tests/backend_driver.py 2008-06-04 18:25:41 UTC (rev 5387)
@@ -22,7 +22,7 @@
all_backends = [b.lower() for b in mplbe.all_backends]
all_backends.extend(['cairo.png', 'cairo.ps', 'cairo.pdf', 'cairo.svg'])
-pylab_dir = os.path.join('..', 'pylab')
+pylab_dir = os.path.join('..', 'pylab_examples')
pylab_files = [
'alignment_test.py',
'arctest.py',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|