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: <pki...@us...> - 2008-07-26 18:33:17
|
Revision: 5886
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5886&view=rev
Author: pkienzle
Date: 2008-07-26 18:33:15 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
to_numeric requires PIL
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/to_numeric.py
Modified: trunk/matplotlib/examples/pylab_examples/to_numeric.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/to_numeric.py 2008-07-26 04:50:56 UTC (rev 5885)
+++ trunk/matplotlib/examples/pylab_examples/to_numeric.py 2008-07-26 18:33:15 UTC (rev 5886)
@@ -1,12 +1,16 @@
#!/usr/bin/env python
"""
Use backend agg to access the figure canvas as an RGB string and then
-convert it to a Numeric array and pass the string it to PIL for
+convert it to an array and pass the string it to PIL for
rendering
"""
from pylab import *
from matplotlib.backends.backend_agg import FigureCanvasAgg
+try:
+ import Image
+except ImportError, exc:
+ raise SystemExit("PIL must be installed to run this example")
plot([1,2,3])
@@ -21,10 +25,9 @@
w, h = int(w), int(h)
-X = fromstring(s, UInt8)
+X = fromstring(s, uint8)
X.shape = h, w, 3
-import Image
im = Image.fromstring( "RGB", (w,h), s)
im.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-07-26 04:50:59
|
Revision: 5885
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5885&view=rev
Author: ryanmay
Date: 2008-07-26 04:50:56 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
Change to try to import md5 from hashlib, and fall back to md5. Change the uses of md5 to work with either.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
trunk/matplotlib/lib/matplotlib/finance.py
trunk/matplotlib/lib/matplotlib/texmanager.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-07-26 00:34:02 UTC (rev 5884)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-07-26 04:50:56 UTC (rev 5885)
@@ -3,9 +3,14 @@
"""
from __future__ import division
-import glob, math, md5, os, shutil, sys, time
+import glob, math, os, shutil, sys, time
def _fn_name(): return sys._getframe(1).f_code.co_name
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5 #Deprecated in 2.5
+
from tempfile import gettempdir
from cStringIO import StringIO
from matplotlib import verbose, __version__, rcParams
@@ -892,10 +897,10 @@
passed_in_file_object = False
if is_string_like(outfile):
title = outfile
- tmpfile = os.path.join(gettempdir(), md5.md5(outfile).hexdigest())
+ tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest())
elif is_writable_file_like(outfile):
title = None
- tmpfile = os.path.join(gettempdir(), md5.md5(str(hash(outfile))).hexdigest())
+ 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")
@@ -1033,7 +1038,7 @@
title = outfile
# write to a temp file, we'll move it to outfile when done
- tmpfile = os.path.join(gettempdir(), md5.md5(outfile).hexdigest())
+ tmpfile = os.path.join(gettempdir(), md5(outfile).hexdigest())
fh = file(tmpfile, 'w')
self.figure.dpi = 72 # ignore the dpi kwarg
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008-07-26 00:34:02 UTC (rev 5884)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008-07-26 04:50:56 UTC (rev 5885)
@@ -1,7 +1,12 @@
from __future__ import division
-import os, codecs, base64, tempfile, urllib, gzip, md5, cStringIO
+import os, codecs, base64, tempfile, urllib, gzip, cStringIO
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5 #Deprecated in 2.5
+
from matplotlib import verbose, __version__, rcParams
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
FigureManagerBase, FigureCanvasBase
@@ -127,7 +132,7 @@
id = self._clipd.get(path)
if id is None:
- id = 'p%s' % md5.new(path).hexdigest()
+ id = 'p%s' % md5(path).hexdigest()
self._svgwriter.write('<defs>\n <clipPath id="%s">\n' % id)
self._svgwriter.write(path)
self._svgwriter.write('\n </clipPath>\n</defs>')
@@ -191,7 +196,7 @@
key = self._convert_path(marker_path, marker_trans + Affine2D().scale(1.0, -1.0))
name = self._markers.get(key)
if name is None:
- name = 'm%s' % md5.new(key).hexdigest()
+ name = 'm%s' % md5(key).hexdigest()
write('<defs><path id="%s" d="%s"/></defs>\n' % (name, key))
self._markers[key] = name
@@ -223,7 +228,7 @@
transform = Affine2D(transform.get_matrix()).scale(1.0, -1.0)
d = self._convert_path(path, transform)
name = 'coll%x_%x_%s' % (self._path_collection_id, i,
- md5.new(d).hexdigest())
+ md5(d).hexdigest())
write('<path id="%s" d="%s"/>\n' % (name, d))
path_codes.append(name)
write('</defs>\n')
@@ -412,7 +417,7 @@
if step[0] != 4:
currx, curry = step[-2], -step[-1]
path_data = ''.join(path_data)
- char_num = 'c_%s' % md5.new(path_data).hexdigest()
+ char_num = 'c_%s' % md5(path_data).hexdigest()
path_element = '<path id="%s" d="%s"/>\n' % (char_num, ''.join(path_data))
self._char_defs[char_id] = char_num
return path_element
Modified: trunk/matplotlib/lib/matplotlib/finance.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/finance.py 2008-07-26 00:34:02 UTC (rev 5884)
+++ trunk/matplotlib/lib/matplotlib/finance.py 2008-07-26 04:50:56 UTC (rev 5885)
@@ -4,9 +4,13 @@
"""
#from __future__ import division
-import os, time, warnings, md5
+import os, time, warnings
from urllib import urlopen
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5 #Deprecated in 2.5
try: import datetime
except ImportError:
@@ -111,7 +115,7 @@
if cachename is None:
- cachename = os.path.join(cachedir, md5.md5(url).hexdigest())
+ cachename = os.path.join(cachedir, md5(url).hexdigest())
if os.path.exists(cachename):
fh = file(cachename)
verbose.report('Using cachefile %s for %s'%(cachename, ticker))
Modified: trunk/matplotlib/lib/matplotlib/texmanager.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/texmanager.py 2008-07-26 00:34:02 UTC (rev 5884)
+++ trunk/matplotlib/lib/matplotlib/texmanager.py 2008-07-26 04:50:56 UTC (rev 5885)
@@ -33,7 +33,13 @@
"""
-import copy, glob, md5, os, shutil, sys, warnings
+import copy, glob, os, shutil, sys, warnings
+
+try:
+ from hashlib import md5
+except ImportError:
+ from md5 import md5 #Deprecated in 2.5
+
import distutils.version
import numpy as np
import matplotlib as mpl
@@ -166,7 +172,7 @@
self.get_custom_preamble(), str(dpi or '')])
# make sure hash is consistent for all strings, regardless of encoding:
bytes = unicode(s).encode('utf-8')
- return os.path.join(self.texcache, md5.md5(bytes).hexdigest())
+ return os.path.join(self.texcache, md5(bytes).hexdigest())
def get_font_config(self):
"""Reinitializes self if relevant rcParams on have changed."""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-07-26 00:34:05
|
Revision: 5884
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5884&view=rev
Author: ryanmay
Date: 2008-07-26 00:34:02 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
Set svn:ignore on the subdirectories within examples (except data)
Property Changed:
----------------
trunk/matplotlib/examples/animation/
trunk/matplotlib/examples/api/
trunk/matplotlib/examples/event_handling/
trunk/matplotlib/examples/misc/
trunk/matplotlib/examples/pylab_examples/
trunk/matplotlib/examples/tests/
trunk/matplotlib/examples/units/
trunk/matplotlib/examples/user_interfaces/
trunk/matplotlib/examples/widgets/
Property changes on: trunk/matplotlib/examples/animation
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/api
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/event_handling
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/misc
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/pylab_examples
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/tests
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/units
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/user_interfaces
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
Property changes on: trunk/matplotlib/examples/widgets
___________________________________________________________________
Added: svn:ignore
+ matplotlibrc
matplotlib.conf
*.eps
*.jpeg
*.jpg
*.pdf
*.png
*.ps
*.pyc
*.svg
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-26 00:29:27
|
Revision: 5883
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5883&view=rev
Author: jdh2358
Date: 2008-07-26 00:29:25 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
removed debug savefig from image demo
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/image_demo.py
trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/examples/pylab_examples/image_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/image_demo.py 2008-07-26 00:01:18 UTC (rev 5882)
+++ trunk/matplotlib/examples/pylab_examples/image_demo.py 2008-07-26 00:29:25 UTC (rev 5883)
@@ -14,6 +14,5 @@
im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
origin='lower', extent=[-3,3,-3,3])
-plt.savefig('test.ps', dpi=300)
plt.show()
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2008-07-26 00:01:18 UTC (rev 5882)
+++ trunk/matplotlib/lib/matplotlib/image.py 2008-07-26 00:29:25 UTC (rev 5883)
@@ -638,7 +638,7 @@
def make_image(self, magnification=1.0):
# had to introduce argument magnification to satisfy the unit test
# figimage_demo.py. I have no idea, how magnification should be used
- # within the function. It should be !=1.0 only for non-default DPI
+ # within the function. It should be !=1.0 only for non-default DPI<
# settings in the PS backend, as introduced by patch #1562394
# Probably Nicholas Young should look over this code and see, how
# magnification should be handled correctly.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-07-26 00:01:20
|
Revision: 5882
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5882&view=rev
Author: pkienzle
Date: 2008-07-26 00:01:18 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
Fix contains() for lines; don't redraw axis frame
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/lines.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 23:54:37 UTC (rev 5881)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-07-26 00:01:18 UTC (rev 5882)
@@ -1503,8 +1503,6 @@
artists.extend(self.tables)
if self.legend_ is not None:
artists.append(self.legend_)
- if self.axison and self._frameon:
- artists.append(self.frame)
dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
if not a.get_animated() ]
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 23:54:37 UTC (rev 5881)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2008-07-26 00:01:18 UTC (rev 5882)
@@ -239,7 +239,7 @@
if self._invalid:
self.recache()
if len(self._xy)==0: return False,{}
- tpath, _ = self._transformed_path.get_transformed_path_and_affine()
+ tpath = self._transformed_path.get_fully_transformed_path()
xyt = tpath.vertices
xt = xyt[:, 0]
yt = xyt[:, 1]
@@ -250,7 +250,7 @@
else:
pixels = self.figure.dpi/72. * self.pickradius
- if self._linestyle == 'None':
+ if self._linestyle in ['None',None]:
# If no line, return the nearby point(s)
d = np.sqrt((xt-mouseevent.x)**2 + (yt-mouseevent.y)**2)
ind, = np.nonzero(np.less_equal(d, pixels))
@@ -258,10 +258,11 @@
# If line, return the nearby segment(s)
ind = segment_hits(mouseevent.x,mouseevent.y,xt,yt,pixels)
if 0:
+ print 'linestyle',self._linestyle
print 'xt', xt, mouseevent.x
print 'yt', yt, mouseevent.y
- print 'd', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2.
- print d, pixels, ind
+ print 'dx,dy', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2.
+ print 'ind',ind
return len(ind)>0,dict(ind=ind)
def get_pickradius(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-25 23:54:41
|
Revision: 5881
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5881&view=rev
Author: jdh2358
Date: 2008-07-25 23:54:37 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
added set_figure method for quiverkey
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 23:52:46 UTC (rev 5880)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 23:54:37 UTC (rev 5881)
@@ -296,7 +296,7 @@
quiverkey_doc = _quiverkey_doc
def set_figure(self, fig):
- Artist.set_figure(self, fig)
+ martist.Artist.set_figure(self, fig)
self.text.set_figure(fig)
class Quiver(collections.PolyCollection):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-25 23:52:48
|
Revision: 5880
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5880&view=rev
Author: jdh2358
Date: 2008-07-25 23:52:46 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
added set_figure method for quiverkey
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 23:45:01 UTC (rev 5879)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 23:52:46 UTC (rev 5880)
@@ -235,6 +235,7 @@
self._initialized = False
self.zorder = Q.zorder + 0.1
+
__init__.__doc__ = _quiverkey_doc
def _init(self):
@@ -294,6 +295,10 @@
raise ValueError('unrecognized coordinates')
quiverkey_doc = _quiverkey_doc
+ def set_figure(self, fig):
+ Artist.set_figure(self, fig)
+ self.text.set_figure(fig)
+
class Quiver(collections.PolyCollection):
"""
Specialized PolyCollection for arrows.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-25 23:45:03
|
Revision: 5879
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5879&view=rev
Author: jdh2358
Date: 2008-07-25 23:45:01 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
fix for ps renderer dpi/imagedpi confusion
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/image_demo.py
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/examples/pylab_examples/image_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/image_demo.py 2008-07-25 23:22:26 UTC (rev 5878)
+++ trunk/matplotlib/examples/pylab_examples/image_demo.py 2008-07-25 23:45:01 UTC (rev 5879)
@@ -14,5 +14,6 @@
im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
origin='lower', extent=[-3,3,-3,3])
+plt.savefig('test.ps', dpi=300)
plt.show()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-07-25 23:22:26 UTC (rev 5878)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008-07-25 23:45:01 UTC (rev 5879)
@@ -126,7 +126,12 @@
fontd = maxdict(50)
afmfontd = maxdict(50)
- def __init__(self, width, height, pswriter, dpi=72):
+ def __init__(self, width, height, pswriter, imagedpi=72):
+ """
+ Although postscript itself is dpi independent, we need to
+ imform the image code about a requested dpi to generate high
+ res images and them scale them before embeddin them
+ """
RendererBase.__init__(self)
self.width = width
self.height = height
@@ -134,7 +139,7 @@
if rcParams['text.usetex']:
self.textcnt = 0
self.psfrag = []
- self.dpi = dpi
+ self.imagedpi = imagedpi
# current renderer state (None=uninitialised)
self.color = None
@@ -145,7 +150,7 @@
self.fontname = None
self.fontsize = None
self.hatch = None
- self.image_magnification = dpi/72.0
+ self.image_magnification = imagedpi/72.0
self._clip_paths = {}
self._path_collection_id = 0
@@ -857,15 +862,15 @@
else: raise RuntimeError('Orientation must be "portrait" or "landscape"')
self.figure.set_dpi(72) # Override the dpi kwarg
- dpi = kwargs.get("dpi", 72)
+ imagedpi = kwargs.get("dpi", 72)
facecolor = kwargs.get("facecolor", "w")
edgecolor = kwargs.get("edgecolor", "w")
if rcParams['text.usetex']:
- self._print_figure_tex(outfile, format, dpi, facecolor, edgecolor,
+ self._print_figure_tex(outfile, format, imagedpi, facecolor, edgecolor,
orientation, isLandscape, papertype)
else:
- self._print_figure(outfile, format, dpi, facecolor, edgecolor,
+ self._print_figure(outfile, format, imagedpi, facecolor, edgecolor,
orientation, isLandscape, papertype)
def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w',
@@ -939,7 +944,7 @@
self.figure.set_edgecolor(edgecolor)
self._pswriter = StringIO()
- renderer = RendererPS(width, height, self._pswriter, dpi=dpi)
+ renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
self.figure.draw(renderer)
self.figure.set_facecolor(origfacecolor)
@@ -1050,7 +1055,7 @@
self.figure.set_edgecolor(edgecolor)
self._pswriter = StringIO()
- renderer = RendererPS(width, height, self._pswriter, dpi=dpi)
+ renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
self.figure.draw(renderer)
self.figure.set_facecolor(origfacecolor)
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-07-25 23:22:26 UTC (rev 5878)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-07-25 23:45:01 UTC (rev 5879)
@@ -222,7 +222,7 @@
"""
Set the offsets for the collection. *offsets* can be a scalar
or a sequence.
-
+
ACCEPTS: float or sequence of floats
"""
offsets = np.asarray(offsets, np.float_)
@@ -603,7 +603,7 @@
if self._sizes is not None:
self._transforms = [
transforms.Affine2D().scale(
- (np.sqrt(x) * renderer.dpi / 72.0))
+ (np.sqrt(x) * self.figure.dpi / 72.0))
for x in self._sizes]
return Collection.draw(self, renderer)
@@ -680,7 +680,7 @@
# in points^2
self._transforms = [
transforms.Affine2D().rotate(-self._rotation).scale(
- (np.sqrt(x) * renderer.dpi / 72.0) / np.sqrt(np.pi))
+ (np.sqrt(x) * self.figure.dpi / 72.0) / np.sqrt(np.pi))
for x in self._sizes]
return Collection.draw(self, renderer)
@@ -877,7 +877,7 @@
# in points^2
self._transforms = [
transforms.Affine2D().scale(
- (np.sqrt(x) * renderer.dpi / 72.0) / np.sqrt(np.pi))
+ (np.sqrt(x) * self.figure.dpi / 72.0) / np.sqrt(np.pi))
for x in self._sizes]
return Collection.draw(self, renderer)
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-07-25 23:22:26 UTC (rev 5878)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-07-25 23:45:01 UTC (rev 5879)
@@ -400,7 +400,7 @@
return (x, y, self._text, self._color,
self._verticalalignment, self._horizontalalignment,
hash(self._fontproperties), self._rotation,
- self._renderer.dpi, id(self._renderer)
+ self.figure.dpi, id(self._renderer)
)
def get_text(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-07-25 23:22:28
|
Revision: 5878
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5878&view=rev
Author: pkienzle
Date: 2008-07-25 23:22:26 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Fix contains() for text and lines
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 21:32:06 UTC (rev 5877)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 23:22:26 UTC (rev 5878)
@@ -2350,8 +2350,7 @@
"""
if callable(self._contains): return self._contains(self,mouseevent)
- inside = self.patch.contains(mouseevent.x, mouseevent.y)
- return inside,{}
+ return self.patch.contains(mouseevent)
def pick(self, *args):
"""
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 21:32:06 UTC (rev 5877)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 23:22:26 UTC (rev 5878)
@@ -236,10 +236,11 @@
if not is_numlike(self.pickradius):
raise ValueError,"pick radius should be a distance"
- # transform in backend
+ if self._invalid:
+ self.recache()
if len(self._xy)==0: return False,{}
-
- xyt = self._transformed_path.get_fully_transformed_path().vertices
+ tpath, _ = self._transformed_path.get_transformed_path_and_affine()
+ xyt = tpath.vertices
xt = xyt[:, 0]
yt = xyt[:, 1]
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-07-25 21:32:06 UTC (rev 5877)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-07-25 23:22:26 UTC (rev 5878)
@@ -135,6 +135,8 @@
"""
if callable(self._contains): return self._contains(self,mouseevent)
+ if not self.get_visible() or self._renderer is None:
+ return False,{}
l,b,w,h = self.get_window_extent().bounds
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-07-25 21:32:08
|
Revision: 5877
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5877&view=rev
Author: pkienzle
Date: 2008-07-25 21:32:06 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
update axis contains method for new transforms
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axis.py
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2008-07-25 19:52:11 UTC (rev 5876)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2008-07-25 21:32:06 UTC (rev 5877)
@@ -1144,13 +1144,17 @@
"""
if callable(self._contains): return self._contains(self,mouseevent)
- xpixel,ypixel = mouseevent.x,mouseevent.y
+ x,y = mouseevent.x,mouseevent.y
try:
- xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
- xorigin,yorigin = self.axes.transAxes.xy_tup((0,0))
+ trans = self.axes.transAxes.inverted()
+ xaxes,yaxes = trans.transform_point((x,y))
except ValueError:
return False, {}
- inaxis = xaxes>=0 and xaxes<=1 and ypixel<yorigin and ypixel>yorigin-self.pickradius
+ l,b = self.axes.transAxes.transform_point((0,0))
+ r,t = self.axes.transAxes.transform_point((1,1))
+ inaxis = xaxes>=0 and xaxes<=1 and (
+ (y<b and y>b-self.pickradius) or
+ (y>t and y<t+self.pickradius))
return inaxis, {}
def _get_tick(self, major):
@@ -1376,13 +1380,17 @@
"""
if callable(self._contains): return self._contains(self,mouseevent)
- xpixel,ypixel = mouseevent.x,mouseevent.y
+ x,y = mouseevent.x,mouseevent.y
try:
- xaxes,yaxes = self.axes.transAxes.inverse_xy_tup((xpixel,ypixel))
- xorigin,yorigin = self.axes.transAxes.xy_tup((0,0))
+ trans = self.axes.transAxes.inverted()
+ xaxes,yaxes = trans.transform_point((x,y))
except ValueError:
return False, {}
- inaxis = yaxes>=0 and yaxes<=1 and xpixel<xorigin and xpixel>xorigin-self.pickradius
+ l,b = self.axes.transAxes.transform_point((0,0))
+ r,t = self.axes.transAxes.transform_point((1,1))
+ inaxis = yaxes>=0 and yaxes<=1 and (
+ (x<l and x>l-self.pickradius) or
+ (x>r and x<r+self.pickradius))
return inaxis, {}
def _get_tick(self, major):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-07-25 19:52:13
|
Revision: 5876
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5876&view=rev
Author: pkienzle
Date: 2008-07-25 19:52:11 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
wx backend: implement draw_idle
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-07-25 17:38:06 UTC (rev 5875)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-07-25 19:52:11 UTC (rev 5876)
@@ -719,12 +719,20 @@
bind(self, wx.EVT_LEAVE_WINDOW, self._onLeave)
bind(self, wx.EVT_IDLE, self._onIdle)
+ # Event loop handler for start/stop event loop
self._event_loop = wx.EventLoop()
self.macros = {} # dict from wx id to seq of macros
self.Printer_Init()
+ # Create an timer for handling draw_idle requests
+ # If there are events pending when the timer is
+ # complete, reset the timer and continue. The
+ # alternative approach, binding to wx.EVT_IDLE,
+ # doesn't behave as nicely.
+ self.idletimer = wx.CallLater(1,self._onDrawIdle)
+
def Destroy(self, *args, **kwargs):
wx.Panel.Destroy(self, *args, **kwargs)
@@ -880,8 +888,18 @@
def draw_idle(self, *args, **kwargs):
- pass
+ """
+ Delay rendering until the GUI is idle.
+ """
+ DEBUG_MSG("draw_idle()", 1, self)
+ self.idletimer.Restart(50, *args, **kwargs) # Delay by 50 ms
+ def _onDrawIdle(self, *args, **kwargs):
+ if False and wx.GetApp().Pending():
+ self.idletimer.Restart(5, *args, **kwargs)
+ else:
+ self.draw(*args, **kwargs)
+
def draw(self, repaint=True):
"""
Render the figure using RendererWx instance renderer, or using a
@@ -960,14 +978,16 @@
redraw the image.
"""
DEBUG_MSG("gui_repaint()", 1, self)
- if drawDC is None:
- drawDC=wx.ClientDC(self)
+ if self.IsShownOnScreen():
- drawDC.BeginDrawing()
- drawDC.DrawBitmap(self.bitmap, 0, 0)
- drawDC.EndDrawing()
- #wx.GetApp().Yield()
+ if drawDC is None:
+ drawDC=wx.ClientDC(self)
+ drawDC.BeginDrawing()
+ drawDC.DrawBitmap(self.bitmap, 0, 0)
+ drawDC.EndDrawing()
+ #wx.GetApp().Yield()
+
filetypes = FigureCanvasBase.filetypes.copy()
filetypes['bmp'] = 'Windows bitmap'
filetypes['jpeg'] = 'JPEG'
@@ -1031,6 +1051,10 @@
# Restore everything to normal
self.bitmap = origBitmap
+ # Note: draw is required here since bits of state about the
+ # last renderer are strewn about the artist draw methods. Do
+ # not remove the draw without first verifying that these have
+ # been cleaned up.
self.draw()
self.Refresh()
@@ -1089,7 +1113,7 @@
self.figure.set_size_inches(winch, hinch)
if self._isRealized:
- self.draw()
+ self.draw_idle()
evt.Skip()
def _get_key(self, evt):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-25 17:38:08
|
Revision: 5875
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5875&view=rev
Author: jdh2358
Date: 2008-07-25 17:38:06 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
cleaned up a few rest doc warnings
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/lib/matplotlib/figure.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2008-07-25 15:09:08 UTC (rev 5874)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2008-07-25 17:38:06 UTC (rev 5875)
@@ -1167,10 +1167,6 @@
This is very inefficient linear interpolation meant to be used
only for a small number of points in relatively non-intensive use
cases.
-
- Call signature::
-
- yi = less_simple_linear_interpolation(x,y,xi)
"""
if is_scalar(xi): xi = [xi]
@@ -1348,21 +1344,15 @@
If you just want to see if the array has 1 axis, use X.ndim==1
- Call signature::
- isvector(X)
"""
return np.prod(X.shape)==np.max(X.shape)
def vector_lengths( X, P=2., axis=None ):
"""
Finds the length of a set of vectors in n dimensions. This is
- like the mlab.norm function for vectors, but has the ability to
+ like the numpy norm function for vectors, but has the ability to
work over a particular axis of the supplied array or matrix.
- Call signature::
-
- vector_lengths( X, P=2., axis=None )
-
Computes (sum((x_i)^P))^(1/P) for each {x_i} being the elements of X along
the given axis. If *axis* is *None*, compute over all elements of X.
"""
@@ -1373,10 +1363,6 @@
"""
Computes the distance between a set of successive points in N dimensions.
- Call signature::
-
- distances_along_curve(X)
-
where X is an MxN array or matrix. The distances between successive rows
is computed. Distance is the standard Euclidean distance.
"""
@@ -1387,10 +1373,7 @@
"""
Computes the distance travelled along a polygonal curve in N dimensions.
- Call signature::
- path_length(X)
-
where X is an MxN array or matrix. Returns an array of length M consisting
of the distance along the curve at each point (i.e., the rows of X).
"""
@@ -1403,9 +1386,6 @@
presumably coordinates on a polygonal curve, in which case this function
tests if that curve is closed.
- Call signature::
-
- is_closed_polygon(X)
"""
return np.all(X[0] == X[-1])
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py 2008-07-25 15:09:08 UTC (rev 5874)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2008-07-25 17:38:06 UTC (rev 5875)
@@ -846,9 +846,9 @@
def text(self, x, y, s, *args, **kwargs):
"""
- Call signature:
+ Call signature::
- figtext(x, y, s, fontdict=None, **kwargs)
+ figtext(x, y, s, fontdict=None, **kwargs)
Add text to figure at location *x*, *y* (relative 0-1
coords). See :func:`~matplotlib.pyplot.text` for the meaning
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-25 15:09:13
|
Revision: 5874
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5874&view=rev
Author: jdh2358
Date: 2008-07-25 15:09:08 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
fixed start event loop docstring
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-07-25 13:17:10 UTC (rev 5873)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-07-25 15:09:08 UTC (rev 5874)
@@ -1069,7 +1069,7 @@
else:
self._button = 'down'
s = 'scroll_event'
- mouseevent = MouseEvent(s, self, x, y, self._button, self._key,
+ mouseevent = MouseEvent(s, self, x, y, self._button, self._key,
step=step, guiEvent=guiEvent)
self.callbacks.process(s, mouseevent)
@@ -1437,7 +1437,7 @@
Call signature::
- start_event_loop_default(self,timeout=0)
+ start_event_loop_default(self,timeout=0)
This call blocks until a callback function triggers
stop_event_loop() or *timeout* is reached. If *timeout* is
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-07-25 13:17:14
|
Revision: 5873
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5873&view=rev
Author: jdh2358
Date: 2008-07-25 13:17:10 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
committed tonys minor changes
Modified Paths:
--------------
trunk/matplotlib/examples/event_handling/lasso_demo.py
trunk/matplotlib/lib/matplotlib/axis.py
Modified: trunk/matplotlib/examples/event_handling/lasso_demo.py
===================================================================
--- trunk/matplotlib/examples/event_handling/lasso_demo.py 2008-07-25 11:58:15 UTC (rev 5872)
+++ trunk/matplotlib/examples/event_handling/lasso_demo.py 2008-07-25 13:17:10 UTC (rev 5873)
@@ -69,7 +69,7 @@
# acquire a lock on the widget drawing
self.canvas.widgetlock(self.lasso)
-if 0:
+if __name__ == '__main__':
data = [Datum(*xy) for xy in rand(100, 2)]
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2008-07-25 11:58:15 UTC (rev 5872)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2008-07-25 13:17:10 UTC (rev 5873)
@@ -147,7 +147,7 @@
"""
self._pad = val
- def get_pad(self, val):
+ def get_pad(self):
'Get the value of the tick label pad in points'
return self._pad
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-07-25 11:58:17
|
Revision: 5872
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5872&view=rev
Author: jswhit
Date: 2008-07-25 11:58:15 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
update barb_demo comments.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/barb_demo.py
Modified: trunk/toolkits/basemap/examples/barb_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/barb_demo.py 2008-07-25 11:57:39 UTC (rev 5871)
+++ trunk/toolkits/basemap/examples/barb_demo.py 2008-07-25 11:58:15 UTC (rev 5872)
@@ -70,8 +70,7 @@
cs1 = m.contour(x,y,p,levs,colors='k',linewidths=0.5)
cs2 = m.contourf(x,y,p,levs)
# plot barbs.
-nh,sh=m.barbs(xv,yv,udat,vdat,length=6,barbcolor='k',flagcolor='r',linewidth=0.5)
-print dir(nh)
+m.barbs(xv,yv,udat,vdat,length=6,barbcolor='k',flagcolor='r',linewidth=0.5)
# plot colorbar for pressure
cax = plt.axes([0.875, 0.1, 0.05, 0.8]) # setup colorbar axes.
plt.colorbar(cax=cax) # draw colorbar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-07-25 11:57:45
|
Revision: 5871
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5871&view=rev
Author: jswhit
Date: 2008-07-25 11:57:39 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
update barb_demo comments.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/barb_demo.py
Modified: trunk/toolkits/basemap/examples/barb_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/barb_demo.py 2008-07-25 11:54:44 UTC (rev 5870)
+++ trunk/toolkits/basemap/examples/barb_demo.py 2008-07-25 11:57:39 UTC (rev 5871)
@@ -53,6 +53,8 @@
plt.title('Surface Wind Barbs and Pressure (NH)')
# stereogrpaphic projection (SH).
+# 'flip_barb' flag is automatically set for SH data, so that
+# barbs point toward lower pressure (in both Hemisphere).
m = Basemap(width=10000000,height=10000000,lon_0=-90,lat_0=-45.,lat_ts=-45,
resolution='l',projection='stere')
x,y = m(lons,lats)
@@ -68,7 +70,8 @@
cs1 = m.contour(x,y,p,levs,colors='k',linewidths=0.5)
cs2 = m.contourf(x,y,p,levs)
# plot barbs.
-m.barbs(xv,yv,udat,vdat,length=6,barbcolor='k',flagcolor='r',linewidth=0.5)
+nh,sh=m.barbs(xv,yv,udat,vdat,length=6,barbcolor='k',flagcolor='r',linewidth=0.5)
+print dir(nh)
# plot colorbar for pressure
cax = plt.axes([0.875, 0.1, 0.05, 0.8]) # setup colorbar axes.
plt.colorbar(cax=cax) # draw colorbar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-07-25 11:54:47
|
Revision: 5870
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5870&view=rev
Author: jswhit
Date: 2008-07-25 11:54:44 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
update barbs method docstring.
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-25 11:41:18 UTC (rev 5869)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-25 11:54:44 UTC (rev 5870)
@@ -2898,6 +2898,9 @@
Extra keyword ``ax`` can be used to override the default axis instance.
Other \*args and \**kwargs passed on to matplotlib.pyplot.barbs
+
+ Returns two matplotlib.axes.Barbs instances, one for the Northern
+ Hemisphere and one for the Southern Hemisphere.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-07-25 11:41:20
|
Revision: 5869
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5869&view=rev
Author: jswhit
Date: 2008-07-25 11:41:18 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
add SH plot (to test auto barb flipping).
Modified Paths:
--------------
trunk/toolkits/basemap/examples/barb_demo.py
Modified: trunk/toolkits/basemap/examples/barb_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/barb_demo.py 2008-07-25 10:22:29 UTC (rev 5868)
+++ trunk/toolkits/basemap/examples/barb_demo.py 2008-07-25 11:41:18 UTC (rev 5869)
@@ -32,8 +32,8 @@
nxv = 25; nyv = 25
udat, vdat, xv, yv = m.transform_vector(u,v,lons1,lats1,nxv,nyv,returnxy=True)
# create a figure, add an axes.
-fig=plt.figure(figsize=(8,8))
-ax = fig.add_axes([0.1,0.1,0.7,0.7])
+fig=plt.figure(figsize=(8,6))
+ax = fig.add_axes([0.1,0.1,0.8,0.8])
# plot color-filled contours over map
levs = np.arange(960,1051,4)
cs1 = m.contour(x,y,p,levs,colors='k',linewidths=0.5)
@@ -41,7 +41,7 @@
# plot barbs.
m.barbs(xv,yv,udat,vdat,length=6,barbcolor='k',flagcolor='r',linewidth=0.5)
# plot colorbar for pressure
-cax = plt.axes([0.875, 0.1, 0.05, 0.7]) # setup colorbar axes.
+cax = plt.axes([0.875, 0.1, 0.05, 0.8]) # setup colorbar axes.
plt.colorbar(cax=cax) # draw colorbar
plt.axes(ax) # make the original axes current again
# draw coastlines
@@ -50,6 +50,34 @@
m.drawparallels(np.arange(0,81,20),labels=[1,1,0,0])
# draw meridians
m.drawmeridians(np.arange(-180,0,20),labels=[0,0,0,1])
-plt.title('Surface Wind Barbs and Pressure')
+plt.title('Surface Wind Barbs and Pressure (NH)')
+
+# stereogrpaphic projection (SH).
+m = Basemap(width=10000000,height=10000000,lon_0=-90,lat_0=-45.,lat_ts=-45,
+ resolution='l',projection='stere')
+x,y = m(lons,lats)
+# transform from spherical to map projection coordinates (rotation
+# and interpolation).
+nxv = 25; nyv = 25
+udat, vdat, xv, yv = m.transform_vector(u,v,lons1,lats1,nxv,nyv,returnxy=True)
+# create a figure, add an axes.
+fig=plt.figure(figsize=(8,6))
+ax = fig.add_axes([0.1,0.1,0.8,0.8])
+# plot color-filled contours over map
+levs = np.arange(960,1051,4)
+cs1 = m.contour(x,y,p,levs,colors='k',linewidths=0.5)
+cs2 = m.contourf(x,y,p,levs)
+# plot barbs.
+m.barbs(xv,yv,udat,vdat,length=6,barbcolor='k',flagcolor='r',linewidth=0.5)
+# plot colorbar for pressure
+cax = plt.axes([0.875, 0.1, 0.05, 0.8]) # setup colorbar axes.
+plt.colorbar(cax=cax) # draw colorbar
+plt.axes(ax) # make the original axes current again
+# draw coastlines
+m.drawcoastlines()
+# draw parallels
+m.drawparallels(np.arange(-80,-19,20),labels=[1,1,0,0])
+# draw meridians
+m.drawmeridians(np.arange(-180,0,20),labels=[0,0,1,0])
+plt.title('Surface Wind Barbs and Pressure (SH)',y=1.04)
plt.show()
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dmk...@us...> - 2008-07-25 10:22:33
|
Revision: 5868
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5868&view=rev
Author: dmkaplan
Date: 2008-07-25 10:22:29 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Committing a small change to make twinx share axes like twiny.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 06:30:52 UTC (rev 5867)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-07-25 10:22:29 UTC (rev 5868)
@@ -6006,7 +6006,7 @@
right
"""
- ax2 = self.figure.add_axes(self.get_position(True), # sharex=self,
+ ax2 = self.figure.add_axes(self.get_position(True), sharex=self,
frameon=False)
ax2.yaxis.tick_right()
ax2.yaxis.set_label_position('right')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-07-25 06:30:54
|
Revision: 5867
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5867&view=rev
Author: pkienzle
Date: 2008-07-25 06:30:52 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
tk mouse wheel: y values start from the top of the screen
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-07-25 05:01:18 UTC (rev 5866)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-07-25 06:30:52 UTC (rev 5867)
@@ -291,6 +291,7 @@
if w == self._tkcanvas:
x = event.x_root - w.winfo_rootx()
y = event.y_root - w.winfo_rooty()
+ y = self.figure.bbox.height - y
step = event.delta/120.
FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pki...@us...> - 2008-07-25 05:01:23
|
Revision: 5866
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5866&view=rev
Author: pkienzle
Date: 2008-07-25 05:01:18 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
mouse wheel support for tk backend
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-07-25 03:55:16 UTC (rev 5865)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py 2008-07-25 05:01:18 UTC (rev 5866)
@@ -164,10 +164,19 @@
self._tkcanvas.bind("<KeyRelease>", self.key_release)
for name in "<Button-1>", "<Button-2>", "<Button-3>":
self._tkcanvas.bind(name, self.button_press_event)
-
for name in "<ButtonRelease-1>", "<ButtonRelease-2>", "<ButtonRelease-3>":
self._tkcanvas.bind(name, self.button_release_event)
+ # Mouse wheel on Linux generates button 4/5 events
+ for name in "<Button-4>", "<Button-5>":
+ self._tkcanvas.bind(name, self.scroll_event)
+ # Mouse wheel for windows goes to the window with the focus.
+ # Since the canvas won't usually have the focus, bind the
+ # event to the window containing the canvas instead.
+ # See http://wiki.tcl.tk/3893 (mousewheel) for details
+ root = self._tkcanvas.winfo_toplevel()
+ root.bind("<MouseWheel>", self.scroll_event_windows)
+
self._master = master
self._tkcanvas.focus_set()
@@ -265,6 +274,26 @@
FigureCanvasBase.button_release_event(self, x, y, num, guiEvent=event)
+ def scroll_event(self, event):
+ x = event.x
+ y = self.figure.bbox.height - event.y
+ num = getattr(event, 'num', None)
+ if num==4: step = -1
+ elif num==5: step = +1
+ else: step = 0
+
+ FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
+
+ def scroll_event_windows(self, event):
+ """MouseWheel event processor"""
+ # need to find the window that contains the mouse
+ w = event.widget.winfo_containing(event.x_root, event.y_root)
+ if w == self._tkcanvas:
+ x = event.x_root - w.winfo_rootx()
+ y = event.y_root - w.winfo_rooty()
+ step = event.delta/120.
+ FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event)
+
def _get_key(self, event):
val = event.keysym_num
if self.keyvald.has_key(val):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-07-25 03:55:19
|
Revision: 5865
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5865&view=rev
Author: efiring
Date: 2008-07-25 03:55:16 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Fix quiverkey with coordinates="inches".
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 03:53:18 UTC (rev 5864)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 03:55:16 UTC (rev 5865)
@@ -289,10 +289,7 @@
elif self.coord == 'figure':
self.set_transform(self.Q.ax.figure.transFigure)
elif self.coord == 'inches':
- dx = ax.figure.dpi
- bb = transforms.Bbox.from_extents(0, 0, dx, dy)
- trans = transforms.BboxTransformTo(bb)
- self.set_transform(trans)
+ self.set_transform(self.Q.ax.figure.dpi_scale_trans)
else:
raise ValueError('unrecognized coordinates')
quiverkey_doc = _quiverkey_doc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-07-25 03:53:22
|
Revision: 5864
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5864&view=rev
Author: efiring
Date: 2008-07-25 03:53:18 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Fix quiver whitespace
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 03:41:21 UTC (rev 5863)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-07-25 03:53:18 UTC (rev 5864)
@@ -5,8 +5,8 @@
direction of the vector, with the size of the arrow related to the
magnitude of the vector.
-Barbs are like quiver in that they point along a vector, but
-the magnitude of the vector is given schematically by the presence of barbs
+Barbs are like quiver in that they point along a vector, but
+the magnitude of the vector is given schematically by the presence of barbs
or flags on the barb.
This will also become a home for things such as standard
@@ -23,7 +23,7 @@
import matplotlib.artist as martist
import matplotlib.font_manager as font_manager
from matplotlib.cbook import delete_masked_points
-from matplotlib.patches import CirclePolygon
+from matplotlib.patches import CirclePolygon
import math
@@ -506,63 +506,63 @@
quiver_doc = _quiver_doc
-_barbs_doc = """
-Plot a 2-D field of barbs.
-
-call signatures::
-
- barb(U, V, **kw)
- barb(U, V, C, **kw)
- barb(X, Y, U, V, **kw)
- barb(X, Y, U, V, C, **kw)
-
-Arguments:
-
- *X*, *Y*:
- The x and y coordinates of the barb locations
- (default is head of barb; see *pivot* kwarg)
-
- *U*, *V*:
- give the *x* and *y* components of the barb shaft
-
- *C*:
- an optional array used to map colors to the barbs
-
-All arguments may be 1-D or 2-D arrays or sequences. If *X* and *Y*
-are absent, they will be generated as a uniform grid. If *U* and *V*
-are 2-D arrays but *X* and *Y* are 1-D, and if len(*X*) and len(*Y*)
-match the column and row dimensions of *U*, then *X* and *Y* will be
-expanded with :func:`numpy.meshgrid`.
-
-*U*, *V*, *C* may be masked arrays, but masked *X*, *Y* are not
-supported at present.
-
-Keyword arguments:
-
- *length*:
- Length of the barb in points; the other parts of the barb
- are scaled against this.
- Default is 9
-
- *pivot*: [ 'tip' | 'middle' ]
- The part of the arrow that is at the grid point; the arrow
+_barbs_doc = """
+Plot a 2-D field of barbs.
+
+call signatures::
+
+ barb(U, V, **kw)
+ barb(U, V, C, **kw)
+ barb(X, Y, U, V, **kw)
+ barb(X, Y, U, V, C, **kw)
+
+Arguments:
+
+ *X*, *Y*:
+ The x and y coordinates of the barb locations
+ (default is head of barb; see *pivot* kwarg)
+
+ *U*, *V*:
+ give the *x* and *y* components of the barb shaft
+
+ *C*:
+ an optional array used to map colors to the barbs
+
+All arguments may be 1-D or 2-D arrays or sequences. If *X* and *Y*
+are absent, they will be generated as a uniform grid. If *U* and *V*
+are 2-D arrays but *X* and *Y* are 1-D, and if len(*X*) and len(*Y*)
+match the column and row dimensions of *U*, then *X* and *Y* will be
+expanded with :func:`numpy.meshgrid`.
+
+*U*, *V*, *C* may be masked arrays, but masked *X*, *Y* are not
+supported at present.
+
+Keyword arguments:
+
+ *length*:
+ Length of the barb in points; the other parts of the barb
+ are scaled against this.
+ Default is 9
+
+ *pivot*: [ 'tip' | 'middle' ]
+ The part of the arrow that is at the grid point; the arrow
rotates about this point, hence the name *pivot*.
- Default is 'tip'
-
- *barbcolor*: [ color | color sequence ]
- Specifies the color all parts of the barb except any flags.
- This parameter is analagous to the *edgecolor* parameter
- for polygons, which can be used instead. However this parameter
- will override facecolor.
-
- *flagcolor*: [ color | color sequence ]
- Specifies the color of any flags on the barb.
- This parameter is analagous to the *facecolor* parameter
- for polygons, which can be used instead. However this parameter
- will override facecolor. If this is not set (and *C* has not either)
- then *flagcolor* will be set to match *barbcolor* so that the barb
- has a uniform color. If *C* has been set, *flagcolor* has no effect.
-
+ Default is 'tip'
+
+ *barbcolor*: [ color | color sequence ]
+ Specifies the color all parts of the barb except any flags.
+ This parameter is analagous to the *edgecolor* parameter
+ for polygons, which can be used instead. However this parameter
+ will override facecolor.
+
+ *flagcolor*: [ color | color sequence ]
+ Specifies the color of any flags on the barb.
+ This parameter is analagous to the *facecolor* parameter
+ for polygons, which can be used instead. However this parameter
+ will override facecolor. If this is not set (and *C* has not either)
+ then *flagcolor* will be set to match *barbcolor* so that the barb
+ has a uniform color. If *C* has been set, *flagcolor* has no effect.
+
*sizes*:
A dictionary of coefficients specifying the ratio of a given feature
to the length of the barb. Only those values one wishes to override
@@ -576,7 +576,7 @@
A flag on whether the empty barbs (circles) that are drawn should be filled
with the flag color. If they are not filled, they will be drawn such that
no color is applied to the center.
- Default is False
+ Default is False
*rounding*:
A flag to indicate whether the vector magnitude should be rounded when
@@ -588,7 +588,7 @@
*barb_increments*:
A dictionary of increments specifying values to associate with different
parts of the barb. Only those values one wishes to override need to be
- included.
+ included.
'half' - half barbs (Default is 5)
'full' - full barbs (Default is 10)
'flag' - flags (default is 50)
@@ -602,66 +602,66 @@
wind barbs having these features point towards low pressure in the
Northern Hemisphere.)
Default is False
-
-Barbs are traditionally used in meteorology as a way to plot the speed
-and direction of wind observations, but can technically be used to plot
-any two dimensional vector quantity. As opposed to arrows, which give
-vector magnitude by the length of the arrow, the barbs give more quantitative
-information about the vector magnitude by putting slanted lines or a triangle
-for various increments in magnitude, as show schematically below:
-
- /\ \
- / \ \
- / \ \ \
-/ \ \ \
-------------------------------
-
+
+Barbs are traditionally used in meteorology as a way to plot the speed
+and direction of wind observations, but can technically be used to plot
+any two dimensional vector quantity. As opposed to arrows, which give
+vector magnitude by the length of the arrow, the barbs give more quantitative
+information about the vector magnitude by putting slanted lines or a triangle
+for various increments in magnitude, as show schematically below:
+
+ /\ \
+ / \ \
+ / \ \ \
+/ \ \ \
+------------------------------
+
The largest increment is given by a triangle (or "flag"). After those come full
-lines (barbs). The smallest increment is a half line. There is only, of
-course, ever at most 1 half line. If the magnitude is small and only needs a
-single half-line and no full lines or triangles, the half-line is offset from
-the end of the barb so that it can be easily distinguished from barbs with a
-single full line. The magnitude for the barb shown above would nominally be
-65, using the standard increments of 50, 10, and 5.
-
-linewidths and edgecolors can be used to customize the barb.
-Additional :class:`~matplotlib.collections.PolyCollection`
-keyword arguments:
-
-%(PolyCollection)s
-""" % martist.kwdocd
+lines (barbs). The smallest increment is a half line. There is only, of
+course, ever at most 1 half line. If the magnitude is small and only needs a
+single half-line and no full lines or triangles, the half-line is offset from
+the end of the barb so that it can be easily distinguished from barbs with a
+single full line. The magnitude for the barb shown above would nominally be
+65, using the standard increments of 50, 10, and 5.
-class Barbs(collections.PolyCollection):
- '''
- Specialized PolyCollection for barbs.
-
+linewidths and edgecolors can be used to customize the barb.
+Additional :class:`~matplotlib.collections.PolyCollection`
+keyword arguments:
+
+%(PolyCollection)s
+""" % martist.kwdocd
+
+class Barbs(collections.PolyCollection):
+ '''
+ Specialized PolyCollection for barbs.
+
The only API method is set_UVC(), which can be used
to change the size, orientation, and color of the
arrows. Locations are changed using the set_offsets() collection
method.Possibly this method will be useful in animations.
-
- There is one internal function _find_tails() which finds exactly
- what should be put on the barb given the vector magnitude. From there
- _make_barbs() is used to find the vertices of the polygon to represent the
- barb based on this information.
- '''
- #This may be an abuse of polygons here to render what is essentially maybe
- #1 triangle and a series of lines. It works fine as far as I can tell
- #however.
- def __init__(self, ax, *args, **kw):
- self._pivot = kw.pop('pivot', 'tip')
- self._length = kw.pop('length', 7)
- barbcolor = kw.pop('barbcolor', None)
- flagcolor = kw.pop('flagcolor', None)
+
+ There is one internal function _find_tails() which finds exactly
+ what should be put on the barb given the vector magnitude. From there
+ _make_barbs() is used to find the vertices of the polygon to represent the
+ barb based on this information.
+ '''
+ #This may be an abuse of polygons here to render what is essentially maybe
+ #1 triangle and a series of lines. It works fine as far as I can tell
+ #however.
+ def __init__(self, ax, *args, **kw):
+ self._pivot = kw.pop('pivot', 'tip')
+ self._length = kw.pop('length', 7)
+ barbcolor = kw.pop('barbcolor', None)
+ flagcolor = kw.pop('flagcolor', None)
self.sizes = kw.pop('sizes', dict())
self.fill_empty = kw.pop('fill_empty', False)
self.barb_increments = kw.pop('barb_increments', dict())
self.rounding = kw.pop('rounding', True)
self.flip = kw.pop('flip_barb', False)
- #Flagcolor and and barbcolor provide convenience parameters for setting
- #the facecolor and edgecolor, respectively, of the barb polygon. We
- #also work here to make the flag the same color as the rest of the barb
+ #Flagcolor and and barbcolor provide convenience parameters for setting
+ #the facecolor and edgecolor, respectively, of the barb polygon. We
+ #also work here to make the flag the same color as the rest of the barb
#by default
if None in (barbcolor, flagcolor):
kw['edgecolors'] = 'face'
@@ -671,109 +671,109 @@
kw['facecolors'] = barbcolor
else:
#Set to facecolor passed in or default to black
- kw.setdefault('facecolors', 'k')
+ kw.setdefault('facecolors', 'k')
else:
kw['edgecolors'] = barbcolor
kw['facecolors'] = flagcolor
-
- #Parse out the data arrays from the various configurations supported
+
+ #Parse out the data arrays from the various configurations supported
x, y, u, v, c = self._parse_args(*args)
self.x = x
- self.y = y
- xy = np.hstack((x[:,np.newaxis], y[:,np.newaxis]))
+ self.y = y
+ xy = np.hstack((x[:,np.newaxis], y[:,np.newaxis]))
- #Make a collection
+ #Make a collection
barb_size = self._length**2 / 4 #Empirically determined
collections.PolyCollection.__init__(self, [], (barb_size,), offsets=xy,
- transOffset=ax.transData, **kw)
- self.set_transform(transforms.IdentityTransform())
+ transOffset=ax.transData, **kw)
+ self.set_transform(transforms.IdentityTransform())
self.set_UVC(u, v, c)
-
- __init__.__doc__ = """
- The constructor takes one required argument, an Axes
- instance, followed by the args and kwargs described
- by the following pylab interface documentation:
- %s""" % _barbs_doc
-
- def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
+
+ __init__.__doc__ = """
+ The constructor takes one required argument, an Axes
+ instance, followed by the args and kwargs described
+ by the following pylab interface documentation:
+ %s""" % _barbs_doc
+
+ def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
'''Find how many of each of the tail pieces is necessary. Flag
specifies the increment for a flag, barb for a full barb, and half for
- half a barb. Mag should be the magnitude of a vector (ie. >= 0).
-
- This returns a tuple of:
- (number of flags, number of barbs, half_flag, empty_flag)
- half_flag is a boolean whether half of a barb is needed, since there
+ half a barb. Mag should be the magnitude of a vector (ie. >= 0).
+
+ This returns a tuple of:
+ (number of flags, number of barbs, half_flag, empty_flag)
+ half_flag is a boolean whether half of a barb is needed, since there
should only ever be one half on a given barb. Empty flag is an array
of flags to easily tell if a barb is empty (too low to plot any
- barbs/flags.'''
+ barbs/flags.'''
#If rounding, round to the nearest multiple of half, the smallest
#increment
if rounding:
mag = half * (mag / half + 0.5).astype(np.int)
-
- num_flags = np.floor(mag / flag).astype(np.int)
- mag = np.mod(mag, flag)
-
- num_barb = np.floor(mag / full).astype(np.int)
- mag = np.mod(mag, full)
-
+
+ num_flags = np.floor(mag / flag).astype(np.int)
+ mag = np.mod(mag, flag)
+
+ num_barb = np.floor(mag / full).astype(np.int)
+ mag = np.mod(mag, full)
+
half_flag = mag >= half
empty_flag = ~(half_flag | (num_flags > 0) | (num_barb > 0))
-
- return num_flags, num_barb, half_flag, empty_flag
-
+
+ return num_flags, num_barb, half_flag, empty_flag
+
def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
- pivot, sizes, fill_empty, flip):
+ pivot, sizes, fill_empty, flip):
'''This function actually creates the wind barbs. u and v are
components of the vector in the x and y directions, respectively.
nflags, nbarbs, and half_barb, empty_flag are, respectively, the number
of flags, number of barbs, flag for half a barb, and flag for empty
- barb, ostensibly obtained from _find_tails. length is the length of
- the barb staff in points. pivot specifies the point on the barb around
- which the entire barb should be rotated. Right now valid options are
+ barb, ostensibly obtained from _find_tails. length is the length of
+ the barb staff in points. pivot specifies the point on the barb around
+ which the entire barb should be rotated. Right now valid options are
'head' and 'middle'. sizes is a dictionary of coefficients specifying
the ratio of a given feature to the length of the barb. These features
include:
-
+
spacing - space between features (flags, full/half barbs)
height - height (distance from shaft of top) of a flag or full barb
width - width of a flag, twice the width of a full barb
- emptybarb - radius of the circle used for low magnitudes
-
+ emptybarb - radius of the circle used for low magnitudes
+
fill_empty specifies whether the circle representing an empty barb
should be filled or not (this changes the drawing of the polygon).
flip is a flag indicating whether the features should be flipped to
the other side of the barb (useful for winds in the southern
hemisphere.
-
- This function returns list of arrays of vertices, defining a polygon for
- each of the wind barbs. These polygons have been rotated to properly
+
+ This function returns list of arrays of vertices, defining a polygon for
+ each of the wind barbs. These polygons have been rotated to properly
align with the vector direction.'''
-
- #These control the spacing and size of barb elements relative to the
- #length of the shaft
- spacing = length * sizes.get('spacing', 0.125)
- full_height = length * sizes.get('height', 0.4)
+
+ #These control the spacing and size of barb elements relative to the
+ #length of the shaft
+ spacing = length * sizes.get('spacing', 0.125)
+ full_height = length * sizes.get('height', 0.4)
full_width = length * sizes.get('width', 0.25)
- empty_rad = length * sizes.get('emptybarb', 0.15)
-
- #Controls y point where to pivot the barb.
- pivot_points = dict(tip=0.0, middle=-length/2.)
+ empty_rad = length * sizes.get('emptybarb', 0.15)
+ #Controls y point where to pivot the barb.
+ pivot_points = dict(tip=0.0, middle=-length/2.)
+
#Check for flip
if flip: full_height = -full_height
-
- endx = 0.0
- endy = pivot_points[pivot.lower()]
-
- #Get the appropriate angle for the vector components. The offset is due
- #to the way the barb is initially drawn, going down the y-axis. This
- #makes sense in a meteorological mode of thinking since there 0 degrees
- #corresponds to north (the y-axis traditionally)
- angles = -(ma.arctan2(v, u) + np.pi/2)
-
+
+ endx = 0.0
+ endy = pivot_points[pivot.lower()]
+
+ #Get the appropriate angle for the vector components. The offset is due
+ #to the way the barb is initially drawn, going down the y-axis. This
+ #makes sense in a meteorological mode of thinking since there 0 degrees
+ #corresponds to north (the y-axis traditionally)
+ angles = -(ma.arctan2(v, u) + np.pi/2)
+
#Used for low magnitude. We just get the vertices, so if we make it
#out here, it can be reused. The center set here should put the
#center of the circle at the location(offset), rather than at the
@@ -784,7 +784,7 @@
else:
#If we don't want the empty one filled, we make a degenerate polygon
#that wraps back over itself
- empty_barb = np.concatenate((circ, circ[::-1]))
+ empty_barb = np.concatenate((circ, circ[::-1]))
barb_list = []
for index, angle in np.ndenumerate(angles):
@@ -795,77 +795,77 @@
#orientation
barb_list.append(empty_barb)
continue
-
- poly_verts = [(endx, endy)]
- offset = length
-
- #Add vertices for each flag
- for i in range(nflags[index]):
+
+ poly_verts = [(endx, endy)]
+ offset = length
+
+ #Add vertices for each flag
+ for i in range(nflags[index]):
#The spacing that works for the barbs is a little to much for
- #the flags, but this only occurs when we have more than 1 flag.
- if offset != length: offset += spacing / 2.
- poly_verts.extend([[endx, endy + offset],
- [endx + full_height, endy - full_width/2 + offset],
- [endx, endy - full_width + offset]])
-
- offset -= full_width + spacing
-
+ #the flags, but this only occurs when we have more than 1 flag.
+ if offset != length: offset += spacing / 2.
+ poly_verts.extend([[endx, endy + offset],
+ [endx + full_height, endy - full_width/2 + offset],
+ [endx, endy - full_width + offset]])
+
+ offset -= full_width + spacing
+
#Add vertices for each barb. These really are lines, but works
#great adding 3 vertices that basically pull the polygon out and
- #back down the line
- for i in range(nbarbs[index]):
- poly_verts.extend([(endx, endy + offset),
- (endx + full_height, endy + offset + full_width/2),
- (endx, endy + offset)])
-
- offset -= spacing
-
- #Add the vertices for half a barb, if needed
- if half_barb[index]:
- #If the half barb is the first on the staff, traditionally it is
- #offset from the end to make it easy to distinguish from a barb
- #with a full one
- if offset == length:
- poly_verts.append((endx, endy + offset))
- offset -= 1.5 * spacing
- poly_verts.extend([(endx, endy + offset),
- (endx + full_height/2, endy + offset + full_width/4),
- (endx, endy + offset)])
-
- #Rotate the barb according the angle. Making the barb first and then
- #rotating it made the math for drawing the barb really easy. Also,
- #the transform framework makes doing the rotation simple.
+ #back down the line
+ for i in range(nbarbs[index]):
+ poly_verts.extend([(endx, endy + offset),
+ (endx + full_height, endy + offset + full_width/2),
+ (endx, endy + offset)])
+
+ offset -= spacing
+
+ #Add the vertices for half a barb, if needed
+ if half_barb[index]:
+ #If the half barb is the first on the staff, traditionally it is
+ #offset from the end to make it easy to distinguish from a barb
+ #with a full one
+ if offset == length:
+ poly_verts.append((endx, endy + offset))
+ offset -= 1.5 * spacing
+ poly_verts.extend([(endx, endy + offset),
+ (endx + full_height/2, endy + offset + full_width/4),
+ (endx, endy + offset)])
+
+ #Rotate the barb according the angle. Making the barb first and then
+ #rotating it made the math for drawing the barb really easy. Also,
+ #the transform framework makes doing the rotation simple.
poly_verts = transforms.Affine2D().rotate(-angle).transform(
- poly_verts)
- barb_list.append(poly_verts)
-
- return barb_list
-
- #Taken shamelessly from Quiver
- def _parse_args(self, *args):
- X, Y, U, V, C = [None]*5
- args = list(args)
- if len(args) == 3 or len(args) == 5:
- C = ma.asarray(args.pop(-1)).ravel()
- V = ma.asarray(args.pop(-1))
+ poly_verts)
+ barb_list.append(poly_verts)
+
+ return barb_list
+
+ #Taken shamelessly from Quiver
+ def _parse_args(self, *args):
+ X, Y, U, V, C = [None]*5
+ args = list(args)
+ if len(args) == 3 or len(args) == 5:
+ C = ma.asarray(args.pop(-1)).ravel()
+ V = ma.asarray(args.pop(-1))
U = ma.asarray(args.pop(-1))
- nn = np.shape(U)
- nc = nn[0]
- nr = 1
- if len(nn) > 1:
- nr = nn[1]
- if len(args) == 2: # remaining after removing U,V,C
- X, Y = [np.array(a).ravel() for a in args]
- if len(X) == nc and len(Y) == nr:
- X, Y = [a.ravel() for a in np.meshgrid(X, Y)]
- else:
- indexgrid = np.meshgrid(np.arange(nc), np.arange(nr))
- X, Y = [np.ravel(a) for a in indexgrid]
- return X, Y, U, V, C
+ nn = np.shape(U)
+ nc = nn[0]
+ nr = 1
+ if len(nn) > 1:
+ nr = nn[1]
+ if len(args) == 2: # remaining after removing U,V,C
+ X, Y = [np.array(a).ravel() for a in args]
+ if len(X) == nc and len(Y) == nr:
+ X, Y = [a.ravel() for a in np.meshgrid(X, Y)]
+ else:
+ indexgrid = np.meshgrid(np.arange(nc), np.arange(nr))
+ X, Y = [np.ravel(a) for a in indexgrid]
+ return X, Y, U, V, C
def set_UVC(self, U, V, C=None):
self.u = ma.asarray(U).ravel()
- self.v = ma.asarray(V).ravel()
+ self.v = ma.asarray(V).ravel()
if C is not None:
c = ma.asarray(C).ravel()
x,y,u,v,c = delete_masked_points(self.x.ravel(), self.y.ravel(),
@@ -874,20 +874,20 @@
x,y,u,v = delete_masked_points(self.x.ravel(), self.y.ravel(),
self.u, self.v)
- magnitude = np.sqrt(u*u + v*v)
+ magnitude = np.sqrt(u*u + v*v)
flags, barbs, halves, empty = self._find_tails(magnitude,
- self.rounding, **self.barb_increments)
-
+ self.rounding, **self.barb_increments)
+
#Get the vertices for each of the barbs
-
+
plot_barbs = self._make_barbs(u, v, flags, barbs, halves, empty,
self._length, self._pivot, self.sizes, self.fill_empty, self.flip)
self.set_verts(plot_barbs)
-
+
#Set the color array
if C is not None:
self.set_array(c)
-
+
#Update the offsets in case the masked data changed
xy = np.hstack((x[:,np.newaxis], y[:,np.newaxis]))
self._offsets = xy
@@ -897,7 +897,7 @@
Set the offsets for the barb polygons. This saves the offets passed in
and actually sets version masked as appropriate for the existing U/V
data. *offsets* should be a sequence.
-
+
ACCEPTS: sequence of pairs of floats
'''
self.x = xy[:,0]
@@ -908,5 +908,4 @@
collections.PolyCollection.set_offsets(self, xy)
set_offsets.__doc__ = collections.PolyCollection.set_offsets.__doc__
- barbs_doc = _barbs_doc
-
+ barbs_doc = _barbs_doc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-07-25 03:41:22
|
Revision: 5863
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5863&view=rev
Author: efiring
Date: 2008-07-25 03:41:21 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
Removed body of unmasked_index_ranges from lines.py.
This should have been part of changeset 5812.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/lines.py
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 02:40:12 UTC (rev 5862)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2008-07-25 03:41:21 UTC (rev 5863)
@@ -17,60 +17,20 @@
from transforms import Affine2D, Bbox, TransformedPath
from matplotlib import rcParams
-
# special-purpose marker identifiers:
(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8)
+
# COVERAGE NOTE: Never called internally or from examples
def unmasked_index_ranges(mask, compressed = True):
- '''
- Calculate the good data ranges in a masked 1-D np.array, based on
- mask.
+ warnings.warn("Import this directly from matplotlib.cbook",
+ DeprecationWarning)
+ # Warning added 2008/07/22
+ from matplotlib.cbook import unmasked_index_ranges as _unmasked_index_ranges
+ return _unmasked_index_ranges(mask, compressed=compressed)
- Returns Nx2 :class:`numpy.array` with each row the start and stop
- indices for slices of the compressed :class:`numpy.array`
- corresponding to each of *N* uninterrupted runs of unmasked
- values. If optional argument *compressed* is *False*, it returns
- the start and stop indices into the original :class:`numpy.array`,
- not the compressed :class:`numpy.array`. Returns *None* if there
- are no unmasked values.
- Example::
-
- y = ma.array(np.arange(5), mask = [0,0,1,0,0])
- #ii = unmasked_index_ranges(y.mask())
- ii = unmasked_index_ranges(ma.getmask(y))
- # returns [[0,2,] [2,4,]]
-
- y.compressed().filled()[ii[1,0]:ii[1,1]]
- # returns np.array [3,4,]
- # (The 'filled()' method converts the masked np.array to a numerix np.array.)
-
- #i0, i1 = unmasked_index_ranges(y.mask(), compressed=False)
- i0, i1 = unmasked_index_ranges(ma.getmask(y), compressed=False)
- # returns [[0,3,] [2,5,]]
-
- y.filled()[ii[1,0]:ii[1,1]]
- # returns np.array [3,4,]
-
- '''
- m = np.concatenate(((1,), mask, (1,)))
- indices = np.arange(len(mask) + 1)
- mdif = m[1:] - m[:-1]
- i0 = np.compress(mdif == -1, indices)
- i1 = np.compress(mdif == 1, indices)
- assert len(i0) == len(i1)
- if len(i1) == 0:
- return None
- if not compressed:
- return np.concatenate((i0[:, np.newaxis], i1[:, np.newaxis]), axis=1)
- seglengths = i1 - i0
- breakpoints = np.cumsum(seglengths)
- ic0 = np.concatenate(((0,), breakpoints[:-1]))
- ic1 = breakpoints
- return np.concatenate((ic0[:, np.newaxis], ic1[:, np.newaxis]), axis=1)
-
def segment_hits(cx,cy,x,y,radius):
"""Determine if any line segments are within radius of a point. Returns
the list of line segments that are within that radius.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-07-25 02:40:14
|
Revision: 5862
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5862&view=rev
Author: jswhit
Date: 2008-07-25 02:40:12 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
flip wind barbs for points in SH according to meterological convention.
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-25 01:43:43 UTC (rev 5861)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-07-25 02:40:12 UTC (rev 5862)
@@ -2914,8 +2914,15 @@
h = kwargs.pop('hold',None)
if h is not None:
ax.hold(h)
+ lons, lats = self(x, y, inverse=True)
+ unh = ma.masked_where(lats <= 0, u)
+ vnh = ma.masked_where(lats <= 0, v)
+ ush = ma.masked_where(lats > 0, u)
+ vsh = ma.masked_where(lats > 0, v)
try:
- ret = ax.barbs(x,y,u,v,*args,**kwargs)
+ retnh = ax.barbs(x,y,unh,vnh,*args,**kwargs)
+ kwargs['flip_barb']=True
+ retsh = ax.barbs(x,y,ush,vsh,*args,**kwargs)
try:
plt.draw_if_interactive()
except:
@@ -2926,7 +2933,7 @@
ax.hold(b)
# set axes limits to fit map region.
self.set_axes_limits(ax=ax)
- return ret
+ return retnh,retsh
def drawlsmask(self,rgba_land,rgba_ocean,lsmask=None,
lsmask_lons=None,lsmask_lats=None,lakes=False,**kwargs):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|