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: <ef...@us...> - 2009-03-29 03:43:59
|
Revision: 7012
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7012&view=rev
Author: efiring
Date: 2009-03-29 03:43:49 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
Added Karen Tracey's threading_test.py.
Added Paths:
-----------
trunk/matplotlib/unit/threading_test.py
Added: trunk/matplotlib/unit/threading_test.py
===================================================================
--- trunk/matplotlib/unit/threading_test.py (rev 0)
+++ trunk/matplotlib/unit/threading_test.py 2009-03-29 03:43:49 UTC (rev 7012)
@@ -0,0 +1,70 @@
+#! /usr/bin/python
+"""
+Test by Karen Tracey for threading problem reported in
+http://www.mail-archive.com/mat...@li.../msg04819.html
+and solved by JDH with svn r7008.
+"""
+
+import os
+import threading
+import traceback
+
+import numpy as np
+from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
+from matplotlib.figure import Figure
+
+thread_count = 8
+max_iterations = 50
+exception_raised = False
+
+def png_thread(tn):
+ png_fname = 'out%d.png' % tn
+ vals = 100 + 15 * np.random.randn(10000)
+
+ i = 0
+ excp = None
+ global exception_raised
+ while not exception_raised and i < max_iterations:
+ i += 1
+ png_f = open(png_fname, 'wb')
+
+ try:
+ fig = Figure()
+ ax = fig.add_subplot(111)
+ ax.hist(vals, 50)
+ FigureCanvas(fig).print_png(png_f)
+
+ except Exception, excp:
+ pass
+
+ png_f.close()
+ if excp:
+ print 'png_thread %d failed on iteration %d:' % (tn, i)
+ print traceback.format_exc(excp)
+ exception_raised = True
+ else:
+ print 'png_thread %d completed iteration %d.' % (tn, i)
+
+ os.unlink(png_fname)
+
+def main(tc):
+ threads = []
+ for i in range(tc):
+ threads.append(threading.Thread(target=png_thread, args=(i+1,)))
+
+ for t in threads:
+ t.start()
+
+ for t in threads:
+ t.join()
+
+ if not exception_raised:
+ msg = 'Success! %d threads completed %d iterations with no exceptions raised.'
+ else:
+ msg = 'Failed! Exception raised before %d threads completed %d iterations.'
+
+ print msg % (tc, max_iterations)
+
+if __name__== "__main__":
+ main(thread_count)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-29 00:54:19
|
Revision: 7011
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7011&view=rev
Author: jswhit
Date: 2009-03-29 00:54:14 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
print message if LightSource not found
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plotmap_shaded.py
Modified: trunk/toolkits/basemap/examples/plotmap_shaded.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-03-28 21:13:38 UTC (rev 7010)
+++ trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-03-29 00:54:14 UTC (rev 7011)
@@ -7,8 +7,12 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
-from matplotlib.colors import LightSource
+try:
+ from matplotlib.colors import LightSource
+except ImportError:
+ raise ImportError("Need a more recent version of matplotlib to run this example")
+
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
topoin = mlab.load('etopo20data.gz')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-03-28 21:13:47
|
Revision: 7010
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7010&view=rev
Author: efiring
Date: 2009-03-28 21:13:38 +0000 (Sat, 28 Mar 2009)
Log Message:
-----------
Make images handle invalid values as if masked.
A little cleanup and docstring addition to image.py was included.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-03-28 00:59:44 UTC (rev 7009)
+++ trunk/matplotlib/CHANGELOG 2009-03-28 21:13:38 UTC (rev 7010)
@@ -1,3 +1,6 @@
+2009-03-28 Make images handle nan in their array argument.
+ A helper, cbook.safe_masked_invalid() was added. - EF
+
2009-03-25 Make contour and contourf handle nan in their Z argument. - EF
2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation.
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2009-03-28 00:59:44 UTC (rev 7009)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-03-28 21:13:38 UTC (rev 7010)
@@ -933,6 +933,15 @@
except TypeError:
return False
+def safe_masked_invalid(x):
+ x = np.asanyarray(x)
+ try:
+ xm = np.ma.masked_invalid(x, copy=False)
+ xm.shrink_mask()
+ except TypeError:
+ return x
+ return xm
+
class MemoryMonitor:
def __init__(self, nmax=20000):
self._nmax = nmax
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2009-03-28 00:59:44 UTC (rev 7009)
+++ trunk/matplotlib/lib/matplotlib/image.py 2009-03-28 21:13:38 UTC (rev 7010)
@@ -10,13 +10,14 @@
from numpy import ma
from matplotlib import rcParams
-from matplotlib import artist as martist
-from matplotlib import colors as mcolors
-from matplotlib import cm
+import matplotlib.artist as martist
+import matplotlib.colors as mcolors
+import matplotlib.cm as cm
+import matplotlib.cbook as cbook
# For clarity, names from _image are given explicitly in this module:
-from matplotlib import _image
-from matplotlib import _png
+import matplotlib._image as _image
+import matplotlib._png as _png
# For user convenience, the names from _image are also imported into
# the image namespace:
@@ -238,8 +239,9 @@
clippath, affine)
def contains(self, mouseevent):
- """Test whether the mouse event occured within the image.
"""
+ Test whether the mouse event occured within the image.
+ """
if callable(self._contains): return self._contains(self,mouseevent)
# TODO: make sure this is consistent with patch and patch
# collection on nonlinear transformed coordinates.
@@ -271,18 +273,17 @@
rows, cols, buffer = im.as_rgba_str()
_png.write_png(buffer, cols, rows, fname)
- def set_data(self, A, shape=None):
+ def set_data(self, A):
"""
Set the image array
- ACCEPTS: numpy/PIL Image A"""
+ ACCEPTS: numpy/PIL Image A
+ """
# check if data is PIL Image without importing Image
if hasattr(A,'getpixel'):
self._A = pil_to_array(A)
- elif ma.isMA(A):
- self._A = A
else:
- self._A = np.asarray(A) # assume array
+ self._A = cbook.safe_masked_invalid(A)
if self._A.dtype != np.uint8 and not np.can_cast(self._A.dtype, np.float):
raise TypeError("Image data can not convert to float")
@@ -310,8 +311,9 @@
def set_extent(self, extent):
- """extent is data axes (left, right, bottom, top) for making image plots
"""
+ extent is data axes (left, right, bottom, top) for making image plots
+ """
self._extent = extent
xmin, xmax, ymin, ymax = extent
@@ -375,7 +377,8 @@
return (-0.5, numcols-0.5, -0.5, numrows-0.5)
def set_filternorm(self, filternorm):
- """Set whether the resize filter norms the weights -- see
+ """
+ Set whether the resize filter norms the weights -- see
help for imshow
ACCEPTS: 0 or 1
@@ -390,7 +393,8 @@
return self._filternorm
def set_filterrad(self, filterrad):
- """Set the resize filter radius only applicable to some
+ """
+ Set the resize filter radius only applicable to some
interpolation schemes -- see help for imshow
ACCEPTS: positive float
@@ -405,9 +409,11 @@
class NonUniformImage(AxesImage):
- def __init__(self, ax,
- **kwargs
- ):
+ def __init__(self, ax, **kwargs):
+ """
+ kwargs are identical to those for AxesImage, except
+ that 'interpolation' defaults to 'nearest'
+ """
interp = kwargs.pop('interpolation', 'nearest')
AxesImage.__init__(self, ax,
**kwargs)
@@ -434,10 +440,19 @@
return im
def set_data(self, x, y, A):
+ """
+ Set the grid for the pixel centers, and the pixel values.
+
+ *x* and *y* are 1-D ndarrays of lengths N and M, respectively,
+ specifying pixel centers
+
+ *A* is an (M,N) ndarray or masked array of values to be
+ colormapped, or a (M,N,3) RGB array, or a (M,N,4) RGBA
+ array.
+ """
x = np.asarray(x,np.float32)
y = np.asarray(y,np.float32)
- if not ma.isMA(A):
- A = np.asarray(A)
+ A = cbook.safe_masked_invalid(A)
if len(x.shape) != 1 or len(y.shape) != 1\
or A.shape[0:2] != (y.shape[0], x.shape[0]):
raise TypeError("Axes don't match array shape")
@@ -567,8 +582,7 @@
def set_data(self, x, y, A):
- if not ma.isMA(A):
- A = np.asarray(A)
+ A = cbook.safe_masked_invalid(A)
if x is None:
x = np.arange(0, A.shape[1]+1, dtype=np.float64)
else:
@@ -666,6 +680,19 @@
return (-0.5+self.ox, numcols-0.5+self.ox,
-0.5+self.oy, numrows-0.5+self.oy)
+ def set_data(self, A):
+ """
+ Set the image array
+
+ """
+ cm.ScalarMappable.set_array(self, cbook.safe_masked_invalid(A))
+
+ def set_array(self, A):
+ """
+ Deprecated; use set_data for consistency with other image types.
+ """
+ self.set_data(A)
+
def make_image(self, magnification=1.0):
if self._A is None:
raise RuntimeError('You must first set the image array')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-28 00:59:54
|
Revision: 7009
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7009&view=rev
Author: jswhit
Date: 2009-03-28 00:59:44 +0000 (Sat, 28 Mar 2009)
Log Message:
-----------
lightsource --> LightSource
Modified Paths:
--------------
trunk/toolkits/basemap/examples/plotmap_shaded.py
Modified: trunk/toolkits/basemap/examples/plotmap_shaded.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-03-27 21:11:07 UTC (rev 7008)
+++ trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-03-28 00:59:44 UTC (rev 7009)
@@ -7,7 +7,7 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
-from matplotlib.colors import lightsource
+from matplotlib.colors import LightSource
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
@@ -27,7 +27,7 @@
nx = int((m.xmax-m.xmin)/40000.)+1; ny = int((m.ymax-m.ymin)/40000.)+1
topodat,x,y = m.transform_scalar(topoin,lons,lats,nx,ny,returnxy=True)
# create light source object.
-ls = lightsource(azdeg = 90, altdeg = 20)
+ls = LightSource(azdeg = 90, altdeg = 20)
# convert data to rgb array including shading from light source.
# (must specify color map)
rgb = ls.shade(topodat, plt.cm.jet)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-27 21:11:15
|
Revision: 7008
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7008&view=rev
Author: jdh2358
Date: 2009-03-27 21:11:07 +0000 (Fri, 27 Mar 2009)
Log Message:
-----------
moved agg caches to instance namespace for thread safety
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-03-27 21:10:24 UTC (rev 7007)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-03-27 21:11:07 UTC (rev 7008)
@@ -46,11 +46,12 @@
context instance that controls the colors/styles
"""
debug=1
- texd = maxdict(50) # a cache of tex image rasters
- _fontd = maxdict(50)
def __init__(self, width, height, dpi):
if __debug__: verbose.report('RendererAgg.__init__', 'debug-annoying')
RendererBase.__init__(self)
+ self.texd = maxdict(50) # a cache of tex image rasters
+ self._fontd = maxdict(50)
+
self.dpi = dpi
self.width = width
self.height = height
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-03-27 21:10:51
|
Revision: 7007
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7007&view=rev
Author: jswhit
Date: 2009-03-27 21:10:24 +0000 (Fri, 27 Mar 2009)
Log Message:
-----------
changed name of lightsource class to LightSource to conform to coding guidelines.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/shading_example.py
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-03-27 18:11:18 UTC (rev 7006)
+++ trunk/matplotlib/CHANGELOG 2009-03-27 21:10:24 UTC (rev 7007)
@@ -9,7 +9,7 @@
2009-03-17 Fix bugs in edge color handling by contourf, found
by Jae-Joon Lee. - EF
-2009-03-14 Added 'lightsource' class to colors module for
+2009-03-14 Added 'LightSource' class to colors module for
creating shaded relief maps. shading_example.py
added to illustrate usage. - JSW
Modified: trunk/matplotlib/examples/pylab_examples/shading_example.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-27 18:11:18 UTC (rev 7006)
+++ trunk/matplotlib/examples/pylab_examples/shading_example.py 2009-03-27 21:10:24 UTC (rev 7007)
@@ -1,6 +1,6 @@
import numpy as np
import matplotlib.pyplot as plt
-from matplotlib.colors import lightsource
+from matplotlib.colors import LightSource
# example showing how to make shaded relief plots
# like mathematica
@@ -12,7 +12,7 @@
X,Y=np.mgrid[-5:5:0.05,-5:5:0.05]
Z=np.sqrt(X**2+Y**2)+np.sin(X**2+Y**2)
# creat light source object.
-ls = lightsource(azdeg=0,altdeg=65)
+ls = LightSource(azdeg=0,altdeg=65)
# shade data, creating an rgb array.
rgb = ls.shade(Z,plt.cm.copper)
# plot un-shaded and shaded images.
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2009-03-27 18:11:18 UTC (rev 7006)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2009-03-27 21:10:24 UTC (rev 7007)
@@ -955,7 +955,7 @@
rgb[:,:,0]=r; rgb[:,:,1]=g; rgb[:,:,2]=b
return rgb
-class lightsource(object):
+class LightSource(object):
"""
Create a light source coming from the specified azimuth and elevation.
Angles are in degrees, with the azimuth measured
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-27 18:11:35
|
Revision: 7006
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7006&view=rev
Author: jdh2358
Date: 2009-03-27 18:11:18 +0000 (Fri, 27 Mar 2009)
Log Message:
-----------
applied Gael's sphinx patch
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Modified: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-03-25 19:27:28 UTC (rev 7005)
+++ trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py 2009-03-27 18:11:18 UTC (rev 7006)
@@ -17,6 +17,7 @@
"""
import sys, os, glob, shutil, hashlib, imp, warnings, cStringIO
+import re
try:
from hashlib import md5
except ImportError:
@@ -33,7 +34,10 @@
import sphinx
sphinx_version = sphinx.__version__.split(".")
-sphinx_version = tuple([int(x) for x in sphinx_version[:2]])
+# The split is necessary for sphinx beta versions where the string is
+# '6b1'
+sphinx_version = tuple([int(re.split('[a-z]', x)[0])
+ for x in sphinx_version[:2]])
import matplotlib
import matplotlib.cbook as cbook
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-03-25 19:27:32
|
Revision: 7005
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7005&view=rev
Author: efiring
Date: 2009-03-25 19:27:28 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
Contouring handles nans in Z via masking.
(The bug in filled contouring with internal masked regions
remains.)
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/contourf_demo.py
trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-03-24 01:57:26 UTC (rev 7004)
+++ trunk/matplotlib/CHANGELOG 2009-03-25 19:27:28 UTC (rev 7005)
@@ -1,5 +1,7 @@
-2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation.
- anchored_text.py example is enhanced and renamed
+2009-03-25 Make contour and contourf handle nan in their Z argument. - EF
+
+2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation.
+ anchored_text.py example is enhanced and renamed
(anchored_artists.py). - JJL
2009-03-20 Add "bar" connection style for annotation - JJL
Modified: trunk/matplotlib/examples/pylab_examples/contourf_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/contourf_demo.py 2009-03-24 01:57:26 UTC (rev 7004)
+++ trunk/matplotlib/examples/pylab_examples/contourf_demo.py 2009-03-25 19:27:28 UTC (rev 7005)
@@ -3,7 +3,9 @@
origin = 'lower'
#origin = 'upper'
-test_masking = False # There is a bug in filled contour masking.
+# The following controls only interior masking.
+test_masking = False # There is a bug in filled contour masking with
+ # interior masks.
if test_masking:
# Use a coarse grid so only a few masked points are needed.
@@ -30,6 +32,18 @@
Z[0,0] = 0
Z = ma.array(Z, mask=badmask)
+nr, nc = Z.shape
+
+# put NaNs in one corner:
+Z[-nr//6:, -nc//6:] = nan
+# contourf will convert these to masked
+
+
+Z = ma.array(Z)
+# mask another corner:
+Z[:nr//6, :nc//6] = ma.masked
+
+
# We are using automatic selection of contour levels;
# this is usually not such a good idea, because they don't
# occur on nice boundaries, but we do it here for purposes
@@ -48,7 +62,7 @@
origin=origin,
hold='on')
-title('Nonsense')
+title('Nonsense (with 2 masked corners)')
xlabel('word length anomaly')
ylabel('sentence length anomaly')
@@ -72,7 +86,7 @@
colors = ('k',),
linewidths = (3,),
origin = origin)
-title('Listed colors')
+title('Listed colors (with 2 masked corners)')
clabel(CS4, fmt = '%2.1f', colors = 'w', fontsize=14)
colorbar(CS3)
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py 2009-03-24 01:57:26 UTC (rev 7004)
+++ trunk/matplotlib/lib/matplotlib/contour.py 2009-03-25 19:27:28 UTC (rev 7005)
@@ -756,6 +756,7 @@
x,y,z = self._check_xyz(args[:3])
else:
raise TypeError("Too many arguments to %s; see help(%s)" % (fn,fn))
+ z = ma.masked_invalid(z, copy=False)
self.zmax = ma.maximum(z)
self.zmin = ma.minimum(z)
if self.logscale and self.zmin <= 0:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-24 01:57:39
|
Revision: 7004
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7004&view=rev
Author: jdh2358
Date: 2009-03-24 01:57:26 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
ticker typo fixes
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2009-03-24 01:49:18 UTC (rev 7003)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-03-24 01:57:26 UTC (rev 7004)
@@ -920,13 +920,13 @@
"""
Keyword args:
*prune*
- Remove edge ticks -- useful for stacked or ganed plots
+ Remove edge ticks -- useful for stacked or ganged plots
where the upper tick of one axes overlaps with the lower
- tick of the axes above it. one of 'lower' | 'upper'|
+ tick of the axes above it. One of 'lower' | 'upper' |
'both' | None. If prune=='lower', the smallest tick will
be removed. If prune=='upper', the largest tick will be
removed. If prune=='both', the largest and smallest ticks
- will be removed. If prune==None, no ticks will be removed
+ will be removed. If prune==None, no ticks will be removed.
"""
self._nbins = int(nbins)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-24 01:49:26
|
Revision: 7003
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7003&view=rev
Author: jdh2358
Date: 2009-03-24 01:49:18 +0000 (Tue, 24 Mar 2009)
Log Message:
-----------
added prune option to maxnlocataor; updated finance demo
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/finance_work2.py
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-23 19:18:35 UTC (rev 7002)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-24 01:49:18 UTC (rev 7003)
@@ -201,7 +201,7 @@
ax3.text(0.025, 0.95, 'MACD (%d, %d, %d)'%(nfast, nslow, nema), va='top',
transform=ax3.transAxes, fontsize=textsize)
-ax3.set_yticks([])
+#ax3.set_yticks([])
# turn off upper axis tick labels, rotate the lower ones, etc
for ax in ax1, ax2, ax2t, ax3:
if ax!=ax3:
@@ -215,15 +215,11 @@
ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
-class PriceFormatter(mticker.FormatStrFormatter):
- 'suppress the lowest tick label to prevent overlap'
- def __call__(self, x, pos=None):
- if pos==0:
- return ''
- else:
- return mticker.FormatStrFormatter.__call__(self, x, pos=None)
-ax2.yaxis.set_major_formatter(PriceFormatter('%d'))
+# at most 5 ticks, pruning the upper and lower so they don't overlap
+# with other ticks
+ax2.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both'))
+ax3.yaxis.set_major_locator(mticker.MaxNLocator(5, prune='both'))
plt.show()
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2009-03-23 19:18:35 UTC (rev 7002)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-03-24 01:49:18 UTC (rev 7003)
@@ -913,13 +913,27 @@
"""
def __init__(self, nbins = 10, steps = None,
- trim = True,
- integer=False,
- symmetric=False):
+ trim = True,
+ integer=False,
+ symmetric=False,
+ prune=None):
+ """
+ Keyword args:
+ *prune*
+ Remove edge ticks -- useful for stacked or ganed plots
+ where the upper tick of one axes overlaps with the lower
+ tick of the axes above it. one of 'lower' | 'upper'|
+ 'both' | None. If prune=='lower', the smallest tick will
+ be removed. If prune=='upper', the largest tick will be
+ removed. If prune=='both', the largest and smallest ticks
+ will be removed. If prune==None, no ticks will be removed
+
+ """
self._nbins = int(nbins)
self._trim = trim
self._integer = integer
self._symmetric = symmetric
+ self._prune = prune
if steps is None:
self._steps = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10]
else:
@@ -957,7 +971,16 @@
def __call__(self):
vmin, vmax = self.axis.get_view_interval()
vmin, vmax = mtransforms.nonsingular(vmin, vmax, expander = 0.05)
- return self.bin_boundaries(vmin, vmax)
+ locs = self.bin_boundaries(vmin, vmax)
+ #print 'locs=', locs
+ prune = self._prune
+ if prune=='lower':
+ locs = locs[1:]
+ elif prune=='upper':
+ locs = locs[:-1]
+ elif prune=='both':
+ locs = locs[1:-1]
+ return locs
def view_limits(self, dmin, dmax):
if self._symmetric:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-23 19:18:43
|
Revision: 7002
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7002&view=rev
Author: mdboom
Date: 2009-03-23 19:18:35 +0000 (Mon, 23 Mar 2009)
Log Message:
-----------
Merged revisions 6997,7001 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6997 | mdboom | 2009-03-19 09:15:00 -0400 (Thu, 19 Mar 2009) | 2 lines
Fix bug in Cairo backend related to clipping -- thanks Nathaniel Smith
........
r7001 | ryanmay | 2009-03-23 14:52:29 -0400 (Mon, 23 Mar 2009) | 1 line
Fix typo. Thanks to Sandro Tosi.
........
Modified Paths:
--------------
trunk/matplotlib/doc/users/screenshots.rst
trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6995
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7001
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
Modified: trunk/matplotlib/doc/users/screenshots.rst
===================================================================
--- trunk/matplotlib/doc/users/screenshots.rst 2009-03-23 18:52:29 UTC (rev 7001)
+++ trunk/matplotlib/doc/users/screenshots.rst 2009-03-23 19:18:35 UTC (rev 7002)
@@ -82,7 +82,7 @@
==========
The :func:`~matplotlib.pyplot.pie` command
-uses a matlab(TM) compatible syntax to produce py charts. Optional
+uses a matlab(TM) compatible syntax to produce pie charts. Optional
features include auto-labeling the percentage of area, exploding one
or more wedges out from the center of the pie, and a shadow effect.
Take a close look at the attached code that produced this figure; nine
@@ -268,6 +268,3 @@
:ref:`user_interfaces-mpl_with_glade`.
.. image:: ../_static/eeg_small.png
-
-
-
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-03-23 18:52:29 UTC (rev 7001)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-03-23 19:18:35 UTC (rev 7002)
@@ -109,6 +109,23 @@
# font transform?
+ def _do_clip(self, ctx, cliprect, clippath):
+ if cliprect is not None:
+ x,y,w,h = cliprect.bounds
+ # pixel-aligned clip-regions are faster
+ x,y,w,h = round(x), round(y), round(w), round(h)
+ ctx.new_path()
+ ctx.rectangle (x, self.height - h - y, w, h)
+ ctx.clip ()
+
+ if clippath is not None:
+ tpath, affine = clippath.get_transformed_path_and_affine()
+ ctx.new_path()
+ affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.height)
+ tpath = affine.transform_path(tpath)
+ RendererCairo.convert_path(ctx, tpath)
+ ctx.clip()
+
def _fill_and_stroke (self, ctx, fill_c, alpha):
if fill_c is not None:
ctx.save()
@@ -120,7 +137,6 @@
ctx.restore()
ctx.stroke()
-
@staticmethod
def convert_path(ctx, path, transform):
for points, code in path.iter_segments(transform):
@@ -143,6 +159,9 @@
raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")
ctx = gc.ctx
+ ctx.save()
+ self._do_clip(ctx, gc._cliprect, gc._clippath)
+
transform = transform + \
Affine2D().scale(1.0, -1.0).translate(0, self.height)
@@ -150,6 +169,7 @@
self.convert_path(ctx, path, transform)
self._fill_and_stroke(ctx, rgbFace, gc.get_alpha())
+ ctx.restore()
def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
# bbox - not currently used
@@ -162,9 +182,16 @@
buf, cairo.FORMAT_ARGB32, cols, rows, cols*4)
# function does not pass a 'gc' so use renderer.ctx
ctx = self.ctx
+ ctx.save()
+ if clippath is not None:
+ tpath = clippath_trans.transform_path(clippath)
+ ctx.new_path()
+ RendererCairo.convert_path(ctx, tpath)
+ ctx.clip()
y = self.height - y - rows
ctx.set_source_surface (surface, x, y)
ctx.paint()
+ ctx.restore()
im.flipud_out()
@@ -322,30 +349,10 @@
def set_clip_rectangle(self, rectangle):
self._cliprect = rectangle
- if rectangle is None:
- return
- x,y,w,h = rectangle.bounds
- # pixel-aligned clip-regions are faster
- x,y,w,h = round(x), round(y), round(w), round(h)
- ctx = self.ctx
- ctx.new_path()
- ctx.rectangle (x, self.renderer.height - h - y, w, h)
- ctx.clip ()
- # Alternative: just set _cliprect here and actually set cairo clip rect
- # in fill_and_stroke() inside ctx.save() ... ctx.restore()
-
-
def set_clip_path(self, path):
- if path is not None:
- tpath, affine = path.get_transformed_path_and_affine()
- ctx = self.ctx
- ctx.new_path()
- affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.renderer.height)
- RendererCairo.convert_path(ctx, path, affine)
- ctx.clip()
+ self._clippath = path
-
def set_dashes(self, offset, dashes):
self._dashes = offset, dashes
if dashes == None:
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
+ /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-03-23 18:52:33
|
Revision: 7001
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7001&view=rev
Author: ryanmay
Date: 2009-03-23 18:52:29 +0000 (Mon, 23 Mar 2009)
Log Message:
-----------
Fix typo. Thanks to Sandro Tosi.
Modified Paths:
--------------
branches/v0_98_5_maint/doc/users/screenshots.rst
Modified: branches/v0_98_5_maint/doc/users/screenshots.rst
===================================================================
--- branches/v0_98_5_maint/doc/users/screenshots.rst 2009-03-20 20:26:00 UTC (rev 7000)
+++ branches/v0_98_5_maint/doc/users/screenshots.rst 2009-03-23 18:52:29 UTC (rev 7001)
@@ -82,7 +82,7 @@
==========
The :func:`~matplotlib.pyplot.pie` command
-uses a matlab(TM) compatible syntax to produce py charts. Optional
+uses a matlab(TM) compatible syntax to produce pie charts. Optional
features include auto-labeling the percentage of area, exploding one
or more wedges out from the center of the pie, and a shadow effect.
Take a close look at the attached code that produced this figure; nine
@@ -268,6 +268,3 @@
:ref:`user_interfaces-mpl_with_glade`.
.. image:: ../_static/eeg_small.png
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-03-20 20:26:10
|
Revision: 7000
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7000&view=rev
Author: leejjoon
Date: 2009-03-20 20:26:00 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Add AuxTransformBox in offsetbox.py
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/offsetbox.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/anchored_artists.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab_examples/anchored_text.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-03-20 20:10:42 UTC (rev 6999)
+++ trunk/matplotlib/CHANGELOG 2009-03-20 20:26:00 UTC (rev 7000)
@@ -1,3 +1,7 @@
+2009-03-20 Add AuxTransformBox in offsetbox.py to support some transformation.
+ anchored_text.py example is enhanced and renamed
+ (anchored_artists.py). - JJL
+
2009-03-20 Add "bar" connection style for annotation - JJL
2009-03-17 Fix bugs in edge color handling by contourf, found
Copied: trunk/matplotlib/examples/pylab_examples/anchored_artists.py (from rev 6998, trunk/matplotlib/examples/pylab_examples/anchored_text.py)
===================================================================
--- trunk/matplotlib/examples/pylab_examples/anchored_artists.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/anchored_artists.py 2009-03-20 20:26:00 UTC (rev 7000)
@@ -0,0 +1,117 @@
+from matplotlib.patches import Rectangle, Ellipse
+
+from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\
+ TextArea, DrawingArea
+
+
+class AnchoredText(AnchoredOffsetbox):
+ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
+
+ self.txt = TextArea(s,
+ minimumdescent=False)
+
+
+ super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
+ child=self.txt,
+ prop=prop,
+ frameon=frameon)
+
+
+class AnchoredSizeBar(AnchoredOffsetbox):
+ def __init__(self, transform, size, label, loc,
+ pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True):
+ """
+ Draw a horizontal bar with the size in data coordinate of the give axes.
+ A label will be drawn underneath (center-alinged).
+
+ pad, borderpad in fraction of the legend font size (or prop)
+ sep in points.
+ """
+ self.size_bar = AuxTransformBox(transform)
+ self.size_bar.add_artist(Rectangle((0,0), size, 0, fc="none"))
+
+ self.txt_label = TextArea(label, minimumdescent=False)
+
+ self._box = VPacker(children=[self.size_bar, self.txt_label],
+ align="center",
+ pad=0, sep=sep)
+
+ AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
+ child=self._box,
+ prop=prop,
+ frameon=frameon)
+
+
+class AnchoredEllipse(AnchoredOffsetbox):
+ def __init__(self, transform, width, height, angle, loc,
+ pad=0.1, borderpad=0.1, prop=None, frameon=True):
+ """
+ Draw an ellipse the size in data coordinate of the give axes.
+
+ pad, borderpad in fraction of the legend font size (or prop)
+ """
+ self._box = AuxTransformBox(transform)
+ self.ellipse = Ellipse((0,0), width, height, angle)
+ self._box.add_artist(self.ellipse)
+
+ AnchoredOffsetbox.__init__(self, loc, pad=pad, borderpad=borderpad,
+ child=self._box,
+ prop=prop,
+ frameon=frameon)
+
+
+
+class AnchoredDrawingArea(AnchoredOffsetbox):
+ def __init__(self, width, height, xdescent, ydescent,
+ loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
+
+ self.da = DrawingArea(width, height, xdescent, ydescent, clip=True)
+
+ super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
+ child=self.da,
+ prop=None,
+ frameon=frameon)
+
+
+
+if __name__ == "__main__":
+
+ import matplotlib.pyplot as plt
+
+ ax = plt.gca()
+ ax.set_aspect(1.)
+
+ at = AnchoredText("Figure 1a",
+ loc=2, frameon=True)
+ at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
+ ax.add_artist(at)
+
+ from matplotlib.patches import Circle
+ ada = AnchoredDrawingArea(20, 20, 0, 0,
+ loc=1, pad=0., frameon=False)
+ p = Circle((10, 10), 10)
+ ada.da.add_artist(p)
+ ax.add_artist(ada)
+
+ # draw an ellipse of width=0.1, height=0.15 in the data coordinate
+ ae = AnchoredEllipse(ax.transData, width=0.1, height=0.15, angle=0.,
+ loc=3, pad=0.5, borderpad=0.4, frameon=True)
+
+ ax.add_artist(ae)
+
+ # draw a horizontal bar with length of 0.1 in Data coordinate
+ # (ax.transData) with a label underneath.
+ as = AnchoredSizeBar(ax.transData,
+ 0.1,
+ r"1$^{\prime}$",
+ loc=8,
+ pad=0.1, borderpad=0.5, sep=5,
+ frameon=False)
+ ax.add_artist(as)
+
+ plt.draw()
+ plt.show()
+
+
+
+
Deleted: trunk/matplotlib/examples/pylab_examples/anchored_text.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/anchored_text.py 2009-03-20 20:10:42 UTC (rev 6999)
+++ trunk/matplotlib/examples/pylab_examples/anchored_text.py 2009-03-20 20:26:00 UTC (rev 7000)
@@ -1,183 +0,0 @@
-"""
-Place a text (or any offsetbox artist) at the corner of the axes, like a lenged.
-"""
-
-from matplotlib.offsetbox import TextArea, OffsetBox, DrawingArea
-from matplotlib.transforms import Bbox
-from matplotlib.font_manager import FontProperties
-from matplotlib import rcParams
-from matplotlib.patches import FancyBboxPatch
-from matplotlib.patches import Circle
-
-
-class AnchoredOffsetbox(OffsetBox):
- def __init__(self, loc, pad=0.4, borderpad=0.5,
- child=None, fontsize=None, frameon=True):
-
- super(AnchoredOffsetbox, self).__init__()
-
- self.set_child(child)
-
- self.loc = loc
- self.borderpad=borderpad
- self.pad = pad
-
- if fontsize is None:
- prop=FontProperties(size=rcParams["legend.fontsize"])
- self._fontsize = prop.get_size_in_points()
- else:
- self._fontsize = fontsize
-
-
-
- self.patch = FancyBboxPatch(
- xy=(0.0, 0.0), width=1., height=1.,
- facecolor='w', edgecolor='k',
- mutation_scale=self._fontsize,
- snap=True
- )
- self.patch.set_boxstyle("square",pad=0)
- self._drawFrame = frameon
-
- def set_child(self, child):
- self._child = child
-
- def get_children(self):
- return [self._child]
-
- def get_child(self):
- return self._child
-
- def get_extent(self, renderer):
- w, h, xd, yd = self.get_child().get_extent(renderer)
- fontsize = renderer.points_to_pixels(self._fontsize)
- pad = self.pad * fontsize
-
- return w+2*pad, h+2*pad, xd+pad, yd+pad
-
- def get_window_extent(self, renderer):
- '''
- get the bounding box in display space.
- '''
- w, h, xd, yd = self.get_extent(renderer)
- ox, oy = self.get_offset(w, h, xd, yd)
- return Bbox.from_bounds(ox-xd, oy-yd, w, h)
-
- def draw(self, renderer):
-
- if not self.get_visible(): return
-
- fontsize = renderer.points_to_pixels(self._fontsize)
-
- def _offset(w, h, xd, yd, fontsize=fontsize, self=self):
- bbox = Bbox.from_bounds(0, 0, w, h)
- borderpad = self.borderpad*fontsize
- x0, y0 = self._get_anchored_bbox(self.loc,
- bbox,
- self.axes.bbox,
- borderpad)
- return x0+xd, y0+yd
-
- self.set_offset(_offset)
-
- if self._drawFrame:
- # update the location and size of the legend
- bbox = self.get_window_extent(renderer)
- self.patch.set_bounds(bbox.x0, bbox.y0,
- bbox.width, bbox.height)
-
- self.patch.set_mutation_scale(fontsize)
-
- self.patch.draw(renderer)
-
-
- width, height, xdescent, ydescent = self.get_extent(renderer)
-
- px, py = self.get_offset(width, height, xdescent, ydescent)
-
- self.get_child().set_offset((px, py))
- self.get_child().draw(renderer)
-
-
-
- def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad):
- assert loc in range(1,11) # called only internally
-
- BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C = range(11)
-
- anchor_coefs={UR:"NE",
- UL:"NW",
- LL:"SW",
- LR:"SE",
- R:"E",
- CL:"W",
- CR:"E",
- LC:"S",
- UC:"N",
- C:"C"}
-
- c = anchor_coefs[loc]
-
- container = parentbbox.padded(-borderpad)
- anchored_box = bbox.anchored(c, container=container)
- return anchored_box.x0, anchored_box.y0
-
-
-class AnchoredText(AnchoredOffsetbox):
- def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
-
- self.txt = TextArea(s,
- minimumdescent=False)
-
-
- if prop is None:
- self.prop=FontProperties(size=rcParams["legend.fontsize"])
- else:
- self.prop=prop
-
-
- super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
- child=self.txt,
- fontsize=self.prop.get_size_in_points(),
- frameon=frameon)
-
-
-class AnchoredDrawingArea(AnchoredOffsetbox):
- def __init__(self, width, height, xdescent, ydescent,
- loc, pad=0.4, borderpad=0.5, fontsize=None, frameon=True):
-
- self.da = DrawingArea(width, height, xdescent, ydescent, clip=True)
-
- super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
- child=self.da,
- fontsize=fontsize,
- frameon=frameon)
-
-
-
-if __name__ == "__main__":
- import matplotlib.pyplot as plt
-
- #ax = plt.subplot(1,1,1)
- plt.clf()
- plt.cla()
- plt.draw()
- ax = plt.gca()
- #ax.set_aspect(1.)
-
- at = AnchoredText("Figure 1(a)", loc=2, frameon=False)
- ax.add_artist(at)
-
- ada = AnchoredDrawingArea(20, 20, 0, 0, loc=3, pad=0., frameon=False)
-
- p = Circle((10, 10), 10)
- ada.da.add_artist(p)
- ax.add_artist(ada)
-
- ax.plot([0,1])
- plt.draw()
-
- plt.show()
-
-
-
Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-03-20 20:10:42 UTC (rev 6999)
+++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-03-20 20:26:00 UTC (rev 7000)
@@ -656,3 +656,228 @@
bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+
+
+class AuxTransformBox(OffsetBox):
+ """
+ Offset Box with the aux_transform . Its children will be
+ transformed with the aux_transform first then will be
+ offseted. The absolute coordinate of the aux_transform is meaning
+ as it will be automaticcaly adjust so that the left-lower corner
+ of the bounding box of children will be set to (0,0) before the
+ offset trnasform.
+
+ It is similar to drawing area, except that the extent of the box
+ is not predetemined but calculated from the window extent of its
+ children. Furthermore, the extent of the children will be
+ calculated in the transformed coordinate.
+ """
+
+ def __init__(self, aux_transform):
+ self.aux_transform = aux_transform
+ OffsetBox.__init__(self)
+
+ self.offset_transform = mtransforms.Affine2D()
+ self.offset_transform.clear()
+ self.offset_transform.translate(0, 0)
+
+ # ref_offset_transform is used to make the offset_transform is
+ # always reference to the lower-left corner of the bbox of its
+ # children.
+ self.ref_offset_transform = mtransforms.Affine2D()
+ self.ref_offset_transform.clear()
+
+ def add_artist(self, a):
+ 'Add any :class:`~matplotlib.artist.Artist` to the container box'
+ self._children.append(a)
+ a.set_transform(self.get_transform())
+
+ def get_transform(self):
+ """
+ Return the :class:`~matplotlib.transforms.Transform` applied
+ to the children
+ """
+
+ return self.aux_transform + \
+ self.ref_offset_transform + \
+ self.offset_transform
+
+ def set_transform(self, t):
+ """
+ set_transform is ignored.
+ """
+ pass
+
+
+ def set_offset(self, xy):
+ """
+ set offset of the container.
+
+ Accept : tuple of x,y cooridnate in disokay units.
+ """
+ self._offset = xy
+
+ self.offset_transform.clear()
+ self.offset_transform.translate(xy[0], xy[1])
+
+
+ def get_offset(self):
+ """
+ return offset of the container.
+ """
+ return self._offset
+
+
+ def get_window_extent(self, renderer):
+ '''
+ get the bounding box in display space.
+ '''
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset() #w, h, xd, yd)
+ return mtransforms.Bbox.from_bounds(ox-xd, oy-yd, w, h)
+
+
+ def get_extent(self, renderer):
+
+ # clear the offset transforms
+ _off = self.ref_offset_transform.to_values() # to be restored later
+ self.ref_offset_transform.clear()
+ self.offset_transform.clear()
+
+ # calculate the extent
+ bboxes = [c.get_window_extent(renderer) for c in self._children]
+ ub = mtransforms.Bbox.union(bboxes)
+
+
+ # adjust ref_offset_tansform
+ self.ref_offset_transform.translate(-ub.x0, -ub.y0)
+ # restor offset transform
+ self.offset_transform.matrix_from_values(*_off)
+
+ return ub.width, ub.height, 0., 0.
+
+
+ def draw(self, renderer):
+ """
+ Draw the children
+ """
+
+ for c in self._children:
+ c.draw(renderer)
+
+ bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
+
+
+from matplotlib.font_manager import FontProperties
+from matplotlib.patches import FancyBboxPatch
+from matplotlib import rcParams
+from matplotlib.transforms import Bbox
+
+class AnchoredOffsetbox(OffsetBox):
+ def __init__(self, loc, pad=0.4, borderpad=0.5,
+ child=None, prop=None, frameon=True):
+
+ super(AnchoredOffsetbox, self).__init__()
+
+ self.set_child(child)
+
+ self.loc = loc
+ self.borderpad=borderpad
+ self.pad = pad
+
+ if prop is None:
+ self.prop=FontProperties(size=rcParams["legend.fontsize"])
+ else:
+ self.prop = prop
+
+ self.patch = FancyBboxPatch(
+ xy=(0.0, 0.0), width=1., height=1.,
+ facecolor='w', edgecolor='k',
+ mutation_scale=self.prop.get_size_in_points(),
+ snap=True
+ )
+ self.patch.set_boxstyle("square",pad=0)
+ self._drawFrame = frameon
+
+ def set_child(self, child):
+ self._child = child
+
+ def get_children(self):
+ return [self._child]
+
+ def get_child(self):
+ return self._child
+
+ def get_extent(self, renderer):
+ w, h, xd, yd = self.get_child().get_extent(renderer)
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+ pad = self.pad * fontsize
+
+ return w+2*pad, h+2*pad, xd+pad, yd+pad
+
+ def get_window_extent(self, renderer):
+ '''
+ get the bounding box in display space.
+ '''
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset(w, h, xd, yd)
+ return Bbox.from_bounds(ox-xd, oy-yd, w, h)
+
+ def draw(self, renderer):
+
+ if not self.get_visible(): return
+
+ fontsize = renderer.points_to_pixels(self.prop.get_size_in_points())
+
+ def _offset(w, h, xd, yd, fontsize=fontsize, self=self):
+ bbox = Bbox.from_bounds(0, 0, w, h)
+ borderpad = self.borderpad*fontsize
+ x0, y0 = self._get_anchored_bbox(self.loc,
+ bbox,
+ self.axes.bbox,
+ borderpad)
+ return x0+xd, y0+yd
+
+ self.set_offset(_offset)
+
+ if self._drawFrame:
+ # update the location and size of the legend
+ bbox = self.get_window_extent(renderer)
+ self.patch.set_bounds(bbox.x0, bbox.y0,
+ bbox.width, bbox.height)
+
+ self.patch.set_mutation_scale(fontsize)
+
+ self.patch.draw(renderer)
+
+
+ width, height, xdescent, ydescent = self.get_extent(renderer)
+
+ px, py = self.get_offset(width, height, xdescent, ydescent)
+
+ self.get_child().set_offset((px, py))
+ self.get_child().draw(renderer)
+
+
+
+ def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad):
+ assert loc in range(1,11) # called only internally
+
+ BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C = range(11)
+
+ anchor_coefs={UR:"NE",
+ UL:"NW",
+ LL:"SW",
+ LR:"SE",
+ R:"E",
+ CL:"W",
+ CR:"E",
+ LC:"S",
+ UC:"N",
+ C:"C"}
+
+ c = anchor_coefs[loc]
+
+ container = parentbbox.padded(-borderpad)
+ anchored_box = bbox.anchored(c, container=container)
+ return anchored_box.x0, anchored_box.y0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-03-20 20:10:56
|
Revision: 6999
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6999&view=rev
Author: leejjoon
Date: 2009-03-20 20:10:42 +0000 (Fri, 20 Mar 2009)
Log Message:
-----------
Add bar connection style for annotation
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/pylab_examples/annotation_demo2.py
trunk/matplotlib/lib/matplotlib/patches.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-03-19 14:44:01 UTC (rev 6998)
+++ trunk/matplotlib/CHANGELOG 2009-03-20 20:10:42 UTC (rev 6999)
@@ -1,3 +1,5 @@
+2009-03-20 Add "bar" connection style for annotation - JJL
+
2009-03-17 Fix bugs in edge color handling by contourf, found
by Jae-Joon Lee. - EF
Modified: trunk/matplotlib/examples/pylab_examples/annotation_demo2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/annotation_demo2.py 2009-03-19 14:44:01 UTC (rev 6998)
+++ trunk/matplotlib/examples/pylab_examples/annotation_demo2.py 2009-03-20 20:10:42 UTC (rev 6999)
@@ -71,6 +71,14 @@
)
+ ann = ax.annotate('', xy=(4., 1.), xycoords='data',
+ xytext=(4.5, -1), textcoords='data',
+ arrowprops=dict(arrowstyle="<->",
+ connectionstyle="bar",
+ ec="k",
+ shrinkA=5, shrinkB=5,
+ )
+ )
if 1:
@@ -144,4 +152,5 @@
)
)
+
show()
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2009-03-19 14:44:01 UTC (rev 6998)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2009-03-20 20:10:42 UTC (rev 6999)
@@ -2545,6 +2545,92 @@
_style_list["arc"] = Arc
+
+
+ class Bar(_Base):
+ """
+ A line with *angle* between A and B with *armA* and
+ *armB*. One of the arm is extend so that they are connected in
+ a right angle. The length of armA is determined by (*armA*
+ + *fraction* x AB distance). Same for armB.
+ """
+
+ def __init__(self, armA=0., armB=0., fraction=0.3, angle=None):
+ """
+ *armA* : minimum length of armA
+ *armB* : minimum length of armB
+ *fraction* : a fraction of the distance between two points that will be added to armA and armB.
+ *angle* : anlge of the connecting line (if None, parallel to A and B)
+ """
+ self.armA = armA
+ self.armB = armB
+ self.fraction = fraction
+ self.angle = angle
+
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x20, y20 = x2, y2 = posB
+
+ x12, y12 = (x1 + x2)/2., (y1 + y2)/2.
+
+ theta1 = math.atan2(y2-y1, x2-x1)
+ dx, dy = x2 - x1, y2 - y1
+ dd = (dx*dx + dy*dy)**.5
+ ddx, ddy = dx/dd, dy/dd
+
+ armA, armB = self.armA, self.armB
+
+ if self.angle is not None:
+ #angle = self.angle % 180.
+ #if angle < 0. or angle > 180.:
+ # angle
+ theta0 = (self.angle%180.)/180.*math.pi
+ #theta0 = (((self.angle+90)%180.) - 90.)/180.*math.pi
+ dtheta = theta1 - theta0
+ dl = dd*math.sin(dtheta)
+
+ dL = dd*math.cos(dtheta)
+
+ #x2, y2 = x2 + dl*ddy, y2 - dl*ddx
+ x2, y2 = x1 + dL*math.cos(theta0), y1 + dL*math.sin(theta0)
+
+ armB = armB - dl
+
+ # update
+ dx, dy = x2 - x1, y2 - y1
+ dd2 = (dx*dx + dy*dy)**.5
+ ddx, ddy = dx/dd2, dy/dd2
+
+ else:
+ dl = 0.
+
+ #if armA > armB:
+ # armB = armA + dl
+ #else:
+ # armA = armB - dl
+
+
+ arm = max(armA, armB)
+ f = self.fraction*dd + arm
+ #fB = self.fraction*dd + armB
+
+ cx1, cy1 = x1 + f*ddy, y1 - f*ddx
+ cx2, cy2 = x2 + f*ddy, y2 - f*ddx
+
+ vertices = [(x1, y1),
+ (cx1, cy1),
+ (cx2, cy2),
+ (x20, y20)]
+ codes = [Path.MOVETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO]
+
+ return Path(vertices, codes)
+
+ _style_list["bar"] = Bar
+
+
__doc__ = cbook.dedent(__doc__) % \
{"AvailableConnectorstyles": _pprint_styles(_style_list)}
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2009-03-19 14:44:01 UTC (rev 6998)
+++ trunk/matplotlib/lib/matplotlib/text.py 2009-03-20 20:10:42 UTC (rev 6999)
@@ -406,6 +406,10 @@
props = props.copy() # don't want to alter the pad externally
pad = props.pop('pad', 4)
pad = renderer.points_to_pixels(pad)
+ if self._text == "":
+ self.arrow_patch.set_patchA(None)
+ return
+
bbox = self.get_window_extent(renderer)
l,b,w,h = bbox.bounds
l-=pad/2.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-19 14:44:07
|
Revision: 6998
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6998&view=rev
Author: mdboom
Date: 2009-03-19 14:44:01 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Fix mapping regular font the StixSans when fontset is stixsans.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2009-03-19 13:15:00 UTC (rev 6997)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2009-03-19 14:44:01 UTC (rev 6998)
@@ -908,7 +908,8 @@
# Handle these "fonts" that are actually embedded in
# other fonts.
mapping = stix_virtual_fonts.get(fontname)
- if self._sans and mapping is None:
+ if (self._sans and mapping is None and
+ fontname not in ('regular', 'default')):
mapping = stix_virtual_fonts['sf']
doing_sans_conversion = True
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-19 13:15:04
|
Revision: 6997
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6997&view=rev
Author: mdboom
Date: 2009-03-19 13:15:00 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Fix bug in Cairo backend related to clipping -- thanks Nathaniel Smith
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/backends/backend_cairo.py
Modified: branches/v0_98_5_maint/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/backends/backend_cairo.py 2009-03-19 12:55:07 UTC (rev 6996)
+++ branches/v0_98_5_maint/lib/matplotlib/backends/backend_cairo.py 2009-03-19 13:15:00 UTC (rev 6997)
@@ -109,6 +109,23 @@
# font transform?
+ def _do_clip(self, ctx, cliprect, clippath):
+ if cliprect is not None:
+ x,y,w,h = cliprect.bounds
+ # pixel-aligned clip-regions are faster
+ x,y,w,h = round(x), round(y), round(w), round(h)
+ ctx.new_path()
+ ctx.rectangle (x, self.height - h - y, w, h)
+ ctx.clip ()
+
+ if clippath is not None:
+ tpath, affine = clippath.get_transformed_path_and_affine()
+ ctx.new_path()
+ affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.height)
+ tpath = affine.transform_path(tpath)
+ RendererCairo.convert_path(ctx, tpath)
+ ctx.clip()
+
def _fill_and_stroke (self, ctx, fill_c, alpha):
if fill_c is not None:
ctx.save()
@@ -120,7 +137,6 @@
ctx.restore()
ctx.stroke()
-
#@staticmethod
def convert_path(ctx, tpath):
for points, code in tpath.iter_segments():
@@ -144,6 +160,9 @@
raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")
ctx = gc.ctx
+ ctx.save()
+ self._do_clip(ctx, gc._cliprect, gc._clippath)
+
transform = transform + \
Affine2D().scale(1.0, -1.0).translate(0, self.height)
tpath = transform.transform_path(path)
@@ -152,6 +171,7 @@
self.convert_path(ctx, tpath)
self._fill_and_stroke(ctx, rgbFace, gc.get_alpha())
+ ctx.restore()
def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
# bbox - not currently used
@@ -164,9 +184,16 @@
buf, cairo.FORMAT_ARGB32, cols, rows, cols*4)
# function does not pass a 'gc' so use renderer.ctx
ctx = self.ctx
+ ctx.save()
+ if clippath is not None:
+ tpath = clippath_trans.transform_path(clippath)
+ ctx.new_path()
+ RendererCairo.convert_path(ctx, tpath)
+ ctx.clip()
y = self.height - y - rows
ctx.set_source_surface (surface, x, y)
ctx.paint()
+ ctx.restore()
im.flipud_out()
@@ -324,31 +351,10 @@
def set_clip_rectangle(self, rectangle):
self._cliprect = rectangle
- if rectangle is None:
- return
- x,y,w,h = rectangle.bounds
- # pixel-aligned clip-regions are faster
- x,y,w,h = round(x), round(y), round(w), round(h)
- ctx = self.ctx
- ctx.new_path()
- ctx.rectangle (x, self.renderer.height - h - y, w, h)
- ctx.clip ()
- # Alternative: just set _cliprect here and actually set cairo clip rect
- # in fill_and_stroke() inside ctx.save() ... ctx.restore()
-
-
def set_clip_path(self, path):
- if path is not None:
- tpath, affine = path.get_transformed_path_and_affine()
- ctx = self.ctx
- ctx.new_path()
- affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.renderer.height)
- tpath = affine.transform_path(tpath)
- RendererCairo.convert_path(ctx, tpath)
- ctx.clip()
+ self._clippath = path
-
def set_dashes(self, offset, dashes):
self._dashes = offset, dashes
if dashes == None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-19 12:55:12
|
Revision: 6996
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6996&view=rev
Author: mdboom
Date: 2009-03-19 12:55:07 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Merged revisions 6995 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6995 | mdboom | 2009-03-19 08:52:46 -0400 (Thu, 19 Mar 2009) | 2 lines
Fix wavy baseline with STIX fonts -- again.
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6990
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6995
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2009-03-19 12:52:46 UTC (rev 6995)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2009-03-19 12:55:07 UTC (rev 6996)
@@ -201,7 +201,7 @@
def render_glyph(self, ox, oy, info):
info.font.draw_glyph_to_bitmap(
- self.image, ox, oy - info.metrics.ymax, info.glyph)
+ self.image, ox, oy - info.metrics.iceberg, info.glyph)
def render_rect_filled(self, x1, y1, x2, y2):
height = max(int(y2 - y1) - 1, 0)
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
+ /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-19 12:52:52
|
Revision: 6995
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6995&view=rev
Author: mdboom
Date: 2009-03-19 12:52:46 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Fix wavy baseline with STIX fonts -- again.
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/mathtext.py
Modified: branches/v0_98_5_maint/lib/matplotlib/mathtext.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/mathtext.py 2009-03-18 19:44:31 UTC (rev 6994)
+++ branches/v0_98_5_maint/lib/matplotlib/mathtext.py 2009-03-19 12:52:46 UTC (rev 6995)
@@ -201,7 +201,7 @@
def render_glyph(self, ox, oy, info):
info.font.draw_glyph_to_bitmap(
- self.image, ox, oy - info.metrics.ymax, info.glyph)
+ self.image, ox, oy - info.metrics.iceberg, info.glyph)
def render_rect_filled(self, x1, y1, x2, y2):
height = max(int(y2 - y1) - 1, 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fer...@us...> - 2009-03-18 19:44:35
|
Revision: 6994
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6994&view=rev
Author: fer_perez
Date: 2009-03-18 19:44:31 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
Add forgotten file
Added Paths:
-----------
trunk/py4science/examples/sphinx_template2/pyplots/fancy.py
Added: trunk/py4science/examples/sphinx_template2/pyplots/fancy.py
===================================================================
--- trunk/py4science/examples/sphinx_template2/pyplots/fancy.py (rev 0)
+++ trunk/py4science/examples/sphinx_template2/pyplots/fancy.py 2009-03-18 19:44:31 UTC (rev 6994)
@@ -0,0 +1,3 @@
+import matplotlib.pyplot as plt
+plt.plot([1,2,3], [4,5,6])
+plt.title(r'A great result with math! $x=1$')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-18 17:22:23
|
Revision: 6992
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6992&view=rev
Author: jdh2358
Date: 2009-03-18 16:07:19 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
some cleanups to the volume overlay
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/finance_work2.py
Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 15:52:00 UTC (rev 6991)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 16:07:19 UTC (rev 6992)
@@ -80,7 +80,7 @@
up = seed[seed>=0].sum()/n
down = -seed[seed<0].sum()/n
rs = up/down
- rsi = np.zeros_like(r.adj_close)
+ rsi = np.zeros_like(prices)
rsi[:n] = 100. - 100./(1.+rs)
for i in range(n, len(prices)):
@@ -129,6 +129,8 @@
ax2t = ax2.twinx()
ax3 = fig.add_axes(rect3, axisbg=axescolor, sharex=ax1)
+
+
### plot the relative strength indicator
prices = r.adj_close
rsi = relative_strength(prices)
@@ -176,14 +178,14 @@
leg = ax2.legend(loc='center left', shadow=True, fancybox=True, prop=props)
leg.get_frame().set_alpha(0.5)
-vmax = r.volume.max()/1e6
-poly = ax2t.fill_between(r.date, r.volume/1e6, 0, facecolor=fillcolor, label='Volume')
+
+volume = (r.close*r.volume)/1e6 # dollar volume in millions
+vmax = volume.max()
+poly = ax2t.fill_between(r.date, volume, 0, facecolor=fillcolor, label='Volume')
ax2t.set_ylim(0, 5*vmax)
-ymax = np.int(vmax)
-yticks = [vmax/2., vmax]
-ax2t.set_yticks(yticks)
-ax2t.set_yticklabels(['%d M'%val for val in yticks])
+ax2t.set_yticks([])
+
### compute the MACD indicator
fillcolor = 'darkslategrey'
nslow = 26
@@ -220,7 +222,6 @@
return ''
else:
return mticker.FormatStrFormatter.__call__(self, x, pos=None)
-
ax2.yaxis.set_major_formatter(PriceFormatter('%d'))
plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-18 16:40:38
|
Revision: 6993
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6993&view=rev
Author: jdh2358
Date: 2009-03-18 16:40:26 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
use urllib2 for yahoo finace; more cleanups to demo
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/finance_work2.py
trunk/matplotlib/lib/matplotlib/finance.py
Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 16:07:19 UTC (rev 6992)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 16:40:26 UTC (rev 6993)
@@ -139,8 +139,8 @@
ax1.plot(r.date, rsi, color=fillcolor)
ax1.axhline(70, color=fillcolor)
ax1.axhline(30, color=fillcolor)
-ax1.fill_between(r.date, rsi, 70, facecolor=fillcolor, where=(rsi>=70))
-ax1.fill_between(r.date, rsi, 30, facecolor=fillcolor, where=(rsi<=30))
+ax1.fill_between(r.date, rsi, 70, where=(rsi>=70), facecolor=fillcolor, edgecolor=fillcolor)
+ax1.fill_between(r.date, rsi, 30, where=(rsi<=30), facecolor=fillcolor, edgecolor=fillcolor)
ax1.text(0.6, 0.9, '>70 = overbought', va='top', transform=ax1.transAxes, fontsize=textsize)
ax1.text(0.6, 0.1, '<30 = oversold', transform=ax1.transAxes, fontsize=textsize)
ax1.set_ylim(0, 100)
@@ -181,7 +181,7 @@
volume = (r.close*r.volume)/1e6 # dollar volume in millions
vmax = volume.max()
-poly = ax2t.fill_between(r.date, volume, 0, facecolor=fillcolor, label='Volume')
+poly = ax2t.fill_between(r.date, volume, 0, label='Volume', facecolor=fillcolor, edgecolor=fillcolor)
ax2t.set_ylim(0, 5*vmax)
ax2t.set_yticks([])
@@ -195,14 +195,14 @@
ema9 = moving_average(macd, nema, type='exponential')
ax3.plot(r.date, macd, color='black', lw=2)
ax3.plot(r.date, ema9, color='blue', lw=1)
-ax3.fill_between(r.date, macd-ema9, 0, facecolor=fillcolor, alpha=0.5)
+ax3.fill_between(r.date, macd-ema9, 0, alpha=0.5, facecolor=fillcolor, edgecolor=fillcolor)
ax3.text(0.025, 0.95, 'MACD (%d, %d, %d)'%(nfast, nslow, nema), va='top',
transform=ax3.transAxes, fontsize=textsize)
ax3.set_yticks([])
-# turn off tick labels, rorate them, etc
+# turn off upper axis tick labels, rotate the lower ones, etc
for ax in ax1, ax2, ax2t, ax3:
if ax!=ax3:
for label in ax.get_xticklabels():
Modified: trunk/matplotlib/lib/matplotlib/finance.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/finance.py 2009-03-18 16:07:19 UTC (rev 6992)
+++ trunk/matplotlib/lib/matplotlib/finance.py 2009-03-18 16:40:26 UTC (rev 6993)
@@ -5,7 +5,7 @@
"""
#from __future__ import division
import os, time, warnings
-from urllib import urlopen
+from urllib2 import urlopen
try:
from hashlib import md5
@@ -121,8 +121,10 @@
verbose.report('Using cachefile %s for %s'%(cachename, ticker))
else:
if not os.path.isdir(cachedir): os.mkdir(cachedir)
+ urlfh = urlopen(url)
+
fh = file(cachename, 'w')
- fh.write(urlopen(url).read())
+ fh.write(urlfh.read())
fh.close()
verbose.report('Saved %s data to cache file %s'%(ticker, cachename))
fh = file(cachename, 'r')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-18 15:52:10
|
Revision: 6991
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6991&view=rev
Author: mdboom
Date: 2009-03-18 15:52:00 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
Merged revisions 6990 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6990 | mdboom | 2009-03-18 11:48:30 -0400 (Wed, 18 Mar 2009) | 2 lines
Fix race condition in tempfile creation in PS backend. If two mpl processes try to create PS files with the same file name and the same time, they will use the same tempfile, and madness, crashing and burning will ensue.
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6985
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6990
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-03-18 15:48:30 UTC (rev 6990)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-03-18 15:52:00 UTC (rev 6991)
@@ -11,7 +11,7 @@
except ImportError:
from md5 import md5 #Deprecated in 2.5
-from tempfile import gettempdir
+from tempfile import mkstemp
from cStringIO import StringIO
from matplotlib import verbose, __version__, rcParams
from matplotlib._pylab_helpers import Gcf
@@ -886,15 +886,15 @@
"""
isEPSF = format == 'eps'
passed_in_file_object = False
+ fd, tmpfile = mkstemp()
if is_string_like(outfile):
title = outfile
- tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest())
elif is_writable_file_like(outfile):
title = None
- tmpfile = os.path.join(gettempdir(), md5(str(hash(outfile))).hexdigest())
passed_in_file_object = True
else:
raise ValueError("outfile must be a path or a file-like object")
+ os.close(fd)
fh = file(tmpfile, 'w')
# find the appropriate papertype
@@ -1029,7 +1029,8 @@
title = outfile
# write to a temp file, we'll move it to outfile when done
- tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest())
+ fd, tmpfile = mkstemp()
+ os.close(fd)
fh = file(tmpfile, 'w')
self.figure.dpi = 72 # ignore the dpi kwarg
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985
+ /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-03-18 15:48:46
|
Revision: 6990
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6990&view=rev
Author: mdboom
Date: 2009-03-18 15:48:30 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
Fix race condition in tempfile creation in PS backend. If two mpl processes try to create PS files with the same file name and the same time, they will use the same tempfile, and madness, crashing and burning will ensue.
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/backends/backend_ps.py
Modified: branches/v0_98_5_maint/lib/matplotlib/backends/backend_ps.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/backends/backend_ps.py 2009-03-18 15:45:07 UTC (rev 6989)
+++ branches/v0_98_5_maint/lib/matplotlib/backends/backend_ps.py 2009-03-18 15:48:30 UTC (rev 6990)
@@ -11,7 +11,7 @@
except ImportError:
from md5 import md5 #Deprecated in 2.5
-from tempfile import gettempdir
+from tempfile import mkstemp
from cStringIO import StringIO
from matplotlib import verbose, __version__, rcParams
from matplotlib._pylab_helpers import Gcf
@@ -911,15 +911,15 @@
"""
isEPSF = format == 'eps'
passed_in_file_object = False
+ fd, tmpfile = mkstemp()
if is_string_like(outfile):
title = outfile
- tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest())
elif is_writable_file_like(outfile):
title = None
- tmpfile = os.path.join(gettempdir(), md5(str(hash(outfile))).hexdigest())
passed_in_file_object = True
else:
raise ValueError("outfile must be a path or a file-like object")
+ os.close(fd)
fh = file(tmpfile, 'w')
# find the appropriate papertype
@@ -1054,7 +1054,8 @@
title = outfile
# write to a temp file, we'll move it to outfile when done
- tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest())
+ fd, tmpfile = mkstemp()
+ os.close(fd)
fh = file(tmpfile, 'w')
self.figure.dpi = 72 # ignore the dpi kwarg
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-18 15:45:49
|
Revision: 6989
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6989&view=rev
Author: jdh2358
Date: 2009-03-18 15:45:07 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
fixed high/low for adjustment factor
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/finance_work2.py
Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 15:22:41 UTC (rev 6988)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 15:45:07 UTC (rev 6989)
@@ -63,6 +63,7 @@
weights /= weights.sum()
+
a = np.convolve(x, weights, mode='full')[:len(x)]
a[:n] = a[n]
return a
@@ -146,11 +147,15 @@
ax1.set_title('%s daily'%ticker)
### plot the price and volume data
+dx = r.adj_close - r.close
+low = r.low + dx
+high = r.high + dx
+
deltas = np.zeros_like(prices)
deltas[1:] = np.diff(prices)
up = deltas>0
-ax2.vlines(r.date[up], r.low[up], r.high[up], color='black', label='_nolegend_')
-ax2.vlines(r.date[~up], r.low[~up], r.high[~up], color='black', label='_nolegend_')
+ax2.vlines(r.date[up], low[up], high[up], color='black', label='_nolegend_')
+ax2.vlines(r.date[~up], low[~up], high[~up], color='black', label='_nolegend_')
ma20 = moving_average(prices, 20, type='simple')
ma200 = moving_average(prices, 200, type='simple')
@@ -207,6 +212,7 @@
ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
+
class PriceFormatter(mticker.FormatStrFormatter):
'suppress the lowest tick label to prevent overlap'
def __call__(self, x, pos=None):
@@ -216,6 +222,7 @@
return mticker.FormatStrFormatter.__call__(self, x, pos=None)
ax2.yaxis.set_major_formatter(PriceFormatter('%d'))
+
plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-03-18 15:22:44
|
Revision: 6988
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6988&view=rev
Author: jdh2358
Date: 2009-03-18 15:22:41 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
updated finance_work2.py demo
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/finance_work2.py
trunk/matplotlib/examples/pylab_examples/legend_demo3.py
Modified: trunk/matplotlib/examples/pylab_examples/finance_work2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 07:39:43 UTC (rev 6987)
+++ trunk/matplotlib/examples/pylab_examples/finance_work2.py 2009-03-18 15:22:41 UTC (rev 6988)
@@ -1,278 +1,221 @@
-"""
-You need a additional files to run this example. Save the following
-in the same dir as this file
+## Plot the stock price with some technical indicators
+## Example usage::
+## python stocks2.py --ticker=GE --startdate=2003
+##
+import datetime, os, urllib, optparse
+import numpy as np
+import dateutil.parser
+import matplotlib.colors as colors
+import matplotlib.finance as finance
+import matplotlib.dates as mdates
+import matplotlib.ticker as mticker
+import matplotlib.mlab as mlab
+import matplotlib.pyplot as plt
+import matplotlib.font_manager as font_manager
- http://matplotlib.sourceforge.net/screenshots/helpers.py
+today = datetime.date.today()
- http://matplotlib.sourceforge.net/screenshots/msft_nasdaq_d.csv
+optionparser = optparse.OptionParser()
- http://matplotlib.sourceforge.net/screenshots/__init__.py
+optionparser.add_option('-t', '--ticker',
+ dest='ticker',
+ help='a stock market ticker',
+ default='SPY')
-"""
+optionparser.add_option('-s', '--startdate',
+ dest='startdate',
+ help='the start date',
+ default=(today-datetime.timedelta(days=365*2)).strftime('%Y-%m-%d'))
-import time, os, sys, datetime
+optionparser.add_option('-e', '--enddate',
+ dest='enddate',
+ help='the end date',
+ default=today.strftime('%Y-%m-%d'))
-from matplotlib import rcParams
-from matplotlib.ticker import IndexLocator, FuncFormatter, NullFormatter, MultipleLocator
-from matplotlib.dates import IndexDateFormatter, date2num
-from matplotlib.finance import candlestick2, plot_day_summary2, \
- volume_overlay, index_bar
-from pylab import *
-rcParams['timezone'] = 'US/Eastern'
-rc('grid', color='0.75', linestyle='-', linewidth=0.5)
+(commandoptions, commandargs) = optionparser.parse_args()
-def ema(s, n):
- """
- returns an n period exponential moving average for
- the time series s
- s is a list ordered from oldest (index 0) to most recent (index
- -1) n is an integer
+startdate = dateutil.parser.parse(commandoptions.startdate)
+enddate = dateutil.parser.parse(commandoptions.enddate)
+ticker = commandoptions.ticker
- returns a numeric array of the exponential moving average
- """
- s = array(s)
- ema = []
- j = 1
- #get n sma first and calculate the next n period ema
- sma = sum(s[:n]) / n
- multiplier = 2 / float(1 + n)
- ema.append(sma)
- #EMA(current) = ( (Price(current) - EMA(prev) ) xMultiplier) + EMA(prev)
- ema.append(( (s[n] - sma) * multiplier) + sma)
- #now calculate the rest of the values
- for i in s[n+1:]:
- tmp = ( (i - ema[j]) * multiplier) + ema[j]
- j = j + 1
- ema.append(tmp)
- return ema
-def movavg(s, n):
- """
- returns an n period moving average for the time series s
+fh = finance.fetch_historical_yahoo(ticker, startdate, enddate)
+# a numpy record array with fields: date, open, high, low, close, volume, adj_close)
- s is a list ordered from oldest (index 0) to most recent (index -1)
- n is an integer
+r = mlab.csv2rec(fh); fh.close()
+r.sort()
- returns a numeric array of the moving average
- See also ema in this module for the exponential moving average.
+def moving_average(x, n, type='simple'):
"""
- s = array(s)
- c = cumsum(s)
- return (c[n-1:] - c[:-n+1]) / float(n-1)
+ compute an n period moving average.
-def fill_over(ax, x, y, val, color, over=True):
+ type is 'simple' | 'exponential'
+
"""
- Plot filled x,y for all y over val
- if over = False, fill all areas < val
- """
- ybase = asarray(y)-val
- crossings = nonzero(less(ybase[:-1] * ybase[1:],0))
+ x = np.asarray(x)
+ if type=='simple':
+ weights = np.ones(n)
+ else:
+ weights = np.exp(np.linspace(-1., 0., n))
- if ybase[0]>=0: fillon = over
- else: fillon = not over
+ weights /= weights.sum()
+ a = np.convolve(x, weights, mode='full')[:len(x)]
+ a[:n] = a[n]
+ return a
- indLast = 0
- for ind in crossings:
- if fillon:
- thisX = x[indLast:ind+1]
- thisY = y[indLast:ind+1]
- thisY[0] = val
- thisY[-1] = val
- ax.fill(thisX, thisY, facecolor=color)
- fillon = not fillon
- indLast = ind
+def relative_strength(prices, n=14):
+ """
+ compute the n period relative strength indicator
+ http://stockcharts.com/school/doku.php?id=chart_school:glossary_r#relativestrengthindex
+ http://www.investopedia.com/terms/r/rsi.asp
+ """
+ deltas = np.diff(prices)
+ seed = deltas[:n+1]
+ up = seed[seed>=0].sum()/n
+ down = -seed[seed<0].sum()/n
+ rs = up/down
+ rsi = np.zeros_like(r.adj_close)
+ rsi[:n] = 100. - 100./(1.+rs)
-def random_signal(N, tau):
- 'generate a length N random signal with time constant tau'
- t = arange(float(N))
- filter = exp(-t/tau)
- return convolve( randn(N), filter, mode=2)[:len(t)]
+ for i in range(n, len(prices)):
+ delta = deltas[i-1] # cause the diff is 1 shorter
+ if delta>0:
+ upval = delta
+ downval = 0.
+ else:
+ upval = 0.
+ downval = -delta
-# load a numpy record array from yahoo csv data with fields date,
-# open, close, volume, adj_close from the mpl-data/example directory.
-# The record array stores python datetime.date as an object array in
-# the date column
-datafile = matplotlib.get_example_data('goog.npy')
-r = np.load(datafile).view(np.recarray)
-r = r[-250:]
+ up = (up*(n-1) + upval)/n
+ down = (down*(n-1) + downval)/n
-N = len(r)
+ rs = up/down
+ rsi[i] = 100. - 100./(1.+rs)
-vind = np.arange(N)
+ return rsi
-figBG = 'w' # the figure background color
-axesBG = '#f6f6f6' # the axies background color
-textsize = 8 # size for axes text
-
-# the demo data are intc from (2003, 9, 1) to (2004, 4, 12 ) with
-# dates as epoch; I saved these to a file for ease of debugginh
-ticker = 'MSFT'
-
-
-figure(1, facecolor=figBG)
-
-def get_locator():
+def moving_average_convergence(x, nslow=26, nfast=12):
"""
- the axes cannot share the same locator, so this is a helper
- function to generate locators that have identical functionality
+ compute the MACD (Moving Average Convergence/Divergence) using a fast and slow exponential moving avg'
+ return value is emaslow, emafast, macd which are len(x) arrays
"""
+ emaslow = moving_average(x, nslow, type='exponential')
+ emafast = moving_average(x, nfast, type='exponential')
+ return emaslow, emafast, emafast - emaslow
- return IndexLocator(10, 1)
+plt.rc('axes', grid=True)
+plt.rc('grid', color='0.75', linestyle='-', linewidth=0.5)
-formatter = IndexDateFormatter(date2num(r.date), '%b %d %y')
-
-nullfmt = NullFormatter() # no labels
-
-def fmt_vol(x,pos):
- if pos>3: return '' # only label the first 3 ticks
- return '%dM' % int(x*1e-6)
-
-volumeFmt = FuncFormatter(fmt_vol)
-
+textsize = 9
left, width = 0.1, 0.8
rect1 = [left, 0.7, width, 0.2]
rect2 = [left, 0.3, width, 0.4]
rect3 = [left, 0.1, width, 0.2]
-axUpper = axes(rect1, axisbg=axesBG) #left, bottom, width, height
-axMiddle = axes(rect2, axisbg=axesBG, sharex=axUpper)
-axMiddleVol = axMiddle.twinx()
-axLower = axes(rect3, axisbg=axesBG, sharex=axUpper)
-axUpper.xaxis.set_major_locator( get_locator() )
-axUpper.xaxis.set_major_formatter(nullfmt)
-axUpper.grid(True)
+fig = plt.figure(facecolor='white')
+axescolor = '#f6f6f6' # the axies background color
-# set up two scales on middle axes with left and right ticks
-axMiddle.yaxis.tick_left()
-axMiddle.xaxis.set_major_formatter(nullfmt)
+ax1 = fig.add_axes(rect1, axisbg=axescolor) #left, bottom, width, height
+ax2 = fig.add_axes(rect2, axisbg=axescolor, sharex=ax1)
+ax2t = ax2.twinx()
+ax3 = fig.add_axes(rect3, axisbg=axescolor, sharex=ax1)
-axMiddleVol.yaxis.set_major_formatter(volumeFmt)
-axMiddle.grid(True)
+### plot the relative strength indicator
+prices = r.adj_close
+rsi = relative_strength(prices)
+fillcolor = 'darkgoldenrod'
-axLower.xaxis.set_major_locator( get_locator() )
-axLower.xaxis.set_major_formatter( formatter )
-axLower.grid(True)
+ax1.plot(r.date, rsi, color=fillcolor)
+ax1.axhline(70, color=fillcolor)
+ax1.axhline(30, color=fillcolor)
+ax1.fill_between(r.date, rsi, 70, facecolor=fillcolor, where=(rsi>=70))
+ax1.fill_between(r.date, rsi, 30, facecolor=fillcolor, where=(rsi<=30))
+ax1.text(0.6, 0.9, '>70 = overbought', va='top', transform=ax1.transAxes, fontsize=textsize)
+ax1.text(0.6, 0.1, '<30 = oversold', transform=ax1.transAxes, fontsize=textsize)
+ax1.set_ylim(0, 100)
+ax1.set_yticks([30,70])
+ax1.text(0.025, 0.95, 'RSI (14)', va='top', transform=ax1.transAxes, fontsize=textsize)
+ax1.set_title('%s daily'%ticker)
-if 1: ############### Upper axes #################
+### plot the price and volume data
+deltas = np.zeros_like(prices)
+deltas[1:] = np.diff(prices)
+up = deltas>0
+ax2.vlines(r.date[up], r.low[up], r.high[up], color='black', label='_nolegend_')
+ax2.vlines(r.date[~up], r.low[~up], r.high[~up], color='black', label='_nolegend_')
+ma20 = moving_average(prices, 20, type='simple')
+ma200 = moving_average(prices, 200, type='simple')
- # make up a pseudo signal
- purple = '#660033'
- s = random_signal(N, tau=20)
- thresh = 4
- axUpper.plot(s, color=purple)
- # upper horiz line
+linema20, = ax2.plot(r.date, ma20, color='blue', lw=2, label='MA (20)')
+linema200, = ax2.plot(r.date, ma200, color='red', lw=2, label='MA (200)')
+last = r[-1]
+s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' % (
+ today.strftime('%d-%b-%Y'),
+ last.open, last.high,
+ last.low, last.close,
+ last.volume*1e-6,
+ last.close-last.open )
+t4 = ax2.text(0.3, 0.9, s, transform=ax2.transAxes, fontsize=textsize)
- axUpper.plot( (0, N), [thresh, thresh], color=purple, linewidth=1)
- # lower horiz line
- axUpper.plot( (0, N), [-thresh, -thresh], color=purple, linewidth=1)
+props = font_manager.FontProperties(size=10)
+leg = ax2.legend(loc='center left', shadow=True, fancybox=True, prop=props)
+leg.get_frame().set_alpha(0.5)
+vmax = r.volume.max()/1e6
+poly = ax2t.fill_between(r.date, r.volume/1e6, 0, facecolor=fillcolor, label='Volume')
+ax2t.set_ylim(0, 5*vmax)
+ymax = np.int(vmax)
+yticks = [vmax/2., vmax]
+ax2t.set_yticks(yticks)
+ax2t.set_yticklabels(['%d M'%val for val in yticks])
- # fill above threshold
- fill_over(axUpper, vind, s, thresh, purple, over=True)
- fill_over(axUpper, vind, s, -thresh, purple, over=False)
+### compute the MACD indicator
+fillcolor = 'darkslategrey'
+nslow = 26
+nfast = 12
+nema = 9
+emaslow, emafast, macd = moving_average_convergence(prices, nslow=nslow, nfast=nfast)
+ema9 = moving_average(macd, nema, type='exponential')
+ax3.plot(r.date, macd, color='black', lw=2)
+ax3.plot(r.date, ema9, color='blue', lw=1)
+ax3.fill_between(r.date, macd-ema9, 0, facecolor=fillcolor, alpha=0.5)
- t = axUpper.set_title('Google (GOOG)', fontsize=12)
- t.set_y(1.05) # move it up a bit higher than the default
- t.set_x(0) # align the title left, axes coords
- t.set_horizontalalignment('left') # align the title left, axes coords
- axUpper.yaxis.set_major_locator( MultipleLocator(5) )
+ax3.text(0.025, 0.95, 'MACD (%d, %d, %d)'%(nfast, nslow, nema), va='top',
+ transform=ax3.transAxes, fontsize=textsize)
+ax3.set_yticks([])
+# turn off tick labels, rorate them, etc
+for ax in ax1, ax2, ax2t, ax3:
+ if ax!=ax3:
+ for label in ax.get_xticklabels():
+ label.set_visible(False)
+ else:
+ for label in ax.get_xticklabels():
+ label.set_rotation(30)
+ label.set_horizontalalignment('right')
- # now add some text
- left, height, top = 0.025, 0.06, 0.85
- t = axUpper.text(left, top, 'RSI(14) 51.0', fontsize=textsize,
- transform=axUpper.transAxes)
+ ax.fmt_xdata = mdates.DateFormatter('%Y-%m-%d')
+class PriceFormatter(mticker.FormatStrFormatter):
+ 'suppress the lowest tick label to prevent overlap'
+ def __call__(self, x, pos=None):
+ if pos==0:
+ return ''
+ else:
+ return mticker.FormatStrFormatter.__call__(self, x, pos=None)
-if 1: ############### Middle axes #################
+ax2.yaxis.set_major_formatter(PriceFormatter('%d'))
+plt.show()
- candlestick2(axMiddle, r.open, r.close, r.high, r.low, width=0.9)
-
- # specify the text in axes (0,1) coords. 0,0 is lower left and 1,1 is
- # upper right
-
- left, height, top = 0.025, 0.06, 0.9
- t1 = axMiddle.text(left, top, '%s daily'%ticker, fontsize=textsize,
- transform=axMiddle.transAxes)
- t2 = axMiddle.text(left, top-height, 'MA(5)', color='b', fontsize=textsize,
- transform=axMiddle.transAxes)
- t3 = axMiddle.text(left, top-2*height, 'MA(20)', color='r', fontsize=textsize,
- transform=axMiddle.transAxes)
-
- s = '%s O:%1.2f H:%1.2f L:%1.2f C:%1.2f, V:%1.1fM Chg:%+1.2f' %(
- time.strftime('%d-%b-%Y'),
- r.open[-1], r.high[-1],
- r.low[-1], r.close[-1],
- r.volume[-1]*1e-6,
- r.close[-1]-r.open[-1])
- t4 = axMiddle.text(0.4, top, s, fontsize=textsize,
- transform=axMiddle.transAxes)
-
-
- # now do the moviing average. I'll use a convolution to simulate a
- # real moving average
- ma5 = movavg(r.adj_close, 5)
- ma20 = movavg(r.adj_close, 20)
- axMiddle.plot(vind[5-1:], ma5, 'b', linewidth=1)
- axMiddle.plot(vind[20-1:], ma20, 'r', linewidth=1)
-
- axMiddle.set_ylim((300, 800))
- axMiddle.set_yticks(np.arange(800, 800, 100))
-
- # Now do the volume overlay
-
- # todo - this is broken
- bars = volume_overlay(axMiddleVol, r.open, r.close, r.volume, alpha=0.5)
- #axMiddleVol.set_ylim(0, 3*r.volume.max()) # use only a third of the viewlim
-
-
-if 1: ############### Lower axes #################
-
- # make up two signals; I don't know what the signals are in real life
- # so I'll just illustrate the plotting stuff
- s1 = random_signal(N, 10)
- s2 = random_signal(N, 20)
-
- axLower.plot(vind, s1, color=purple)
- axLower.plot(vind, s2, color='k', linewidth=1.0)
- s3 = s2-s1
- axLower.plot(vind, s3, color='#cccc99') # wheat
- bars = index_bar(axLower, s3, width=2, alpha=0.5,
- facecolor='#3087c7', edgecolor='#cccc99')
- axLower.yaxis.set_major_locator(MultipleLocator(5))
-
-
- # now add some text
- left, height, top = 0.025, 0.06, 0.85
-
- t = axLower.text(left, top, 'MACD(12,26,9) -0.26', fontsize=textsize,
- transform=axLower.transAxes)
-
- # make sure everyone has the same axes limits
-
- setp(axLower.get_xticklabels(), 'rotation', 45,
- 'horizontalalignment', 'right', fontsize=8)
-
-# force all the axes to have the same x data limits
-allAxes = (axUpper, axMiddle, axMiddleVol, axLower)
-xlim = 0, N
-for a in allAxes:
- a.set_xlim(xlim)
-
-for ax in axUpper, axMiddle, axMiddleVol:
- for ticklabel in ax.get_xticklabels():
- ticklabel.set_visible(False)
-
-show()
Modified: trunk/matplotlib/examples/pylab_examples/legend_demo3.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/legend_demo3.py 2009-03-18 07:39:43 UTC (rev 6987)
+++ trunk/matplotlib/examples/pylab_examples/legend_demo3.py 2009-03-18 15:22:41 UTC (rev 6988)
@@ -23,7 +23,7 @@
ax3 = plt.subplot(3,1,3)
myplot(ax3)
-ax3.legend(loc=1, ncol=4, mode="expand", shadow=True)
+ax3.legend(shadow=True, fancybox=True)
plt.draw()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|