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: <js...@us...> - 2008-06-16 16:42:02
|
Revision: 5561
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5561&view=rev
Author: jswhit
Date: 2008-06-16 09:40:09 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
new file
Added Paths:
-----------
trunk/toolkits/basemap/doc/users/figures/make.py
Added: trunk/toolkits/basemap/doc/users/figures/make.py
===================================================================
--- trunk/toolkits/basemap/doc/users/figures/make.py (rev 0)
+++ trunk/toolkits/basemap/doc/users/figures/make.py 2008-06-16 16:40:09 UTC (rev 5561)
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+import sys, os, glob
+import matplotlib
+import IPython.Shell
+#matplotlib.rcdefaults()
+matplotlib.use('Agg')
+
+mplshell = IPython.Shell.MatplotlibShell('mpl')
+
+formats = [('png', 100),
+ ('hires.png', 200),
+ ('pdf', 72)]
+
+def figs():
+ print 'making figs'
+ import matplotlib.pyplot as plt
+ for fname in glob.glob('*.py'):
+ if fname.split('/')[-1] == __file__.split('/')[-1]: continue
+ basename, ext = os.path.splitext(fname)
+ imagefiles = dict([('%s.%s'%(basename, format), dpi)
+ for format, dpi in formats])
+ all_exists = True
+ for imagefile in imagefiles:
+ if not os.path.exists(imagefile):
+ all_exists = False
+ break
+
+ if all_exists:
+ print ' already have %s'%fname
+ else:
+ print ' building %s'%fname
+ plt.close('all') # we need to clear between runs
+ mplshell.magic_run(basename)
+ for imagefile, dpi in imagefiles.iteritems():
+ plt.savefig(imagefile, dpi=dpi)
+ print 'all figures made'
+
+
+def clean():
+ patterns = (['#*', '*~', '*pyc'] +
+ ['*.%s' % format for format, dpi in formats])
+ for pattern in patterns:
+ for fname in glob.glob(pattern):
+ os.remove(fname)
+ print 'all clean'
+
+
+
+def all():
+ figs()
+
+funcd = {'figs':figs,
+ 'clean':clean,
+ 'all':all,
+ }
+
+if len(sys.argv)>1:
+ for arg in sys.argv[1:]:
+ func = funcd.get(arg)
+ if func is None:
+ raise SystemExit('Do not know how to handle %s; valid args are'%(
+ arg, funcd.keys()))
+ func()
+else:
+ all()
+
+
+
+
Property changes on: trunk/toolkits/basemap/doc/users/figures/make.py
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-16 15:14:39
|
Revision: 5560
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5560&view=rev
Author: jswhit
Date: 2008-06-16 08:13:58 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
fixed gnomonic coastlines.
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-06-16 14:41:48 UTC (rev 5559)
+++ trunk/toolkits/basemap/Changelog 2008-06-16 15:13:58 UTC (rev 5560)
@@ -1,3 +1,4 @@
+ * fixed processing of coastlines for gnomonic projection.
* don't try to use PyNIO in NetCDFFile (it was causing
too many suprises).
* improved documentation using Sphinx/docutils.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-16 14:42:05
|
Revision: 5559
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5559&view=rev
Author: jswhit
Date: 2008-06-16 07:41:48 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
add gnomonic projection example
Modified Paths:
--------------
trunk/toolkits/basemap/doc/users/mapsetup.rst
Added Paths:
-----------
trunk/toolkits/basemap/doc/users/figures/gnomon.png
trunk/toolkits/basemap/doc/users/figures/gnomon.py
trunk/toolkits/basemap/doc/users/gnomon.rst
Added: trunk/toolkits/basemap/doc/users/figures/gnomon.png
===================================================================
(Binary files differ)
Property changes on: trunk/toolkits/basemap/doc/users/figures/gnomon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/toolkits/basemap/doc/users/figures/gnomon.py
===================================================================
--- trunk/toolkits/basemap/doc/users/figures/gnomon.py (rev 0)
+++ trunk/toolkits/basemap/doc/users/figures/gnomon.py 2008-06-16 14:41:48 UTC (rev 5559)
@@ -0,0 +1,12 @@
+from mpl_toolkits.basemap import Basemap
+import numpy as np
+import matplotlib.pyplot as plt
+m = Basemap(width=15.e6,height=15.e6,\
+ projection='gnom',lat_0=60.,lon_0=-30.)
+m.drawmapboundary(fill_color='aqua')
+m.drawcoastlines()
+m.fillcontinents(color='coral',lake_color='aqua')
+m.drawparallels(np.arange(10,90,20))
+m.drawmeridians(np.arange(-180,180,30))
+plt.title('Gnomonic Projection')
+plt.savefig('gnomon.png')
Added: trunk/toolkits/basemap/doc/users/gnomon.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/gnomon.rst (rev 0)
+++ trunk/toolkits/basemap/doc/users/gnomon.rst 2008-06-16 14:41:48 UTC (rev 5559)
@@ -0,0 +1,10 @@
+.. _gnomon:
+
+Gnomonic Projection
+===================
+
+In the gnomonic projection, great circles are straight lines.
+
+.. literalinclude:: figures/gnomon.py
+
+.. image:: figures/gnomon.png
Modified: trunk/toolkits/basemap/doc/users/mapsetup.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/mapsetup.rst 2008-06-16 13:51:31 UTC (rev 5558)
+++ trunk/toolkits/basemap/doc/users/mapsetup.rst 2008-06-16 14:41:48 UTC (rev 5559)
@@ -29,4 +29,5 @@
.. toctree::
azeqd.rst
+ gnomon.rst
ortho.rst
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-16 13:53:24
|
Revision: 5558
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5558&view=rev
Author: jswhit
Date: 2008-06-16 06:51:31 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
update comment on ortho/gnom boundary treatment
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-06-16 13:41:14 UTC (rev 5557)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-16 13:51:31 UTC (rev 5558)
@@ -831,7 +831,9 @@
raise ValueError('%s projection cannot cross pole'%(self.projection))
# make sure orthographic or gnomonic projection has containsPole=True
# we will compute the intersections in stereographic
- # coordinates, then transform to orthographic.
+ # coordinates, then transform to orthographic. This is
+ # because these projections are only defined on a hemisphere, and
+ # some boundary features (like Eurasia) would be undefined otherwise.
if self.projection in ['ortho','gnom'] and name == 'gshhs':
containsPole = True
lon_0=self.projparams['lon_0']
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-16 13:41:26
|
Revision: 5557
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5557&view=rev
Author: mdboom
Date: 2008-06-16 06:41:14 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
Minor mathtext improvements
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2008-06-16 13:04:07 UTC (rev 5556)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2008-06-16 13:41:14 UTC (rev 5557)
@@ -725,15 +725,8 @@
cached_font.charmap[num])
if symbol_name is None:
- return self._stix_fallback._get_glyph(fontname, font_class, sym, fontsize)
- warn("Unrecognized symbol '%s'. Substituting with a dummy symbol."
- % sym.encode('ascii', 'backslashreplace'), MathTextWarning)
- fontname = 'it'
- cached_font = self._get_font(fontname)
- num = 0x3F # currency character, for lack of anything better
- gid = cached_font.charmap[num]
- symbol_name = cached_font.font.get_glyph_name(gid)
- slanted = False
+ return self._stix_fallback._get_glyph(
+ fontname, font_class, sym, fontsize)
return cached_font, num, symbol_name, fontsize, slanted
@@ -865,10 +858,7 @@
glyphindex = cached_font.charmap[uniindex]
found_symbol = True
except KeyError:
- warn("Font '%s' does not have a glyph for '%s'" %
- (cached_font.font.postscript_name,
- sym.encode('ascii', 'backslashreplace')),
- MathTextWarning)
+ pass
if not found_symbol:
if self.cm_fallback:
@@ -879,6 +869,10 @@
else:
if fontname == 'it' and isinstance(self, StixFonts):
return self._get_glyph('rm', font_class, sym, fontsize)
+ warn("Font '%s' does not have a glyph for '%s'" %
+ (cached_font.font.postscript_name,
+ sym.encode('ascii', 'backslashreplace')),
+ MathTextWarning)
warn("Substituting with a dummy symbol.", MathTextWarning)
fontname = 'rm'
new_fontname = fontname
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-16 13:04:36
|
Revision: 5556
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5556&view=rev
Author: mdboom
Date: 2008-06-16 06:04:07 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
Fix title placement in polar plots. Remove broken auto layout code.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/config/mplconfig.py
trunk/matplotlib/lib/matplotlib/config/rcsetup.py
trunk/matplotlib/lib/matplotlib/figure.py
trunk/matplotlib/lib/matplotlib/projections/geo.py
trunk/matplotlib/lib/matplotlib/projections/polar.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -1403,32 +1403,6 @@
YL = self.yaxis.get_major_locator().autoscale()
self.set_ybound(YL)
- def update_layout(self, renderer):
- pad_pixels = rcParams['xtick.major.pad'] * self.figure.dpi / 72.0
- inverse_transFigure = self.figure.transFigure.inverted()
- t_text, b_text = self.xaxis.get_text_heights(renderer)
- l_text, r_text = self.yaxis.get_text_widths(renderer)
- title_height = self.title.get_window_extent(renderer).height
- title_height += pad_pixels * 2.0
- original_t_text = t_text
-
- ((l_text, t_text),
- (r_text, b_text),
- (dummy, title_height)) = inverse_transFigure.transform(
- ((l_text, t_text),
- (r_text, b_text),
- (0.0, title_height)))
- x0, y0, x1, y1 = self.get_position(True).extents
- # Adjust the title
- self.titleOffsetTrans.clear().translate(
- 0, original_t_text + pad_pixels * 2.0)
-
- new_position = mtransforms.Bbox.from_extents(
- x0 + l_text, y0 + b_text,
- x1 - r_text, y1 - t_text - title_height)
-
- self.set_position(new_position, 'active')
-
#### Drawing
def draw(self, renderer=None, inframe=False):
@@ -5654,7 +5628,7 @@
ax2.xaxis.set_label_position('top')
self.xaxis.tick_bottom()
return ax2
-
+
def get_shared_x_axes(self):
'Return a copy of the shared axes Grouper object for x axes'
return self._shared_x_axes
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -238,7 +238,6 @@
dpi = T.Float(80)
facecolor = T.Trait('0.75', mplT.ColorHandler())
edgecolor = T.Trait('white', mplT.ColorHandler())
- autolayout = T.false
class subplot(TConfig):
"""The figure subplot parameters. All dimensions are fraction
@@ -408,7 +407,6 @@
'figure.dpi' : (self.tconfig.figure, 'dpi'),
'figure.facecolor' : (self.tconfig.figure, 'facecolor'),
'figure.edgecolor' : (self.tconfig.figure, 'edgecolor'),
- 'figure.autolayout' : (self.tconfig.figure, 'autolayout'),
'figure.subplot.left' : (self.tconfig.figure.subplot, 'left'),
'figure.subplot.right' : (self.tconfig.figure.subplot, 'right'),
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -439,7 +439,6 @@
'figure.dpi' : [80, validate_float], # DPI
'figure.facecolor' : ['0.75', validate_color], # facecolor; scalar gray
'figure.edgecolor' : ['w', validate_color], # edgecolor; white
- 'figure.autolayout' : [False, validate_bool],
'figure.subplot.left' : [0.125, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
'figure.subplot.right' : [0.9, ValidateInterval(0, 1, closedmin=False, closedmax=False)],
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -240,7 +240,6 @@
self.clf()
self._cachedRenderer = None
- self._autoLayout = rcParams['figure.autolayout']
def _get_dpi(self):
return self._dpi
@@ -250,9 +249,6 @@
self.callbacks.process('dpi_changed', self)
dpi = property(_get_dpi, _set_dpi)
- def enable_auto_layout(self, setting=True):
- self._autoLayout = setting
-
def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
"""
Date ticklabels often overlap, so it is useful to rotate them
@@ -284,7 +280,7 @@
label.set_visible(False)
ax.set_xlabel('')
- if allsubplots and not self._autoLayout:
+ if allsubplots:
self.subplots_adjust(bottom=bottom)
def get_children(self):
@@ -765,62 +761,6 @@
renderer.draw_image(l, b, im, self.bbox,
*self.get_transformed_clip_path_and_affine())
- # update the positions of the axes
- # This gives each of the axes the opportunity to resize itself
- # based on the tick and axis labels etc., and then makes sure
- # that any axes that began life aligned to another axes remains
- # aligned after these adjustments
- if self._autoLayout and len(self.axes) > 1:
- aligned_positions = [{}, {}, {}, {}]
- sizes = [{}, {}]
- for a in self.axes:
- a.update_layout(renderer)
- orig_pos = a.get_position(True)
- curr_pos = a.get_position()
- for pos, orig, curr in zip(aligned_positions,
- orig_pos.get_points().flatten(),
- curr_pos.get_points().flatten()):
- if orig in pos:
- pos[orig][0].append(a)
- pos[orig][1].add(curr)
- else:
- pos[orig] = [[a], set([curr])]
- for size, orig, curr in zip(sizes,
- orig_pos.size,
- curr_pos.size):
- orig = round(orig * 1000.0) / 1000.0
- if orig in size:
- size[orig][0].append(a)
- size[orig][1].add(curr)
- else:
- size[orig] = [[a], set([curr])]
-
- for i, pos in enumerate(aligned_positions):
- for axes, places in pos.values():
- if len(places) > 1:
- if i < 2:
- curr = max(places)
- else:
- curr = min(places)
- for a in axes:
- curr_pos = a.get_position().frozen()
- curr_pos.get_points()[i/2, i%2] = curr
- a.set_position(curr_pos, 'active')
-
- for i, size in enumerate(sizes):
- for axes, dims in size.values():
- new = min(dims)
- for a in axes:
- curr_pos = a.get_position().frozen()
- curr = curr_pos.size[i]
- if curr > new:
- extra = (curr - new) * 0.5
- curr_pos.get_points()[0, i] += extra
- curr_pos.get_points()[1, i] -= extra
- a.set_position(curr_pos, 'active')
- elif self._autoLayout:
- for a in self.axes: a.update_layout(renderer)
-
# render the axes
for a in self.axes: a.draw(renderer)
Modified: trunk/matplotlib/lib/matplotlib/projections/geo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/geo.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/projections/geo.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -109,14 +109,6 @@
.scale(0.5 / xscale, 0.5 / yscale) \
.translate(0.5, 0.5)
- def update_layout(self, renderer):
- t_text, b_text = self.xaxis.get_text_heights(renderer)
- l_text, r_text = self.yaxis.get_text_widths(renderer)
- originalPosition = self.get_position(True)
- title_offset = (b_text - originalPosition.transformed(
- self.figure.transFigure).height) / 2.0
- self.titleOffsetTrans.clear().translate(0, title_offset)
-
def get_xaxis_transform(self):
return self._xaxis_transform
Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/polar.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -176,6 +176,8 @@
def cla(self):
Axes.cla(self)
+ self.title.set_y(1.05)
+
self.xaxis.set_major_formatter(self.ThetaFormatter())
angles = npy.arange(0.0, 360.0, 45.0)
self.set_thetagrids(angles)
@@ -241,14 +243,6 @@
self._yaxis_transform
)
- def update_layout(self, renderer):
- t_text, b_text = self.xaxis.get_text_heights(renderer)
- l_text, r_text = self.yaxis.get_text_widths(renderer)
- originalPosition = self.get_position(True)
- title_offset = (b_text - originalPosition.transformed(
- self.figure.transFigure).height) / 2.0
- self.titleOffsetTrans.clear().translate(0, title_offset)
-
def get_xaxis_transform(self):
return self._xaxis_transform
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2008-06-16 13:04:07 UTC (rev 5556)
@@ -457,8 +457,6 @@
'figure.subplot.wspace' : [0.2, ValidateInterval(0, 1, closedmin=True, closedmax=False)],
'figure.subplot.hspace' : [0.2, ValidateInterval(0, 1, closedmin=True, closedmax=False)],
- 'figure.autolayout' : [False, validate_bool],
-
'savefig.dpi' : [100, validate_float], # DPI
'savefig.facecolor' : ['w', validate_color], # facecolor; white
'savefig.edgecolor' : ['w', validate_color], # edgecolor; white
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template 2008-06-16 12:51:33 UTC (rev 5555)
+++ trunk/matplotlib/matplotlibrc.template 2008-06-16 13:04:07 UTC (rev 5556)
@@ -249,8 +249,6 @@
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
-#figure.autolayout : False # when True, adjust the axes so that text doesn't overlap
-
### IMAGES
#image.aspect : equal # equal | auto | a number
#image.interpolation : bilinear # see help(imshow) for options
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-16 12:51:38
|
Revision: 5555
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5555&view=rev
Author: jswhit
Date: 2008-06-16 05:51:33 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
treat gnomonic like orthographic when deciding if boundary polygons
are intersect map region.
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-06-16 12:14:22 UTC (rev 5554)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-16 12:51:33 UTC (rev 5555)
@@ -531,6 +531,8 @@
if width is not None or height is not None:
print 'warning: width and height keywords ignored for %s projection' % self.projection
elif projection in ['tmerc','gnom','cass','poly'] :
+ if projection == 'gnom' and not projparams.has_key('R'):
+ raise ValueError, 'gnomonic projection only works for perfect spheres - not ellipsoids'
if lat_0 is None or lon_0 is None:
raise ValueError, 'must specify lat_0 and lon_0 for Transverse Mercator, Gnomonic, Cassini-Soldnerr Polyconic basemap'
if not using_corners:
@@ -827,10 +829,10 @@
self.projection in ['merc','mill','cyl','robin','moll','sinu','geos']:
#self.projection in ['tmerc','omerc','cass','merc','mill','cyl','robin','moll','sinu','geos']:
raise ValueError('%s projection cannot cross pole'%(self.projection))
- # make sure orthographic projection has containsPole=True
+ # make sure orthographic or gnomonic projection has containsPole=True
# we will compute the intersections in stereographic
# coordinates, then transform to orthographic.
- if self.projection == 'ortho' and name == 'gshhs':
+ if self.projection in ['ortho','gnom'] and name == 'gshhs':
containsPole = True
lon_0=self.projparams['lon_0']
lat_0=self.projparams['lat_0']
@@ -841,7 +843,7 @@
lat0 = 90.*(np.around(lat_0/90.))
if np.abs(int(lat0)) == 90: lon0=0.
maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat_0=lat0,R=re)
- # boundary polygon for orthographic projection
+ # boundary polygon for ortho/gnom projection
# in stereographic coorindates.
b = self._boundarypolyll.boundary
blons = b[:,0]; blats = b[:,1]
@@ -939,9 +941,9 @@
else:
# transform coordinates from lat/lon
# to map projection coordinates.
- # special case for ortho, compute coastline polygon
+ # special case for ortho/gnom, compute coastline polygon
# vertices in stereographic coords.
- if name == 'gshhs' and self.projection == 'ortho':
+ if name == 'gshhs' and self.projection in ['ortho','gnom']:
b[:,0], b[:,1] = maptran(b[:,0], b[:,1])
else:
b[:,0], b[:,1] = self(b[:,0], b[:,1])
@@ -955,10 +957,10 @@
# in this map projection.
bx = np.compress(goodmask, b[:,0])
by = np.compress(goodmask, b[:,1])
- # for orthographic projection, all points
+ # for ortho/gnom projection, all points
# outside map projection region are eliminated
# with the above step, so we're done.
- if self.projection == 'ortho':
+ if self.projection in ['ortho','gnom']:
polygons.append(zip(bx,by))
polygon_types.append(type)
continue
@@ -976,21 +978,22 @@
# iterate over geometries in intersection.
for psub in geoms:
b = psub.boundary
- # if projection == 'ortho',
+ # if projection in ['ortho','gnom'],
# transform polygon from stereographic
- # to orthographic coordinates.
- if self.projection == 'ortho':
+ # to ortho/gnom coordinates.
+ if self.projection in ['ortho','gnom']:
# if coastline polygon covers more than 99%
# of map region for fulldisk projection,
# it's probably bogus, so skip it.
areafrac = psub.area()/boundarypolyxy.area()
- if name == 'gshhs' and\
- self._fulldisk and\
- areafrac > 0.99: continue
+ if self.projection == 'ortho':
+ if name == 'gshhs' and\
+ self._fulldisk and\
+ areafrac > 0.99: continue
# inverse transform from stereographic
# to lat/lon.
b[:,0], b[:,1] = maptran(b[:,0], b[:,1], inverse=True)
- # orthographic.
+ # orthographic/gnomonic.
b[:,0], b[:,1]= self(b[:,0], b[:,1])
polygons.append(zip(b[:,0],b[:,1]))
polygon_types.append(type)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-06-16 12:14:52
|
Revision: 5554
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5554&view=rev
Author: mdboom
Date: 2008-06-16 05:14:22 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
Fix bug specifying alpha in a color array. (Thanks, M?\195?\161ty?\195?\161s J?\195?\161nos)
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-06-16 12:04:29 UTC (rev 5553)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-06-16 12:14:22 UTC (rev 5554)
@@ -291,11 +291,15 @@
"""
try:
if not cbook.is_string_like(arg) and cbook.iterable(arg):
- if len(arg) == 4 and alpha is None:
+ if len(arg) == 4:
if [x for x in arg if (float(x) < 0) or (x > 1)]:
# This will raise TypeError if x is not a number.
raise ValueError('number in rbga sequence outside 0-1 range')
- return tuple(arg)
+ if alpha is None:
+ return tuple(arg)
+ if alpha < 0.0 or alpha > 1.0:
+ raise ValueError("alpha must be in range 0-1")
+ return arg[0], arg[1], arg[2], arg[3] * alpha
r,g,b = arg[:3]
if [x for x in (r,g,b) if (float(x) < 0) or (x > 1)]:
raise ValueError('number in rbg sequence outside 0-1 range')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-16 12:04:36
|
Revision: 5553
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5553&view=rev
Author: jswhit
Date: 2008-06-16 05:04:29 -0700 (Mon, 16 Jun 2008)
Log Message:
-----------
added azimuth equidistant example
Modified Paths:
--------------
trunk/toolkits/basemap/doc/users/mapsetup.rst
Added Paths:
-----------
trunk/toolkits/basemap/doc/users/azeqd.rst
trunk/toolkits/basemap/doc/users/figures/azeqd.png
trunk/toolkits/basemap/doc/users/figures/azeqd.py
Added: trunk/toolkits/basemap/doc/users/azeqd.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/azeqd.rst (rev 0)
+++ trunk/toolkits/basemap/doc/users/azeqd.rst 2008-06-16 12:04:29 UTC (rev 5553)
@@ -0,0 +1,17 @@
+.. _azeqd:
+
+Azimuthal Equidistant Projection
+================================
+
+The shortest route from the center of the map
+to any other point is a straight line in the azimuthal
+equidistant projection. Such lines show the true scale
+on the earth's surface.
+So, for the specified point, this script draws a map that shows
+in which direction to depart for other points on earth and how far
+it will be to reach that destination.
+The specified point ``lon_0, lat_0`` shows up as a black dot in the center of the map.
+
+.. literalinclude:: figures/azeqd.py
+
+.. image:: figures/azeqd.png
Added: trunk/toolkits/basemap/doc/users/figures/azeqd.png
===================================================================
(Binary files differ)
Property changes on: trunk/toolkits/basemap/doc/users/figures/azeqd.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/toolkits/basemap/doc/users/figures/azeqd.py
===================================================================
--- trunk/toolkits/basemap/doc/users/figures/azeqd.py (rev 0)
+++ trunk/toolkits/basemap/doc/users/figures/azeqd.py 2008-06-16 12:04:29 UTC (rev 5553)
@@ -0,0 +1,20 @@
+from mpl_toolkits.basemap import Basemap
+import numpy as np
+import matplotlib.pyplot as plt
+width = 28000000; lon_0 = -105; lat_0 = 40
+m = Basemap(width=width,height=width,projection='aeqd',
+ lat_0=lat_0,lon_0=lon_0)
+# fill background.
+m.drawmapboundary(fill_color='aqua')
+# draw coasts and fill continents.
+m.drawcoastlines(linewidth=0.5)
+m.fillcontinents(color='coral',lake_color='aqua')
+# 20 degree graticule.
+m.drawparallels(np.arange(-80,81,20))
+m.drawmeridians(np.arange(-180,180,20))
+# draw a black dot at the center.
+xpt, ypt = m(lon_0, lat_0)
+m.plot([xpt],[ypt],'ko')
+# draw the title.
+plt.title('Azimuthal Equidistant Projection')
+plt.savefig('azeqd.png')
Modified: trunk/toolkits/basemap/doc/users/mapsetup.rst
===================================================================
--- trunk/toolkits/basemap/doc/users/mapsetup.rst 2008-06-16 00:27:35 UTC (rev 5552)
+++ trunk/toolkits/basemap/doc/users/mapsetup.rst 2008-06-16 12:04:29 UTC (rev 5553)
@@ -28,4 +28,5 @@
.. toctree::
+ azeqd.rst
ortho.rst
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-16 00:27:37
|
Revision: 5552
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5552&view=rev
Author: dsdale
Date: 2008-06-15 17:27:35 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
added colorbar api reference
Modified Paths:
--------------
trunk/matplotlib/doc/api/index.rst
trunk/matplotlib/lib/matplotlib/colorbar.py
Added Paths:
-----------
trunk/matplotlib/doc/api/axis_api.rst
trunk/matplotlib/doc/api/cbook_api.rst
trunk/matplotlib/doc/api/cm_api.rst
trunk/matplotlib/doc/api/collections_api.rst
trunk/matplotlib/doc/api/colorbar_api.rst
Added: trunk/matplotlib/doc/api/axis_api.rst
===================================================================
--- trunk/matplotlib/doc/api/axis_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/axis_api.rst 2008-06-16 00:27:35 UTC (rev 5552)
@@ -0,0 +1,11 @@
+***************
+matplotlib axis
+***************
+
+
+:mod:`matplotlib.axis`
+======================
+
+.. automodule:: matplotlib.axis
+ :members:
+ :undoc-members:
Added: trunk/matplotlib/doc/api/cbook_api.rst
===================================================================
--- trunk/matplotlib/doc/api/cbook_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/cbook_api.rst 2008-06-16 00:27:35 UTC (rev 5552)
@@ -0,0 +1,11 @@
+****************
+matplotlib cbook
+****************
+
+
+:mod:`matplotlib.cbook`
+=======================
+
+.. automodule:: matplotlib.cbook
+ :members:
+ :undoc-members:
Added: trunk/matplotlib/doc/api/cm_api.rst
===================================================================
--- trunk/matplotlib/doc/api/cm_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/cm_api.rst 2008-06-16 00:27:35 UTC (rev 5552)
@@ -0,0 +1,11 @@
+*************
+matplotlib cm
+*************
+
+
+:mod:`matplotlib.cm`
+====================
+
+.. automodule:: matplotlib.cm
+ :members:
+ :undoc-members:
Added: trunk/matplotlib/doc/api/collections_api.rst
===================================================================
--- trunk/matplotlib/doc/api/collections_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/collections_api.rst 2008-06-16 00:27:35 UTC (rev 5552)
@@ -0,0 +1,11 @@
+**********************
+matplotlib collections
+**********************
+
+
+:mod:`matplotlib.collections`
+=============================
+
+.. automodule:: matplotlib.collections
+ :members:
+ :undoc-members:
Added: trunk/matplotlib/doc/api/colorbar_api.rst
===================================================================
--- trunk/matplotlib/doc/api/colorbar_api.rst (rev 0)
+++ trunk/matplotlib/doc/api/colorbar_api.rst 2008-06-16 00:27:35 UTC (rev 5552)
@@ -0,0 +1,11 @@
+*******************
+matplotlib colorbar
+*******************
+
+
+:mod:`matplotlib.colorbar`
+==========================
+
+.. automodule:: matplotlib.colorbar
+ :members:
+ :undoc-members:
Modified: trunk/matplotlib/doc/api/index.rst
===================================================================
--- trunk/matplotlib/doc/api/index.rst 2008-06-15 23:53:06 UTC (rev 5551)
+++ trunk/matplotlib/doc/api/index.rst 2008-06-16 00:27:35 UTC (rev 5552)
@@ -18,5 +18,6 @@
cbook_api.rst
cm_api.rst
collections_api.rst
+ colorbar_api.rst
pyplot_api.rst
index_backend_api.rst
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2008-06-15 23:53:06 UTC (rev 5551)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2008-06-16 00:27:35 UTC (rev 5552)
@@ -1,17 +1,21 @@
'''
Colorbar toolkit with two classes and a function:
- ColorbarBase is the base class with full colorbar drawing functionality.
+ :class:`ColorbarBase`
+ the base class with full colorbar drawing functionality.
It can be used as-is to make a colorbar for a given colormap;
a mappable object (e.g., image) is not needed.
- Colorbar is the derived class for use with images or contour plots.
+ :class:`Colorbar`
+ the derived class for use with images or contour plots.
- make_axes is a function for resizing an axes and adding a second axes
+ :func:`make_axes`
+ a function for resizing an axes and adding a second axes
suitable for a colorbar
-The Figure.colorbar() method uses make_axes and Colorbar; the pylab.colorbar()
-function is a thin wrapper over Figure.colorbar().
+The :meth:`matplotlib.Figure.colorbar` method uses :func:`make_axes`
+and :class:`Colorbar`; the :func:`matplotlib.pyplot.colorbar` function
+is a thin wrapper over :meth:`matplotlib.Figure.colorbar`.
'''
@@ -28,60 +32,68 @@
make_axes_kw_doc = '''
- ======== ====================================================
- Property Description
- ======== ====================================================
- fraction 0.15; fraction of original axes to use for colorbar
- pad 0.05 if vertical, 0.15 if horizontal; fraction
- of original axes between colorbar and new image axes
- shrink 1.0; fraction by which to shrink the colorbar
- aspect 20; ratio of long to short dimensions
- ======== ====================================================
+ ========== ====================================================
+ Property Description
+ ========== ====================================================
+ *fraction* 0.15; fraction of original axes to use for colorbar
+ *pad* 0.05 if vertical, 0.15 if horizontal; fraction
+ of original axes between colorbar and new image axes
+ *shrink* 1.0; fraction by which to shrink the colorbar
+ *aspect* 20; ratio of long to short dimensions
+ ========== ====================================================
'''
colormap_kw_doc = '''
- ========= ===============================================================
- Property Description
- ========= ===============================================================
- extend [ 'neither' | 'both' | 'min' | 'max' ]
- If not 'neither', make pointed end(s) for out-of-range
- values. These are set for a given colormap using the
- colormap set_under and set_over methods.
- spacing [ 'uniform' | 'proportional' ]
- Uniform spacing gives each discrete color the same space;
- proportional makes the space proportional to the data interval.
- ticks [ None | list of ticks | Locator object ]
- If None, ticks are determined automatically from the input.
- format [ None | format string | Formatter object ]
- If none, the ScalarFormatter is used.
- If a format string is given, e.g. '%.3f', that is used.
- An alternative Formatter object may be given instead.
- drawedges [ False | True ] If true, draw lines at color boundaries.
- ========= ===============================================================
+ =========== ====================================================
+ Property Description
+ =========== ====================================================
+ *extend* [ 'neither' | 'both' | 'min' | 'max' ]
+ If not 'neither', make pointed end(s) for out-of-
+ range values. These are set for a given colormap
+ using the colormap set_under and set_over methods.
+ *spacing* [ 'uniform' | 'proportional' ]
+ Uniform spacing gives each discrete color the same
+ space; proportional makes the space proportional to
+ the data interval.
+ *ticks* [ None | list of ticks | Locator object ]
+ If None, ticks are determined automatically from the
+ input.
+ *format* [ None | format string | Formatter object ]
+ If None, the
+ :class:`~matplotlib.ticker.ScalarFormatter` is used.
+ If a format string is given, e.g. '%.3f', that is
+ used. An alternative
+ :class:`~matplotlib.ticker.Formatter` object may be
+ given instead.
+ *drawedges* [ False | True ] If true, draw lines at color
+ boundaries.
+ =========== ====================================================
The following will probably be useful only in the context of
indexed colors (that is, when the mappable has norm=NoNorm()),
or other unusual circumstances.
- ========== ===============================================================
- Property Description
- ========== ===============================================================
- boundaries None or a sequence
- values None or a sequence which must be of length 1 less than the
- sequence of boundaries. For each region delimited by adjacent
- entries in boundaries, the color mapped to the corresponding
- value in values will be used.
- ========== ===============================================================
+ ============ ===================================================
+ Property Description
+ ============ ===================================================
+ *boundaries* None or a sequence
+ *values* None or a sequence which must be of length 1 less
+ than the sequence of *boundaries*. For each region
+ delimited by adjacent entries in *boundaries*, the
+ color mapped to the corresponding value in values
+ will be used.
+ ============ ===================================================
'''
colorbar_doc = '''
Add a colorbar to a plot.
-Function signatures for the pyplot interface; all but the first are
-also method signatures for the Figure.colorbar method::
+Function signatures for the :mod:`~matplotlib.pyplot` interface; all
+but the first are also method signatures for the
+:meth:`matplotlib.Figure.colorbar` method::
colorbar(**kwargs)
colorbar(mappable, **kwargs)
@@ -89,16 +101,17 @@
colorbar(mappable, ax=ax, **kwargs)
arguments:
- mappable:
- the image, ContourSet, etc. to which the colorbar applies;
- this argument is mandatory for the Figure.colorbar
- method but optional for the pyplot.colorbar function,
- which sets the default to the current image.
+ *mappable*
+ the image, :class:`~matplotlib.contours.ContourSet`, etc. to
+ which the colorbar applies; this argument is mandatory for the
+ :meth:`matplotlib.Figure.colorbar` method but optional for the
+ :func:`matplotlib.pyplot.colorbar` function, which sets the
+ default to the current image.
keyword arguments:
- cax:
+ *cax*
None | axes object into which the colorbar will be drawn
- ax:
+ *ax*
None | parent axes object from which space for a new
colorbar axes will be stolen
@@ -109,19 +122,18 @@
colorbar properties:
%s
-If mappable is a ContourSet, its extend kwarg is included automatically.
+If mappable is a :class:`~matplotlib.contours.ContourSet`, its *extend*
+kwarg is included automatically.
-Note that the shrink kwarg provides a simple way to keep
-a vertical colorbar, for example, from being taller than
-the axes of the mappable to which the colorbar is attached;
-but it is a manual method requiring some trial and error.
-If the colorbar is too tall (or a horizontal colorbar is
-too wide) use a smaller value of shrink.
+Note that the *shrink* kwarg provides a simple way to keep a vertical
+colorbar, for example, from being taller than the axes of the mappable
+to which the colorbar is attached; but it is a manual method requiring
+some trial and error. If the colorbar is too tall (or a horizontal
+colorbar is too wide) use a smaller value of *shrink*.
-For more precise control, you can manually specify the
-positions of the axes objects in which the mappable and
-the colorbar are drawn. In this case, do not use any of the
-axes properties kwargs.
+For more precise control, you can manually specify the positions of
+the axes objects in which the mappable and the colorbar are drawn. In
+this case, do not use any of the axes properties kwargs.
''' % (make_axes_kw_doc, colormap_kw_doc)
@@ -130,16 +142,22 @@
'''
Draw a colorbar in an existing axes.
- This is a base class for the Colorbar class, which is
- the basis for the colorbar method and pylab function.
+ This is a base class for the :class:`Colorbar` class, which is the
+ basis for the :func:`~matplotlib.pyplot.colorbar` method and pylab
+ function.
- It is also useful by itself for showing a colormap. If
- the cmap kwarg is given but boundaries and values are left
- as None, then the colormap will be displayed on a 0-1 scale.
- To show the under- and over-value colors, specify the norm
- as colors.Normalize(clip=False).
+ It is also useful by itself for showing a colormap. If the *cmap*
+ kwarg is given but *boundaries* and *values* are left as None,
+ then the colormap will be displayed on a 0-1 scale. To show the
+ under- and over-value colors, specify the *norm* as::
+
+ colors.Normalize(clip=False)
+
To show the colors versus index instead of on the 0-1 scale,
- use norm=colors.NoNorm.
+ use::
+
+ norm=colors.NoNorm.
+
'''
_slice_dict = {'neither': slice(0,1000000),
'both': slice(1,-1),
@@ -257,7 +275,7 @@
def _outline(self, X, Y):
'''
- Return x, y arrays of colorbar bounding polygon,
+ Return *x*, *y* arrays of colorbar bounding polygon,
taking orientation into account.
'''
N = X.shape[0]
@@ -284,7 +302,8 @@
def _add_solids(self, X, Y, C):
'''
- Draw the colors using pcolor; optionally add separators.
+ Draw the colors using :meth:`~matplotlib.axes.Axes.pcolor`;
+ optionally add separators.
'''
## Change to pcolorfast after fixing bugs in some backends...
if self.orientation == 'vertical':
@@ -371,9 +390,9 @@
def _process_values(self, b=None):
'''
- Set the _boundaries and _values attributes based on
- the input boundaries and values. Input boundaries can
- be self.boundaries or the argument b.
+ Set the :attr:`_boundaries` and :attr:`_values` attributes
+ based on the input boundaries and values. Input boundaries
+ can be *self.boundaries* or the argument *b*.
'''
if b is None:
b = self.boundaries
@@ -441,15 +460,15 @@
def _find_range(self):
'''
- Set vmin and vmax attributes to the first and last
- boundary excluding extended end boundaries.
+ Set :attr:`vmin` and :attr:`vmax` attributes to the first and
+ last boundary excluding extended end boundaries.
'''
b = self._boundaries[self._inside]
self.vmin = b[0]
self.vmax = b[-1]
def _central_N(self):
- '''number of boundaries *before* extension of ends'''
+ '''number of boundaries **before** extension of ends'''
nb = len(self._boundaries)
if self.extend == 'both':
nb -= 2
@@ -471,7 +490,7 @@
def _uniform_y(self, N):
'''
- Return colorbar data coordinates for N uniformly
+ Return colorbar data coordinates for *N* uniformly
spaced boundaries, plus ends if required.
'''
if self.extend == 'neither':
@@ -595,7 +614,8 @@
def add_lines(self, CS):
'''
- Add the lines from a non-filled ContourSet to the colorbar.
+ Add the lines from a non-filled
+ :class:`~matplotlib.contour.ContourSet` to the colorbar.
'''
if not isinstance(CS, contour.ContourSet) or CS.filled:
raise ValueError('add_lines is only for a ContourSet of lines')
@@ -612,7 +632,8 @@
ColorbarBase.add_lines(self, CS.levels, tcolors, tlinewidths)
def update_bruteforce(self, mappable):
- '''Manually change any contour line colors. This is called
+ '''
+ Manually change any contour line colors. This is called
when the image or contour plot to which this colorbar belongs
is changed.
'''
@@ -666,12 +687,15 @@
return cax, kw
make_axes.__doc__ ='''
Resize and reposition a parent axes, and return a child
- axes suitable for a colorbar.
+ axes suitable for a colorbar::
- cax, kw = make_axes(parent, **kw)
+ cax, kw = make_axes(parent, **kw)
Keyword arguments may include the following (with defaults):
- orientation = 'vertical' or 'horizontal'
+
+ *orientation*
+ 'vertical' or 'horizontal'
+
%s
All but the first of these are stripped from the input kw set.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-15 23:53:18
|
Revision: 5551
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5551&view=rev
Author: dsdale
Date: 2008-06-15 16:53:06 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
added cm and collections to api reference
Modified Paths:
--------------
trunk/matplotlib/doc/api/index.rst
trunk/matplotlib/lib/matplotlib/cm.py
trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/doc/api/index.rst
===================================================================
--- trunk/matplotlib/doc/api/index.rst 2008-06-15 23:05:34 UTC (rev 5550)
+++ trunk/matplotlib/doc/api/index.rst 2008-06-15 23:53:06 UTC (rev 5551)
@@ -16,5 +16,7 @@
axes_api.rst
axis_api.rst
cbook_api.rst
+ cm_api.rst
+ collections_api.rst
pyplot_api.rst
index_backend_api.rst
Modified: trunk/matplotlib/lib/matplotlib/cm.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cm.py 2008-06-15 23:05:34 UTC (rev 5550)
+++ trunk/matplotlib/lib/matplotlib/cm.py 2008-06-15 23:53:06 UTC (rev 5551)
@@ -13,7 +13,7 @@
def get_cmap(name=None, lut=None):
"""
- Get a colormap instance, defaulting to rc values if name is None
+ Get a colormap instance, defaulting to rc values if *name* is None
"""
if name is None: name = mpl.rcParams['image.cmap']
if lut is None: lut = mpl.rcParams['image.lut']
@@ -29,8 +29,9 @@
def __init__(self, norm=None, cmap=None):
"""
- norm is a colors.normalize instance to map luminance to 0-1
- cmap is a cm colormap instance
+ *norm* is an instance of :class:`colors.Normalize` or one of
+ its subclasses, used to map luminance to 0-1. *cmap* is a
+ :mod:`cm` colormap instance, for example :data:`cm.jet`
"""
self.callbacksSM = cbook.CallbackRegistry((
@@ -50,10 +51,10 @@
self.colorbar = im, ax
def to_rgba(self, x, alpha=1.0, bytes=False):
- '''Return a normalized rgba array corresponding to x.
- If x is already an rgb array, insert alpha; if it is
- already rgba, return it unchanged.
- If bytes is True, return rgba as 4 uint8s instead of 4 floats.
+ '''Return a normalized rgba array corresponding to *x*. If *x*
+ is already an rgb array, insert *alpha*; if it is already
+ rgba, return it unchanged. If *bytes* is True, return rgba as
+ 4 uint8s instead of 4 floats.
'''
try:
if x.ndim == 3:
@@ -79,7 +80,7 @@
return x
def set_array(self, A):
- 'Set the image array from numpy array A'
+ 'Set the image array from numpy array *A*'
self._A = A
self.update_dict['array'] = True
@@ -97,8 +98,8 @@
def set_clim(self, vmin=None, vmax=None):
"""
- set the norm limits for image scaling; if vmin is a length2
- sequence, interpret it as (vmin, vmax) which is used to
+ set the norm limits for image scaling; if *vmin* is a length2
+ sequence, interpret it as ``(vmin, vmax)`` which is used to
support setp
ACCEPTS: a length 2 sequence of floats
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-06-15 23:05:34 UTC (rev 5550)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-06-15 23:53:06 UTC (rev 5551)
@@ -1,10 +1,11 @@
"""
Classes for the efficient drawing of large collections of objects that
-share most properties, eg a large number of line segments or polygons
+share most properties, e.g. a large number of line segments or
+polygons.
The classes are not meant to be as flexible as their single element
-counterparts (eg you may not be able to select all line styles) but
-they are meant to be fast for common use cases (eg a bunch of solid
+counterparts (e.g. you may not be able to select all line styles) but
+they are meant to be fast for common use cases (e.g. a bunch of solid
line segemnts)
"""
import math, warnings
@@ -24,32 +25,34 @@
All properties in a collection must be sequences or scalars;
if scalars, they will be converted to sequences. The
- property of the ith element of the collection is the
+ property of the ith element of the collection is::
- prop[i % len(props)].
+ prop[i % len(props)]
- kwargs are:
+ Keyword arguments and default values:
- edgecolors=None,
- facecolors=None,
- linewidths=None,
- antialiaseds = None,
- offsets = None,
- transOffset = transforms.IdentityTransform(),
- norm = None, # optional for cm.ScalarMappable
- cmap = None, # ditto
+ * *edgecolors*: None
+ * *facecolors*: None
+ * *linewidths*: None
+ * *antialiaseds*: None
+ * *offsets*: None
+ * *transOffset*: transforms.IdentityTransform()
+ * *norm*: None (optional for
+ :class:`matplotlib.cm.ScalarMappable`)
+ * *cmap*: None (optional for
+ :class:`matplotlib.cm.ScalarMappable`)
- offsets and transOffset are used to translate the patch after
- rendering (default no offsets)
+ *offsets* and *transOffset* are used to translate the patch after
+ rendering (default no offsets).
- If any of edgecolors, facecolors, linewidths, antialiaseds are
- None, they default to their patch.* rc params setting, in sequence
- form.
+ If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds*
+ are None, they default to their :data:`matplotlib.rcParams` patch
+ setting, in sequence form.
- The use of ScalarMappable is optional. If the ScalarMappable
- matrix _A is not None (ie a call to set_array has been made), at
- draw time a call to scalar mappable will be made to set the face
- colors.
+ The use of :class:`~matplotlib.cm.ScalarMappable` is optional. If
+ the :class:`~matplotlib.cm.ScalarMappable` matrix _A is not None
+ (ie a call to set_array has been made), at draw time a call to
+ scalar mappable will be made to set the face colors.
"""
_offsets = np.array([], np.float_)
_transOffset = transforms.IdentityTransform()
@@ -193,7 +196,8 @@
"""
Test whether the mouse event occurred in the collection.
- Returns T/F, dict(ind=itemlist), where every item in itemlist contains the event.
+ Returns True | False, ``dict(ind=itemlist)``, where every
+ item in itemlist contains the event.
"""
if callable(self._contains): return self._contains(self,mouseevent)
@@ -215,9 +219,9 @@
def set_linewidths(self, lw):
"""
- Set the linewidth(s) for the collection. lw can be a scalar or a
- sequence; if it is a sequence the patches will cycle through the
- sequence
+ Set the linewidth(s) for the collection. *lw* can be a scalar
+ or a sequence; if it is a sequence the patches will cycle
+ through the sequence
ACCEPTS: float or sequence of floats
"""
@@ -228,7 +232,7 @@
def set_linestyles(self, ls):
"""
Set the linestyles(s) for the collection.
- ACCEPTS: ['solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq) ]
+ ACCEPTS: ['solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq) ]
"""
try:
dashd = backend_bases.GraphicsContextBase.dashd
@@ -280,7 +284,7 @@
def set_color(self, c):
"""
Set both the edgecolor and the facecolor.
- See set_facecolor and set_edgecolor.
+ See :meth:`set_facecolor` and :meth:`set_edgecolor`.
ACCEPTS: matplotlib color arg or sequence of rgba tuples
"""
@@ -289,10 +293,10 @@
def set_facecolor(self, c):
"""
- Set the facecolor(s) of the collection. c can be a matplotlib
- color arg (all patches have same color), or a a sequence or
- rgba tuples; if it is a sequence the patches will cycle
- through the sequence
+ Set the facecolor(s) of the collection. *c* can be a
+ matplotlib color arg (all patches have same color), or a
+ sequence or rgba tuples; if it is a sequence the patches will
+ cycle through the sequence
ACCEPTS: matplotlib color arg or sequence of rgba tuples
"""
@@ -307,9 +311,10 @@
def set_edgecolor(self, c):
"""
- Set the edgecolor(s) of the collection. c can be a matplotlib color
- arg (all patches have same color), or a a sequence or rgba tuples; if
- it is a sequence the patches will cycle through the sequence
+ Set the edgecolor(s) of the collection. *c* can be a
+ matplotlib color arg (all patches have same color), or a
+ sequence or rgba tuples; if it is a sequence the patches will
+ cycle through the sequence
ACCEPTS: matplotlib color arg or sequence of rgba tuples
"""
@@ -320,7 +325,7 @@
def set_alpha(self, alpha):
"""
- Set the alpha tranparencies of the collection. Alpha must be
+ Set the alpha tranparencies of the collection. *alpha* must be
a float.
ACCEPTS: float
@@ -364,23 +369,25 @@
# class is built so we define an initial set here for the init
# function and they will be overridden after object defn
artist.kwdocd['Collection'] = """\
- Valid Collection kwargs are:
+ Valid Collection keyword arguments:
- edgecolors=None,
- facecolors=None,
- linewidths=None,
- antialiaseds = None,
- offsets = None,
- transOffset = transforms.IdentityTransform(),
- norm = None, # optional for cm.ScalarMappable
- cmap = None, # ditto
+ * *edgecolors*: None
+ * *facecolors*: None
+ * *linewidths*: None
+ * *antialiaseds*: None
+ * *offsets*: None
+ * *transOffset*: transforms.IdentityTransform()
+ * *norm*: None (optional for
+ :class:`matplotlib.cm.ScalarMappable`)
+ * *cmap*: None (optional for
+ :class:`matplotlib.cm.ScalarMappable`)
- offsets and transOffset are used to translate the patch after
+ *offsets* and *transOffset* are used to translate the patch after
rendering (default no offsets)
- If any of edgecolors, facecolors, linewidths, antialiaseds are
- None, they default to their patch.* rc params setting, in sequence
- form.
+ If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds*
+ are None, they default to their :data:`matplotlib.rcParams` patch
+ setting, in sequence form.
"""
class QuadMesh(Collection):
@@ -494,11 +501,11 @@
class PolyCollection(Collection):
def __init__(self, verts, sizes = None, **kwargs):
"""
- verts is a sequence of ( verts0, verts1, ...) where verts_i is
- a sequence of xy tuples of vertices, or an equivalent
- numpy array of shape (nv,2).
+ *verts* is a sequence of ( *verts0*, *verts1*, ...) where
+ *verts_i* is a sequence of xy tuples of vertices, or an
+ equivalent :mod:`numpy` array of shape (nv,2).
- sizes gives the area of the circle circumscribing the
+ *sizes* gives the area of the circle circumscribing the
polygon in points^2
%(Collection)s
@@ -532,9 +539,12 @@
"""
def __init__(self, xranges, yrange, **kwargs):
"""
- xranges : sequence of (xmin, xwidth)
- yrange : ymin, ywidth
+ *xranges*
+ sequence of (xmin, xwidth)
+ *yrange*
+ ymin, ywidth
+
%(Collection)s
"""
ymin, ywidth = yrange
@@ -554,34 +564,38 @@
"""
Draw a regular polygon with numsides.
- * dpi is the figure dpi instance, and is required to do the
- area scaling.
+ *dpi*
+ the figure dpi instance, and is required to do the
+ area scaling.
- * numsides: the number of sides of the polygon
+ *numsides*
+ the number of sides of the polygon
- * sizes gives the area of the circle circumscribing the
- regular polygon in points^2
+ *sizes*
+ gives the area of the circle circumscribing the
+ regular polygon in points^2
- * rotation is the rotation of the polygon in radians
+ *rotation*
+ the rotation of the polygon in radians
%(Collection)s
- Example: see examples/dynamic_collection.py for complete example
+ Example: see :file:`examples/dynamic_collection.py` for
+ complete example::
- offsets = np.random.rand(20,2)
- facecolors = [cm.jet(x) for x in np.random.rand(20)]
- black = (0,0,0,1)
+ offsets = np.random.rand(20,2)
+ facecolors = [cm.jet(x) for x in np.random.rand(20)]
+ black = (0,0,0,1)
- collection = RegularPolyCollection(
- numsides=5, # a pentagon
- rotation=0,
- sizes=(50,),
- facecolors = facecolors,
- edgecolors = (black,),
- linewidths = (1,),
- offsets = offsets,
- transOffset = ax.transData,
- )
+ collection = RegularPolyCollection(
+ numsides=5, # a pentagon
+ rotation=0, sizes=(50,),
+ facecolors = facecolors,
+ edgecolors = (black,),
+ linewidths = (1,),
+ offsets = offsets,
+ transOffset = ax.transData,
+ )
"""
Collection.__init__(self,**kwargs)
self._sizes = sizes
@@ -633,42 +647,57 @@
**kwargs
):
"""
- segments is a sequence of ( line0, line1, line2), where
- linen = (x0, y0), (x1, y1), ... (xm, ym), or the
- equivalent numpy array with two columns.
- Each line can be a different length.
+ *segments*
+ a sequence of ( *line0*, *line1*, *line2*), where::
- colors must be a tuple of RGBA tuples (eg arbitrary color
- strings, etc, not allowed).
+ linen = (x0, y0), (x1, y1), ... (xm, ym)
- antialiaseds must be a sequence of ones or zeros
+ or the equivalent numpy array with two columns. Each line
+ can be a different length.
- linestyles is a string or dash tuple. Legal string values are
- solid|dashed|dashdot|dotted. The dash tuple is (offset, onoffseq)
- where onoffseq is an even length tuple of on and off ink in points.
+ *colors*
+ must be a tuple of RGBA tuples (eg arbitrary color
+ strings, etc, not allowed).
- If linewidths, colors_, or antialiaseds is None, they default to
- their rc params setting, in sequence form.
+ *antialiaseds*
+ must be a sequence of ones or zeros
- If offsets and transOffset are not None, then
- offsets are transformed by transOffset and applied after
+ *linestyles* [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
+ a string or dash tuple. The dash tuple is::
+
+ (offset, onoffseq),
+
+ where *onoffseq* is an even length tuple of on and off ink
+ in points.
+
+ If *linewidths*, *colors*, or *antialiaseds* is None, they
+ default to their rcParams setting, in sequence form.
+
+ If *offsets* and *transOffset* are not None, then
+ *offsets* are transformed by *transOffset* and applied after
the segments have been transformed to display coordinates.
- If offsets is not None but transOffset is None, then the
- offsets are added to the segments before any transformation.
- In this case, a single offset can be specified as offsets=(xo,yo),
- and this value will be
- added cumulatively to each successive segment, so as
- to produce a set of successively offset curves.
+ If *offsets* is not None but *transOffset* is None, then the
+ *offsets* are added to the segments before any transformation.
+ In this case, a single offset can be specified as::
- norm = None, # optional for ScalarMappable
- cmap = None, # ditto
+ offsets=(xo,yo)
- pickradius is the tolerance for mouse clicks picking a line. The
- default is 5 pt.
+ and this value will be added cumulatively to each successive
+ segment, so as to produce a set of successively offset curves.
- The use of ScalarMappable is optional. If the ScalarMappable
- matrix _A is not None (ie a call to set_array has been made), at
+ *norm*
+ None (optional for :class:`matplotlib.cm.ScalarMappable`)
+ *cmap*
+ None (optional for :class:`matplotlib.cm.ScalarMappable`)
+
+ *pickradius* is the tolerance for mouse clicks picking a line.
+ The default is 5 pt.
+
+ The use of :class:`~matplotlib.cm.ScalarMappable` is optional.
+ If the :class:`~matplotlib.cm.ScalarMappable` matrix
+ :attr:`~matplotlib.cm.ScalarMappable._A` is not None (ie a call to
+ :meth:`~matplotlib.cm.ScalarMappable.set_array` has been made), at
draw time a call to scalar mappable will be made to set the colors.
"""
if colors is None: colors = mpl.rcParams['lines.color']
@@ -721,8 +750,8 @@
def set_color(self, c):
"""
- Set the color(s) of the line collection. c can be a
- matplotlib color arg (all patches have same color), or a a
+ Set the color(s) of the line collection. *c* can be a
+ matplotlib color arg (all patches have same color), or a
sequence or rgba tuples; if it is a sequence the patches will
cycle through the sequence
@@ -732,8 +761,8 @@
def color(self, c):
"""
- Set the color(s) of the line collection. c can be a
- matplotlib color arg (all patches have same color), or a a
+ Set the color(s) of the line collection. *c* can be a
+ matplotlib color arg (all patches have same color), or a
sequence or rgba tuples; if it is a sequence the patches will
cycle through the sequence
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-15 23:05:37
|
Revision: 5550
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5550&view=rev
Author: dsdale
Date: 2008-06-15 16:05:34 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
add axis and cbook to api reference
Modified Paths:
--------------
trunk/matplotlib/doc/api/index.rst
trunk/matplotlib/lib/matplotlib/axis.py
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/doc/api/index.rst
===================================================================
--- trunk/matplotlib/doc/api/index.rst 2008-06-15 20:38:00 UTC (rev 5549)
+++ trunk/matplotlib/doc/api/index.rst 2008-06-15 23:05:34 UTC (rev 5550)
@@ -14,5 +14,7 @@
matplotlib_configuration_api.rst
artist_api.rst
axes_api.rst
+ axis_api.rst
+ cbook_api.rst
pyplot_api.rst
index_backend_api.rst
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2008-06-15 20:38:00 UTC (rev 5549)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2008-06-15 23:05:34 UTC (rev 5550)
@@ -23,19 +23,38 @@
1 refers to the bottom of the plot for xticks and the left for yticks
2 refers to the top of the plot for xticks and the right for yticks
- Publicly accessible attributes
+ Publicly accessible attributes:
- tick1line : a Line2D instance
- tick2line : a Line2D instance
- gridline : a Line2D instance
- label1 : a Text instance
- label2 : a Text instance
- gridOn : a boolean which determines whether to draw the tickline
- tick1On : a boolean which determines whether to draw the 1st tickline
- tick2On : a boolean which determines whether to draw the 2nd tickline
- label1On : a boolean which determines whether to draw tick label
- label2On : a boolean which determines whether to draw tick label
+ :attr:`tick1line`
+ a Line2D instance
+ :attr:`tick2line`
+ a Line2D instance
+
+ :attr:`gridline`
+ a Line2D instance
+
+ :attr:`label1`
+ a Text instance
+
+ :attr:`label2`
+ a Text instance
+
+ :attr:`gridOn`
+ a boolean which determines whether to draw the tickline
+
+ :attr:`tick1On`
+ a boolean which determines whether to draw the 1st tickline
+
+ :attr:`tick2On`
+ a boolean which determines whether to draw the 2nd tickline
+
+ :attr:`label1On`
+ a boolean which determines whether to draw tick label
+
+ :attr:`label2On`
+ a boolean which determines whether to draw tick label
+
"""
def __init__(self, axes, loc, label,
size = None, # points
@@ -111,7 +130,8 @@
return self.figure.dpi * self._pad / 72.0
def contains(self, mouseevent):
- """Test whether the mouse event occured in the Tick marks.
+ """
+ Test whether the mouse event occured in the Tick marks.
This function always returns false. It is more useful to test if the
axis as a whole contains the mouse rather than the set of tick marks.
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2008-06-15 20:38:00 UTC (rev 5549)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2008-06-15 23:05:34 UTC (rev 5550)
@@ -40,7 +40,7 @@
class todatetime(converter):
'convert to a datetime or None'
def __init__(self, fmt='%Y-%m-%d', missing='Null', missingval=None):
- 'use a time.strptime format string for conversion'
+ 'use a :func:`time.strptime` format string for conversion'
converter.__init__(self, missing, missingval)
self.fmt = fmt
@@ -54,7 +54,7 @@
class todate(converter):
'convert to a date or None'
def __init__(self, fmt='%Y-%m-%d', missing='Null', missingval=None):
- 'use a time.strptime format string for conversion'
+ 'use a :func:`time.strptime` format string for conversion'
converter.__init__(self, missing, missingval)
self.fmt = fmt
def __call__(self, s):
@@ -84,7 +84,7 @@
class CallbackRegistry:
"""
Handle registering and disconnecting for a set of signals and
- callbacks
+ callbacks::
signals = 'eat', 'drink', 'be merry'
@@ -109,7 +109,7 @@
"""
def __init__(self, signals):
- 'signals is a sequence of valid signals'
+ '*signals* is a sequence of valid signals'
self.signals = set(signals)
# callbacks is a dict mapping the signal to a dictionary
# mapping callback id to the callback function
@@ -117,7 +117,7 @@
self._cid = 0
def _check_signal(self, s):
- 'make sure s is a valid signal or raise a ValueError'
+ 'make sure *s* is a valid signal or raise a ValueError'
if s not in self.signals:
signals = list(self.signals)
signals.sort()
@@ -125,7 +125,7 @@
def connect(self, s, func):
"""
- register func to be called when a signal s is generated
+ register *func* to be called when a signal *s* is generated
func will be called
"""
self._check_signal(s)
@@ -135,7 +135,7 @@
def disconnect(self, cid):
"""
- disconnect the callback registered with callback id cid
+ disconnect the callback registered with callback id *cid*
"""
for eventname, callbackd in self.callbacks.items():
try: del callbackd[cid]
@@ -144,8 +144,8 @@
def process(self, s, *args, **kwargs):
"""
- process signal s. All of the functions registered to receive
- callbacks on s will be called with *args and **kwargs
+ process signal *s*. All of the functions registered to receive
+ callbacks on *s* will be called with *\*args* and *\*\*kwargs*
"""
self._check_signal(s)
for func in self.callbacks[s].values():
@@ -194,42 +194,42 @@
def unique(x):
- 'Return a list of unique elements of x'
+ 'Return a list of unique elements of *x*'
return dict([ (val, 1) for val in x]).keys()
def iterable(obj):
- 'return true if obj is iterable'
+ 'return true if *obj* is iterable'
try: len(obj)
except: return 0
return 1
def is_string_like(obj):
- 'return true if obj looks like a string'
+ 'return true if *obj* looks like a string'
if hasattr(obj, 'shape'): return 0
try: obj + ''
except (TypeError, ValueError): return 0
return 1
def is_writable_file_like(obj):
- 'return true if obj looks like a file object'
+ 'return true if *obj* looks like a file object'
return hasattr(obj, 'write') and callable(obj.write)
def is_scalar(obj):
- 'return true if ob is not string like and is not iterable'
+ 'return true if *obj* is not string like and is not iterable'
return is_string_like(obj) or not iterable(obj)
def is_numlike(obj):
- 'return true if obj looks like a number'
+ 'return true if *obj* looks like a number'
try: obj+1
except TypeError: return False
else: return True
def to_filehandle(fname, flag='r', return_opened=False):
"""
- fname can be a filename or a file handle. Support for gzipped
- files is automatic, if the filename ends in .gz. flag is a
- read/write flag for file
+ *fname* can be a filename or a file handle. Support for gzipped
+ files is automatic, if the filename ends in .gz. *flag* is a
+ read/write flag for :func:`file`
"""
if is_string_like(fname):
if fname.endswith('.gz'):
@@ -275,18 +275,19 @@
Sort by attribute or item
- Example usage:
- sort = Sorter()
+ Example usage::
- list = [(1, 2), (4, 8), (0, 3)]
- dict = [{'a': 3, 'b': 4}, {'a': 5, 'b': 2}, {'a': 0, 'b': 0},
- {'a': 9, 'b': 9}]
+ sort = Sorter()
+ list = [(1, 2), (4, 8), (0, 3)]
+ dict = [{'a': 3, 'b': 4}, {'a': 5, 'b': 2}, {'a': 0, 'b': 0},
+ {'a': 9, 'b': 9}]
- sort(list) # default sort
- sort(list, 1) # sort by index 1
- sort(dict, 'a') # sort a list of dicts by key 'a'
+ sort(list) # default sort
+ sort(list, 1) # sort by index 1
+ sort(dict, 'a') # sort a list of dicts by key 'a'
+
"""
def _helper(self, data, aux, inplace):
@@ -324,19 +325,19 @@
"""
All-in-one multiple-string-substitution class
- Example usage:
+ Example usage::
- text = "Larry Wall is the creator of Perl"
- adict = {
- "Larry Wall" : "Guido van Rossum",
- "creator" : "Benevolent Dictator for Life",
- "Perl" : "Python",
- }
+ text = "Larry Wall is the creator of Perl"
+ adict = {
+ "Larry Wall" : "Guido van Rossum",
+ "creator" : "Benevolent Dictator for Life",
+ "Perl" : "Python",
+ }
- print multiple_replace(adict, text)
+ print multiple_replace(adict, text)
- xlat = Xlator(adict)
- print xlat.xlat(text)
+ xlat = Xlator(adict)
+ print xlat.xlat(text)
"""
def _make_regex(self):
@@ -344,11 +345,11 @@
return re.compile("|".join(map(re.escape, self.keys())))
def __call__(self, match):
- """ Handler invoked for each regex match """
+ """ Handler invoked for each regex *match* """
return self[match.group(0)]
def xlat(self, text):
- """ Translate text, returns the modified text. """
+ """ Translate *text*, returns the modified text. """
return self._make_regex().sub(self, text)
@@ -424,7 +425,7 @@
get_realpath_and_stat = GetRealpathAndStat()
def dict_delall(d, keys):
- 'delete all of the keys from the dict d'
+ 'delete all of the *keys* from the :class:`dict` *d*'
for key in keys:
try: del d[key]
except KeyError: pass
@@ -464,10 +465,13 @@
def get_split_ind(seq, N):
- """seq is a list of words. Return the index into seq such that
- len(' '.join(seq[:ind])<=N
"""
+ *seq* is a list of words. Return the index into seq such that::
+ len(' '.join(seq[:ind])<=N
+
+ """
+
sLen = 0
# todo: use Alex's xrange pattern from the cbook for efficiency
for (word, ind) in zip(seq, range(len(seq))):
@@ -477,7 +481,7 @@
def wrap(prefix, text, cols):
- 'wrap text with prefix at length cols'
+ 'wrap *text* with *prefix* at length *cols*'
pad = ' '*len(prefix.expandtabs())
available = cols - len(pad)
@@ -504,14 +508,13 @@
_dedent_regex = {}
def dedent(s):
"""
- Remove excess indentation from docstrings.
+ Remove excess indentation from docstring *s*.
- Discards any leading blank lines, then removes up to
- n whitespace characters from each line, where n is
- the number of leading whitespace characters in the
- first line. It differs from textwrap.dedent in its
- deletion of leading blank lines and its use of the
- first non-blank line to determine the indentation.
+ Discards any leading blank lines, then removes up to n whitespace
+ characters from each line, where n is the number of leading
+ whitespace characters in the first line. It differs from
+ textwrap.dedent in its deletion of leading blank lines and its use
+ of the first non-blank line to determine the indentation.
It is also faster in most cases.
"""
@@ -546,6 +549,7 @@
def listFiles(root, patterns='*', recurse=1, return_folders=0):
"""
Recursively list files
+
from Parmar and Martelli in the Python Cookbook
"""
import os.path, fnmatch
@@ -575,8 +579,8 @@
def get_recursive_filelist(args):
"""
- Recurs all the files and dirs in args ignoring symbolic links and
- return the files as a list of strings
+ Recurs all the files and dirs in *args* ignoring symbolic links
+ and return the files as a list of strings
"""
files = []
@@ -593,7 +597,7 @@
def pieces(seq, num=2):
- "Break up the seq into num tuples"
+ "Break up the *seq* into *num* tuples"
start = 0
while 1:
item = seq[start:start+num]
@@ -611,8 +615,8 @@
def allequal(seq):
"""
- return true if all elements of seq compare equal. If seq is 0 or
- 1 length, return True
+ return true if all elements of *seq* compare equal. If *seq* is 0
+ or 1 length, return *True*
"""
if len(seq)<2: return True
val = seq[0]
@@ -637,10 +641,11 @@
def allpairs(x):
"""
- return all possible pairs in sequence x
+ return all possible pairs in sequence *x*
- Condensed by Alex Martelli from this thread on c.l.python
- http://groups.google.com/groups?q=all+pairs+group:*python*&hl=en&lr=&ie=UTF-8&selm=mailman.4028.1096403649.5135.python-list%40python.org&rnum=1
+ Condensed by Alex Martelli from this thread_ on c.l.python
+
+ .. _thread: http://groups.google.com/groups?q=all+pairs+group:*python*&hl=en&lr=&ie=UTF-8&selm=mailman.4028.1096403649.5135.python-list%40python.org&rnum=1
"""
return [ (s, f) for i, f in enumerate(x) for s in x[i+1:] ]
@@ -650,15 +655,17 @@
# python 2.2 dicts don't have pop--but we don't support 2.2 any more
def popd(d, *args):
"""
- Should behave like python2.3 pop method; d is a dict
+ Should behave like python2.3 :meth:`dict.pop` method; *d* is a
+ :class:`dict`::
- # returns value for key and deletes item; raises a KeyError if key
- # is not in dict
- val = popd(d, key)
+ # returns value for key and deletes item; raises a KeyError if key
+ # is not in dict
+ val = popd(d, key)
- # returns value for key if key exists, else default. Delete key,
- # val item if it exists. Will not raise a KeyError
- val = popd(d, key, default)
+ # returns value for key if key exists, else default. Delete key,
+ # val item if it exists. Will not raise a KeyError
+ val = popd(d, key, default)
+
"""
if len(args)==1:
key = args[0]
@@ -744,8 +751,8 @@
def bubble(self, o):
"""
- raise o to the top of the stack and return o. o must be in
- the stack
+ raise *o* to the top of the stack and return *o*. *o* must be
+ in the stack
"""
if o not in self._elements:
@@ -761,7 +768,7 @@
return o
def remove(self, o):
- 'remove element o from the stack'
+ 'remove element *o* from the stack'
if o not in self._elements:
raise ValueError('Unknown element o')
old = self._elements[:]
@@ -776,7 +783,7 @@
def finddir(o, match, case=False):
"""
- return all attributes of o which match string in match. if case
+ return all attributes of *o* which match string in match. if case
is True require an exact case match.
"""
if case:
@@ -787,7 +794,7 @@
return [orig for name, orig in names if name.find(match)>=0]
def reverse_dict(d):
- 'reverse the dictionary -- may lose data if values are not uniq!'
+ 'reverse the dictionary -- may lose data if values are not unique!'
return dict([(v,k) for k,v in d.items()])
@@ -808,7 +815,7 @@
_safezip_msg = 'In safezip, len(args[0])=%d but len(args[%d])=%d'
def safezip(*args):
- 'make sure args are equal len before zipping'
+ 'make sure *args* are equal len before zipping'
Nx = len(args[0])
for i, arg in enumerate(args[1:]):
if len(arg) != Nx:
@@ -870,12 +877,16 @@
def print_cycles(objects, outstream=sys.stdout, show_progress=False):
"""
- objects: A list of objects to find cycles in. It is often useful
- to pass in gc.garbage to find the cycles that are
- preventing some objects from being garbage collected.
- outstream: The stream for output.
- show_progress: If True, print the number of objects reached as they are
- found.
+ *objects*
+ A list of objects to find cycles in. It is often useful to
+ pass in gc.garbage to find the cycles that are preventing some
+ objects from being garbage collected.
+
+ *outstream*
+ The stream for output.
+
+ *show_progress*
+ If True, print the number of objects reached as they are found.
"""
import gc
from types import FrameType
@@ -936,9 +947,9 @@
together into disjoint sets when a full-blown graph data structure
would be overkill.
- Objects can be joined using .join(), tested for connectedness
- using .joined(), and all disjoint sets can be retreived using
- .get().
+ Objects can be joined using :meth:`join`, tested for connectedness
+ using :meth:`joined`, and all disjoint sets can be retreived using
+ :meth:`get`.
The objects being joined must be hashable.
@@ -987,7 +998,7 @@
def joined(self, a, b):
"""
- Returns True if a and b are members of the same set.
+ Returns True if *a* and *b* are members of the same set.
"""
mapping = self._mapping
try:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2008-06-15 20:38:05
|
Revision: 5549
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5549&view=rev
Author: astraw
Date: 2008-06-15 13:38:00 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
fix example to run with current MPL and numpy
Modified Paths:
--------------
trunk/matplotlib/examples/units/date_converter.py
Modified: trunk/matplotlib/examples/units/date_converter.py
===================================================================
--- trunk/matplotlib/examples/units/date_converter.py 2008-06-15 15:29:57 UTC (rev 5548)
+++ trunk/matplotlib/examples/units/date_converter.py 2008-06-15 20:38:00 UTC (rev 5549)
@@ -1,7 +1,8 @@
import date_support # set up the date converters
import datetime
from matplotlib.dates import drange
-from pylab import figure, show, nx
+from pylab import figure, show
+import numpy as np
xmin = datetime.date(2007,1,1)
@@ -12,7 +13,7 @@
fig = figure()
fig.subplots_adjust(bottom=0.2)
ax = fig.add_subplot(111)
-ax.plot(xdates, nx.mlab.rand(len(xdates)), 'o')
+ax.plot(xdates, np.random.rand(len(xdates)), 'o')
ax.set_xlim(datetime.date(2007,2,1), datetime.date(2007,3,1))
fig.autofmt_xdate()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-15 15:30:38
|
Revision: 5548
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5548&view=rev
Author: dsdale
Date: 2008-06-15 08:29:57 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
Expanded on documentation guidelines
Modified Paths:
--------------
trunk/matplotlib/doc/devel/documenting_mpl.rst
trunk/matplotlib/doc/glossary/index.rst
Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst
===================================================================
--- trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-06-15 12:08:13 UTC (rev 5547)
+++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-06-15 15:29:57 UTC (rev 5548)
@@ -33,6 +33,7 @@
The output produced by Sphinx can be configured by editing the `conf.py`
file located in the `doc/`.
+
Organization of matplotlib's documentation
==========================================
@@ -50,6 +51,7 @@
.. include:: ../../TODO
+
Formatting
==========
@@ -61,6 +63,20 @@
other semantic markup. For example, when referring to external files, use the
``:file:`` directive.
+* Function arguments and keywords should be referred to using the *emphasis*
+ role. This will keep matplotlib's documentation consistant with Python's
+ documentation::
+
+ Here is a description of *argument*
+
+ Please do not use the `default role`::
+
+ Please do not describe `argument` like this.
+
+ nor the ``literal`` role::
+
+ Please do not describe ``argument`` like this.
+
* Sphinx does not support tables with column- or row-spanning cells for
latex output. Such tables can not be used when documenting matplotlib.
@@ -92,10 +108,96 @@
In [69]: lines = plot([1,2,3])
+* Footnotes [#]_ can be added using ``[#]_``, followed later by::
+
+ .. rubric:: Footnotes
+
+ .. [#]
+
+ .. rubric:: Footnotes
+
+ .. [#] For example.
+
+* Use the *note* and *warning* directives, sparingly, to draw attention to
+ important comments::
+
+ .. note::
+ Here is a note
+
+ yields:
+
+ .. note::
+ here is a note
+
+ also:
+
+ .. warning::
+ here is a warning
+
+* Use the *deprecated* directive when appropriate::
+
+ .. deprecated:: 0.98
+ This feature is obsolete, use something else.
+
+ yields:
+
+ .. deprecated:: 0.98
+ This feature is obsolete, use something else.
+
+* Use the *versionadded* and *versionchanged* directives, which have similar
+ syntax to the *deprecated* role::
+
+ .. versionadded:: 0.98
+ The transforms have been completely revamped.
+
+ .. versionadded:: 0.98
+ The transforms have been completely revamped.
+
+* Use the *seealso* directive, for example::
+
+ .. seealso::
+
+ Using ReST :ref:`emacs-helpers`:
+ One example
+
+ A bit about :ref:`referring-to-mpl-docs`:
+ One more
+
+ yields:
+
+ .. seealso::
+
+ Using ResT :ref:`emacs-helpers`:
+ One example
+
+ A bit about :ref:`referring-to-mpl-docs`:
+ One more
+
+* Please keep the :ref:`glossary` in mind when writing documentation. You can
+ create a references to a term in the glossary with the ``:term:`` role.
+
+* The autodoc extension will handle index entries for the API, but additional
+ entries in the index_ need to be explicitly added.
+
.. _documentation: http://sphinx.pocoo.org/contents.html
.. _`inline markup`: http://sphinx.pocoo.org/markup/inline.html
+.. _index: http://sphinx.pocoo.org/markup/para.html#index-generating-markup
+Docstrings
+----------
+In addition to the aforementioned formatting suggestions:
+
+* Please limit the text width of docstrings to 70 characters.
+
+* Keyword arguments should be described using a definition list.
+
+ .. note::
+ matplotlib makes extensive use of keyword arguments as pass-through
+ arguments, there are a many cases where a table is used in place of a
+ definition list for autogenerated sections of docstrings.
+
+
Figures
=======
@@ -139,7 +241,6 @@
:include-source
-
.. _referring-to-mpl-docs:
Referring to mpl documents
@@ -166,8 +267,6 @@
.. literalinclude:: ../mpl_data/matplotlibrc
-
-
.. _internal-section-refs:
Internal section references
@@ -196,8 +295,8 @@
In addition, since underscores are widely used by Sphinx itself, let's prefer
hyphens to separate words.
-.. _emacs-helpers:
+
Section names, etc
==================
@@ -205,6 +304,9 @@
section titles, eg ``Possible hangups`` rather than ``Possible
Hangups``
+
+.. _emacs-helpers:
+
Emacs helpers
=============
Modified: trunk/matplotlib/doc/glossary/index.rst
===================================================================
--- trunk/matplotlib/doc/glossary/index.rst 2008-06-15 12:08:13 UTC (rev 5547)
+++ trunk/matplotlib/doc/glossary/index.rst 2008-06-15 15:29:57 UTC (rev 5548)
@@ -1,6 +1,9 @@
-########
+
+.. _glossary:
+
+********
Glossary
-########
+********
.. glossary::
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-15 12:08:36
|
Revision: 5547
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5547&view=rev
Author: jswhit
Date: 2008-06-15 05:08:13 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
moved to __init__.py so Sphinx can find docstrings.
Removed Paths:
-------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
Deleted: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-15 11:57:51 UTC (rev 5546)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008-06-15 12:08:13 UTC (rev 5547)
@@ -1,3344 +0,0 @@
-"""
-Module for plotting data on maps with matplotlib.
-
-Contains the Basemap class (which does most of the
-heavy lifting), and the following functions:
-
-NetCDFFile: Read local and remote NetCDF datasets.
-
-interp: bilinear interpolation between rectilinear grids.
-
-shiftgrid: shifts global lat/lon grids east or west.
-
-addcyclic: Add cyclic (wraparound) point in longitude.
-
-num2date: convert from a numeric time value to a datetime object.
-
-date2num: convert from a datetime object to a numeric time value.
-"""
-from matplotlib import __version__ as _matplotlib_version
-from matplotlib.cbook import is_scalar, dedent
-# check to make sure matplotlib is not too old.
-_mpl_required_version = '0.98'
-if _matplotlib_version < _mpl_required_version:
- msg = dedent("""
- your matplotlib is too old - basemap requires version %s or
- higher, you have version %s""" %
- (_mpl_required_version,_matplotlib_version))
- raise ImportError(msg)
-from matplotlib import rcParams, is_interactive, _pylab_helpers
-from matplotlib.collections import LineCollection
-from matplotlib.patches import Ellipse, Circle, Polygon
-from matplotlib.lines import Line2D
-from matplotlib.transforms import Bbox
-import pyproj, sys, os, math, dbflib
-from proj import Proj
-import numpy as np
-import numpy.ma as ma
-from shapelib import ShapeFile
-import _geoslib, pupynere, netcdftime
-
-# basemap data files now installed in lib/matplotlib/toolkits/basemap/data
-basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data'])
-
-__version__ = '0.99'
-
-# supported map projections.
-_projnames = {'cyl' : 'Cylindrical Equidistant',
- 'merc' : 'Mercator',
- 'tmerc' : 'Transverse Mercator',
- 'omerc' : 'Oblique Mercator',
- 'mill' : 'Miller Cylindrical',
- 'lcc' : 'Lambert Conformal',
- 'laea' : 'Lambert Azimuthal Equal Area',
- 'nplaea' : 'North-Polar Lambert Azimuthal',
- 'splaea' : 'South-Polar Lambert Azimuthal',
- 'eqdc' : 'Equidistant Conic',
- 'aeqd' : 'Azimuthal Equidistant',
- 'npaeqd' : 'North-Polar Azimuthal Equidistant',
- 'spaeqd' : 'South-Polar Azimuthal Equidistant',
- 'aea' : 'Albers Equal Area',
- 'stere' : 'Stereographic',
- 'npstere' : 'North-Polar Stereographic',
- 'spstere' : 'South-Polar Stereographic',
- 'cass' : 'Cassini-Soldner',
- 'poly' : 'Polyconic',
- 'ortho' : 'Orthographic',
- 'geos' : 'Geostationary',
- 'sinu' : 'Sinusoidal',
- 'moll' : 'Mollweide',
- 'robin' : 'Robinson',
- 'gnom' : 'Gnomonic',
- }
-supported_projections = []
-for _items in _projnames.iteritems():
- supported_projections.append("'%s' = %s\n" % (_items))
-supported_projections = ''.join(supported_projections)
-
-# projection specific parameters.
-projection_params = {'cyl' : 'corners only (no width/height)',
- 'merc' : 'corners plus lat_ts (no width/height)',
- 'tmerc' : 'lon_0,lat_0',
- 'omerc' : 'lon_0,lat_0,lat_1,lat_2,lon_1,lon_2,no_rot',
- 'mill' : 'corners only (no width/height)',
- 'lcc' : 'lon_0,lat_0,lat_1,lat_2',
- 'laea' : 'lon_0,lat_0',
- 'nplaea' : 'bounding_lat,lon_0,lat_0,no corners or width/height',
- 'splaea' : 'bounding_lat,lon_0,lat_0,no corners or width/height',
- 'eqdc' : 'lon_0,lat_0,lat_1,lat_2',
- 'aeqd' : 'lon_0,lat_0',
- 'npaeqd' : 'bounding_lat,lon_0,lat_0,no corners or width/height',
- 'spaeqd' : 'bounding_lat,lon_0,lat_0,no corners or width/height',
- 'aea' : 'lon_0,lat_0,lat_1',
- 'stere' : 'lon_0,lat_0,lat_ts',
- 'npstere' : 'bounding_lat,lon_0,lat_0,no corners or width/height',
- 'spstere' : 'bounding_lat,lon_0,lat_0,no corners or width/height',
- 'cass' : 'lon_0,lat_0',
- 'poly' : 'lon_0,lat_0',
- 'ortho' : 'lon_0,lat_0,llcrnrx,llcrnry,urcrnrx,urcrnry,no width/height',
- 'geos' : 'lon_0,satellite_height,llcrnrx,llcrnry,urcrnrx,urcrnry,no width/height',
- 'sinu' : 'lon_0,lat_0,no corners or width/height',
- 'moll' : 'lon_0,lat_0,no corners or width/height',
- 'robin' : 'lon_0,lat_0,no corners or width/height',
- 'gnom' : 'lon_0,lat_0',
- }
-
-# The __init__ docstring is pulled out here because it is so long;
-# Having it in the usual place makes it hard to get from the
-# __init__ argument list to the code that uses the arguments.
-_Basemap_init_doc = """
- create a Basemap instance.
-
- This sets up a basemap with specified map projection.
- and creates the coastline data structures in native map projection
- coordinates.
-
- arguments:
-
- projection - map projection. Supported projections are:
-%(supported_projections)s
- Default is 'cyl'.
-
- For most map projections, the map projection region can either be
- specified by setting these keywords:
-
- llcrnrlon - longitude of lower left hand corner of the desired map domain (degrees).
- llcrnrlat - latitude of lower left hand corner of the desired map domain (degrees).
- urcrnrlon - longitude of upper right hand corner of the desired map domain (degrees).
- urcrnrlat - latitude of upper right hand corner of the desired map domain (degrees).
-
- or these keywords:
-
- width - width of desired map domain in projection coordinates (meters).
- height - height of desired map domain in projection coordinates (meters).
- lon_0 - center of desired map domain (in degrees).
- lat_0 - center of desired map domain (in degrees).
-
- For 'sinu', 'moll', 'npstere', 'spstere', 'nplaea', 'splaea', 'nplaea',
- 'splaea', 'npaeqd', 'spaeqd' or 'robin', the values of
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat,width and height are ignored
- (because either they are computed internally, or entire globe is
- always plotted). For the cylindrical projections
- ('cyl','merc' and 'mill'), the default is to use
- llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other
- projections except 'ortho' and 'geos', either the lat/lon values of the
- corners or width and height must be specified by the user.
- For 'ortho' and 'geos', the lat/lon values of the corners may be specified,
- or the x/y values of the corners (llcrnrx,llcrnry,urcrnrx,urcrnry) in the
- coordinate system of the global projection (with x=0,y=0 at the center
- of the global projection). If the corners are not specified,
- the entire globe is plotted.
-
- resolution - resolution of boundary database to use. Can be 'c' (crude),
- 'l' (low), 'i' (intermediate), 'h' (high), 'f' (full) or None.
- If None, no boundary data will be read in (and class methods
- such as drawcoastlines will raise an exception if invoked).
- Resolution drops off by roughly 80%%
- between datasets. Higher res datasets are much slower to draw.
- Default 'c'. Coastline data is from the GSHHS
- (http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html).
- State, country and river datasets from the Generic Mapping
- Tools (http://gmt.soest.hawaii.edu).
-
- area_thresh - coastline or lake with an area smaller than area_thresh
- in km^2 will not be plotted. Default 10000,1000,100,10,1 for resolution
- 'c','l','i','h','f'.
-
- rsphere - radius of the sphere used to define map projection (default
- 6370997 meters, close to the arithmetic mean radius of the earth). If
- given as a sequence, the first two elements are interpreted as
- the the radii of the major and minor axes of an ellipsoid. Note: sometimes
- an ellipsoid is specified by the major axis and an 'inverse flattening
- parameter' (if). The minor axis (b) can be computed from the major axis (a)
- and the inverse flattening parameter using the formula if = a/(a-b).
-
- suppress_ticks - suppress automatic drawing of axis ticks and labels
- in map projection coordinates. Default False, so parallels and meridians
- can be labelled instead. If parallel or meridian labelling is requested
- (using drawparallels and drawmeridians methods), automatic tick labelling
- will be supressed even is suppress_ticks=False. suppress_ticks=False
- is useful if you want to use your own custom tick formatter, or
- if you want to let matplotlib label the axes in meters
- using native map projection coordinates
-
- anchor - determines how map is placed in axes rectangle (passed to
- axes.set_aspect). Default is 'C', which means map is centered.
- Allowed values are ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'].
-
- ax - set default axes instance (default None - pylab.gca() may be used
- to get the current axes instance). If you don't want pylab to be imported,
- you can either set this to a pre-defined axes instance, or use the 'ax'
- keyword in each Basemap method call that does drawing. In the first case,
- all Basemap method calls will draw to the same axes instance. In the
- second case, you can draw to different axes with the same Basemap instance.
- You can also use the 'ax' keyword in individual method calls to
- selectively override the default axes instance.
-
- The following parameters are map projection parameters which all default to
- None. Not all parameters are used by all projections, some are ignored.
- The module variable 'projection_params' is a dictionary which
- lists which parameters apply to which projections.
-
- lat_ts - latitude of true scale for mercator projection, optional
- for stereographic projection.
- lat_1 - first standard parallel for lambert conformal, albers
- equal area projection and equidistant conic projections. Latitude of one
- of the two points on the projection centerline for oblique mercator.
- If lat_1 is not given, but lat_0 is, lat_1 is set to lat_0 for
- lambert conformal, albers equal area and equidistant conic.
- lat_2 - second standard parallel for lambert conformal, albers
- equal area projection and equidistant conic projections. Latitude of one
- of the two points on the projection centerline for oblique mercator.
- If lat_2 is not given, it is set to lat_1 for
- lambert conformal, albers equal area and equidistant conic.
- lon_1 - longitude of one of the two points on the projection centerline
- for oblique mercator.
- lon_2 - longitude of one of the two points on the projection centerline
- for oblique mercator.
- no_rot - only used by oblique mercator. If set to True, the map projection
- coordinates will not be rotated to true North. Default is False (projection
- coordinates are automatically rotated).
- lat_0 - central latitude (y-axis origin) - used by all projections,
- Must be equator for mercator projection.
- lon_0 - central meridian (x-axis origin) - used by all projections,
- boundinglat - bounding latitude for pole-centered projections (npstere,spstere,
- nplaea,splaea,npaeqd,spaeqd). These projections are square regions centered
- on the north or south pole. The longitude lon_0 is at 6-o'clock, and the
- latitude circle boundinglat is tangent to the edge of the map at lon_0.
- satellite_height - height of satellite (in m) above equator -
- only relevant for geostationary projections ('geos'). Default 35,786 km.
-
- Here are the most commonly used class methods (see the docstring
- for each for more details):
-
- To draw a graticule grid (labelled latitude and longitude lines)
- use the drawparallels and drawmeridians methods.
-
- To draw coastline, rivers and political boundaries, use the
- the drawcontinents, drawrivers, drawcountries and drawstates methods.
-
- To fill the continents and inland lakes, use the fillcontinents method.
-
- To draw the boundary of the map projection region, and fill the
- interior a certain color, use the drawmapboundary method.
-
- The contour, contourf, pcolor, pcolormesh, plot, scatter
- quiver and imshow methods use the corresponding matplotlib axes
- methods to draw on the map.
-
- The transform_scalar method can be used to interpolate regular
- lat/lon grids of scalar data to native map projection grids.
-
- The transform_vector method can be used to interpolate and rotate
- regular lat/lon grids of vector data to native map projection grids.
-
- The rotate_vector method rotates a vector field from lat/lon
- coordinates into map projections coordinates, without doing any
- interpolation.
-
- The readshapefile method can be used to read in data from ESRI
- shapefiles.
-
- The drawgreatcircle method draws great circles on the map.
-""" % locals()
-
-# unsupported projection error message.
-_unsupported_projection = ["'%s' is an unsupported projection.\n"]
-_unsupported_projection.append("The supported projections are:\n")
-_unsupported_projection.append(supported_projections)
-_unsupported_projection = ''.join(_unsupported_projection)
-
-def _validated_ll(param, name, minval, maxval):
- param = float(param)
- if param > maxval or param < minval:
- raise ValueError('%s must be between %f and %f degrees' %
- (name, minval, maxval))
- return param
-
-def _insert_validated(d, param, name, minval, maxval):
- if param is not None:
- d[name] = _validated_ll(param, name, minval, maxval)
-
-class Basemap(object):
- """
- Class for plotting data on map projections with matplotlib.
- See __init__ docstring for details on how to create a class
- instance for a given map projection.
-
- Useful instance variables:
-
- projection - map projection. Print the module variable
- "supported_projections" to see a list.
- aspect - map aspect ratio (size of y dimension / size of x dimension).
- llcrnrlon - longitude of lower left hand corner of the desired map domain.
- llcrnrlon - latitude of lower left hand corner of the desired map domain.
- urcrnrlon - longitude of upper right hand corner of the desired map domain.
- urcrnrlon - latitude of upper right hand corner of the desired map domain.
- llcrnrx,llcrnry,urcrnrx,urcrnry - corners of map domain in projection coordinates.
- rmajor,rminor - equatorial and polar radii of ellipsoid used (in meters).
- resolution - resolution of boundary dataset being used ('c' for crude,
- 'l' for low, etc.). If None, no boundary dataset is associated with the
- Basemap instance.
- srs - a string representing the 'spatial reference system' for the map
- projection as defined by PROJ.4.
-
- Example Usage:
-
- >>> from mpl_toolkits.basemap import Basemap
- >>> import numpy as np
- >>> import matplotlib.pyplot as plt
- >>> import matplotlib.mlab as mlab
- >>> # read in topo data (on a regular lat/lon grid)
- >>> etopo = mlab.load('etopo20data.gz')
- >>> lons = mlab.load('etopo20lons.gz')
- >>> lats = mlab.load('etopo20lats.gz')
- >>> # create Basemap instance for Robinson projection.
- >>> m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1]))
- >>> # compute native map projection coordinates for lat/lon grid.
- >>> x, y = m(*np.meshgrid(lons,lats))
- >>> # make filled contour plot.
- >>> cs = m.contourf(x,y,etopo,30,cmap=plt.cm.jet)
- >>> m.drawcoastlines() # draw coastlines
- >>> m.drawmapboundary() # draw a line around the map region
- >>> m.drawparallels(np.arange(-90.,120.,30.),labels=[1,0,0,0]) # draw parallels
- >>> m.drawmeridians(np.arange(0.,420.,60.),labels=[0,0,0,1]) # draw meridians
- >>> plt.title('Robinson Projection') # add a title
- >>> plt.show()
-
- [this example (simpletest.py) plus many others can be found in the
- examples directory of source distribution. The "OO" version of this
- example (which does not use pylab) is called "simpletest_oo.py".]
- """
-
- def __init__(self, llcrnrlon=None, llcrnrlat=None,
- urcrnrlon=None, urcrnrlat=None,
- llcrnrx=None, llcrnry=None,
- urcrnrx=None, urcrnry=None,
- width=None, height=None,
- projection='cyl', resolution='c',
- area_thresh=None, rsphere=6370997.0,
- lat_ts=None,
- lat_1=None, lat_2=None,
- lat_0=None, lon_0=None,
- lon_1=None, lon_2=None,
- no_rot=False,
- suppress_ticks=True,
- satellite_height=35786000,
- boundinglat=None,
- anchor='C',
- ax=None):
- # docstring is added after __init__ method definition
-
- # where to put plot in figure (default is 'C' or center)
- self.anchor = anchor
- # map projection.
- self.projection = projection
-
- # set up projection parameter dict.
- projparams = {}
- projparams['proj'] = projection
- try:
- if rsphere[0] > rsphere[1]:
- projparams['a'] = rsphere[0]
- projparams['b'] = rsphere[1]
- else:
- projparams['a'] = rsphere[1]
- projparams['b'] = rsphere[0]
- except:
- if projection == 'tmerc':
- # use bR_a instead of R because of obscure bug
- # in proj4 for tmerc projection.
- projparams['bR_a'] = rsphere
- else:
- projparams['R'] = rsphere
- # set units to meters.
- projparams['units']='m'
- # check for sane values of lon_0, lat_0, lat_ts, lat_1, lat_2
- _insert_validated(projparams, lat_0, 'lat_0', -90, 90)
- _insert_validated(projparams, lat_1, 'lat_1', -90, 90)
- _insert_validated(projparams, lat_2, 'lat_2', -90, 90)
- _insert_validated(projparams, lat_ts, 'lat_ts', -90, 90)
- _insert_validated(projparams, lon_0, 'lon_0', -360, 720)
- _insert_validated(projparams, lon_1, 'lon_1', -360, 720)
- _insert_validated(projparams, lon_2, 'lon_2', -360, 720)
- if projection == 'geos':
- projparams['h'] = satellite_height
- # check for sane values of projection corners.
- using_corners = (None not in [llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat])
- if using_corners:
- self.llcrnrlon = _validated_ll(llcrnrlon, 'llcrnrlon', -360, 720)
- self.urcrnrlon = _validated_ll(urcrnrlon, 'urcrnrlon', -360, 720)
- self.llcrnrlat = _validated_ll(llcrnrlat, 'llcrnrlat', -90, 90)
- self.urcrnrlat = _validated_ll(urcrnrlat, 'urcrnrlat', -90, 90)
-
- # for each of the supported projections,
- # compute lat/lon of domain corners
- # and set values in projparams dict as needed.
-
- if projection in ['lcc', 'eqdc', 'aea']:
- # if lat_0 is given, but not lat_1,
- # set lat_1=lat_0
- if lat_1 is None and lat_0 is not None:
- lat_1 = lat_0
- projparams['lat_1'] = lat_1
- if lat_1 is None or lon_0 is None:
- raise ValueError('must specify lat_1 or lat_0 and lon_0 for %s basemap (lat_2 is optional)' % _projnames[projection])
- if lat_2 is None:
- projparams['lat_2'] = lat_1
- if not using_corners:
- if width is None or height is None:
- raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters'
- if lon_0 is None or lat_0 is None:
- raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region'
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams)
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection == 'stere':
- if lat_0 is None or lon_0 is None:
- raise ValueError, 'must specify lat_0 and lon_0 for Stereographic basemap (lat_ts is optional)'
- if not using_corners:
- if width is None or height is None:
- raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters'
- if lon_0 is None or lat_0 is None:
- raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region'
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams)
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection in ['spstere', 'npstere',
- 'splaea', 'nplaea',
- 'spaeqd', 'npaeqd']:
- if boundinglat is None or lon_0 is None:
- raise ValueError('must specify boundinglat and lon_0 for %s basemap' % _projnames[projection])
- if projection[0] == 's':
- sgn = -1
- else:
- sgn = 1
- rootproj = projection[2:]
- projparams['proj'] = rootproj
- if rootproj == 'stere':
- projparams['lat_ts'] = sgn * 90.
- projparams['lat_0'] = sgn * 90.
- self.llcrnrlon = lon_0 - sgn*45.
- self.urcrnrlon = lon_0 + sgn*135.
- proj = pyproj.Proj(projparams)
- x,y = proj(lon_0,boundinglat)
- lon,self.llcrnrlat = proj(math.sqrt(2.)*y,0.,inverse=True)
- self.urcrnrlat = self.llcrnrlat
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % _projnames[projection]
- elif projection == 'laea':
- if lat_0 is None or lon_0 is None:
- raise ValueError, 'must specify lat_0 and lon_0 for Lambert Azimuthal basemap'
- if not using_corners:
- if width is None or height is None:
- raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters'
- if lon_0 is None or lat_0 is None:
- raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region'
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams)
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection == 'merc':
- if lat_ts is None:
- raise ValueError, 'must specify lat_ts for Mercator basemap'
- # clip plot region to be within -89.99S to 89.99N
- # (mercator is singular at poles)
- if not using_corners:
- llcrnrlon = -180.
- llcrnrlat = -90.
- urcrnrlon = 180
- urcrnrlat = 90.
- if llcrnrlat < -89.99: llcrnrlat = -89.99
- if llcrnrlat > 89.99: llcrnrlat = 89.99
- if urcrnrlat < -89.99: urcrnrlat = -89.99
- if urcrnrlat > 89.99: urcrnrlat = 89.99
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % self.projection
- elif projection in ['tmerc','gnom','cass','poly'] :
- if lat_0 is None or lon_0 is None:
- raise ValueError, 'must specify lat_0 and lon_0 for Transverse Mercator, Gnomonic, Cassini-Soldnerr Polyconic basemap'
- if not using_corners:
- if width is None or height is None:
- raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters'
- if lon_0 is None or lat_0 is None:
- raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region'
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams)
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection == 'ortho':
- if not projparams.has_key('R'):
- raise ValueError, 'orthographic projection only works for perfect spheres - not ellipsoids'
- if lat_0 is None or lon_0 is None:
- raise ValueError, 'must specify lat_0 and lon_0 for Orthographic basemap'
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % self.projection
- if not using_corners:
- llcrnrlon = -180.
- llcrnrlat = -90.
- urcrnrlon = 180
- urcrnrlat = 90.
- self._fulldisk = True
- else:
- self._fulldisk = False
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- # FIXME: won't work for points exactly on equator??
- if np.abs(lat_0) < 1.e-2: lat_0 = 1.e-2
- projparams['lat_0'] = lat_0
- elif projection == 'geos':
- if lon_0 is None:
- raise ValueError, 'must specify lon_0 for Geostationary basemap'
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % self.projection
- if not using_corners:
- llcrnrlon = -180.
- llcrnrlat = -90.
- urcrnrlon = 180
- urcrnrlat = 90.
- self._fulldisk = True
- else:
- self._fulldisk = False
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection in ['moll','robin','sinu']:
- if lon_0 is None:
- raise ValueError, 'must specify lon_0 for Robinson, Mollweide, or Sinusoidal basemap'
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % self.projection
- llcrnrlon = -180.
- llcrnrlat = -90.
- urcrnrlon = 180
- urcrnrlat = 90.
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection == 'omerc':
- if lat_1 is None or lon_1 is None or lat_2 is None or lon_2 is None:
- raise ValueError, 'must specify lat_1,lon_1 and lat_2,lon_2 for Oblique Mercator basemap'
- projparams['lat_1'] = lat_1
- projparams['lon_1'] = lon_1
- projparams['lat_2'] = lat_2
- projparams['lon_2'] = lon_2
- projparams['lat_0'] = lat_0
- if no_rot:
- projparams['no_rot']=''
- #if not using_corners:
- # raise ValueError, 'cannot specify map region with width and height keywords for this projection, please specify lat/lon values of corners'
- if not using_corners:
- if width is None or height is None:
- raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters'
- if lon_0 is None or lat_0 is None:
- raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region'
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams)
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection == 'aeqd':
- if lat_0 is None or lon_0 is None:
- raise ValueError, 'must specify lat_0 and lon_0 for Azimuthal Equidistant basemap'
- if not using_corners:
- if width is None or height is None:
- raise ValueError, 'must either specify lat/lon values of corners (llcrnrlon,llcrnrlat,ucrnrlon,urcrnrlat) in degrees or width and height in meters'
- if lon_0 is None or lat_0 is None:
- raise ValueError, 'must specify lon_0 and lat_0 when using width, height to specify projection region'
- llcrnrlon,llcrnrlat,urcrnrlon,urcrnrlat = _choosecorners(width,height,**projparams)
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- elif projection == 'mill':
- if not using_corners:
- llcrnrlon = -180.
- llcrnrlat = -90.
- urcrnrlon = 180
- urcrnrlat = 90.
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % self.projection
- elif projection == 'cyl':
- if not using_corners:
- llcrnrlon = -180.
- llcrnrlat = -90.
- urcrnrlon = 180
- urcrnrlat = 90.
- self.llcrnrlon = llcrnrlon; self.llcrnrlat = llcrnrlat
- self.urcrnrlon = urcrnrlon; self.urcrnrlat = urcrnrlat
- if width is not None or height is not None:
- print 'warning: width and height keywords ignored for %s projection' % self.projection
- else:
- raise ValueError(_unsupported_projection % projection)
-
- # initialize proj4
- proj = Proj(projparams,self.llcrnrlon,self.llcrnrlat,self.urcrnrlon,self.urcrnrlat)
-
- # make sure axis ticks are suppressed.
- self.noticks = suppress_ticks
-
- # make Proj instance a Basemap instance variable.
- self.projtran = proj
- # copy some Proj attributes.
- atts = ['rmajor','rminor','esq','flattening','ellipsoid','projparams']
- for att in atts:
- self.__dict__[att] = proj.__dict__[att]
- # these only exist for geostationary projection.
- if hasattr(proj,'_width'):
- self.__dict__['_width'] = proj.__dict__['_width']
- if hasattr(proj,'_height'):
- self.__dict__['_height'] = proj.__dict__['_height']
- # spatial reference string (useful for georeferencing output
- # images with gdal_translate).
- if hasattr(self,'_proj4'):
- self.srs = proj._proj4.srs
- else:
- pjargs = []
- for key,value in self.projparams.iteritems():
- # 'cyl' projection translates to 'eqc' in PROJ.4
- if projection == 'cyl' and key == 'proj':
- value = 'eqc'
- # ignore x_0 and y_0 settings for 'cyl' projection
- # (they are not consistent with what PROJ.4 uses)
- elif projection == 'cyl' and key in ['x_0','y_0']:
- continue
- pjargs.append('+'+key+"="+str(value)+' ')
- self.srs = ''.join(pjargs)
- # set instance variables defining map region.
- self.xmin = proj.xmin
- self.xmax = proj.xmax
- self.ymin = proj.ymin
- self.ymax = proj.ymax
- if projection == 'cyl':
- self.aspect = (self.urcrnrlat-self.llcrnrlat)/(self.urcrnrlon-self.llcrnrlon)
- else:
- self.aspect = (proj.ymax-proj.ymin)/(proj.xmax-proj.xmin)
- if projection in ['geos','ortho'] and \
- None not in [llcrnrx,llcrnry,urcrnrx,urcrnry]:
- self.llcrnrx = llcrnrx+0.5*proj.xmax
- self.llcrnry = llcrnry+0.5*proj.ymax
- self.urcrnrx = urcrnrx+0.5*proj.xmax
- self.urcrnry = urcrnry+0.5*proj.ymax
- self._fulldisk = False
- else:
- self.llcrnrx = proj.llcrnrx
- self.llcrnry = proj.llcrnry
- self.urcrnrx = proj.urcrnrx
- self.urcrnry = proj.urcrnry
- # set min/max lats for projection domain.
- if projection in ['mill','cyl','merc']:
- self.latmin = self.llcrnrlat
- self.latmax = self.urcrnrlat
- elif projection in ['ortho','geos','moll','robin','sinu']:
- self.latmin = -90.
- self.latmax = 90.
- else:
- lons, lats = self.makegrid(101,101)
- self.latmin = lats.min()
- self.latmax = lats.max()
-
- # if ax == None, pyplot.gca may be used.
- self.ax = ax
- self.lsmask = None
-
- # set defaults for area_thresh.
- self.resolution = resolution
- if area_thresh is None and resolution is not None:
- if resolution == 'c':
- area_thresh = 10000.
- elif resolution == 'l':
- area_thresh = 1000.
- elif resolution == 'i':
- area_thresh = 100.
- elif resolution == 'h':
- area_thresh = 10.
- elif resolution == 'f':
- area_thresh = 1.
- else:
- raise ValueError, "boundary resolution must be one of 'c','l','i','h' or 'f'"
- self.area_thresh = area_thresh
- # define map boundary polygon (in lat/lon coordinates)
- self._boundarypolyll, self._boundarypolyxy = self._getmapboundary()
- # read in coastline polygons, only keeping those that
- # intersect map boundary polygon.
- if self.resolution is not None:
- self.coastsegs, self.coastpolygontypes = self._readboundarydata('gshhs')
- # reformat for use in matplotlib.patches.Polygon.
- self.coastpolygons = []
- # also, split coastline segments that jump across entire plot.
- coastsegs = []
- for seg in self.coastsegs:
- x, y = zip(*seg)
- self.coastpolygons.append((x,y))
- x = np.array(x,np.float64); y = np.array(y,np.float64)
- xd = (x[1:]-x[0:-1])**2
- yd = (y[1:]-y[0:-1])**2
- dist = np.sqrt(xd+yd)
- split = dist > 5000000.
- if np.sum(split) and self.projection not in ['merc','cyl','mill']:
- ind = (np.compress(split,np.squeeze(split*np.indices(xd.shape)))+1).tolist()
- iprev = 0
- ind.append(len(xd))
- for i in ind:
- # don't add empty lists.
- if len(range(iprev,i)):
- coastsegs.append(zip(x[iprev:i],y[iprev:i]))
- iprev = i
- else:
- coastsegs.append(seg)
- self.coastsegs = coastsegs
- # set __init__'s docstring
- __init__.__doc__ = _Basemap_init_doc
-
- def __call__(self,x,y,inverse=False):
- """
- Calling a Basemap class instance with the arguments lon, lat will
- convert lon/lat (in degrees) to x/y native map projection
- coordinates (in meters). If optional keyword 'inverse' is
- True (default is False), the inverse transformation from x/y
- to lon/lat is performed.
-
- For cylindrical equidistant projection ('cyl'), this
- does nothing (i.e. x,y == lon,lat).
-
- For non-cylindrical projections, the inverse transformation
- always returns longitudes between -180 and 180 degrees. For
- cylindrical projections (self.projection == 'cyl','mill' or 'merc')
- the inverse transformation will return longitudes between
- self.llcrnrlon and self.llcrnrlat.
-
- input arguments lon, lat can be either scalar floats or N arrays.
- """
- return self.projtran(x,y,inverse=inverse)
-
- def makegrid(self,nx,ny,returnxy=False):
- """
- return arrays of shape (ny,nx) containing lon,lat coordinates of
- an equally spaced native projection grid.
- if returnxy = True, the x,y values of the grid are returned also.
- """
- return self.projtran.makegrid(nx,ny,returnxy=returnxy)
-
- def _readboundarydata(self,name):
- """
- read boundary data, clip to map projection region.
- """
- msg = dedent("""
- Unable to open boundary dataset file. Only the 'crude', 'low',
- 'intermediate' and 'high' resolution datasets are installed by default.
- If you are requesting a 'full' resolution dataset, you may need to
- download and install those files separately
- (see the basemap README for details).""")
- try:
- bdatfile = open(os.path.join(basemap_datadir,name+'_'+self.resolution+'.dat'),'rb')
- bdatmetafile = open(os.path.join(basemap_datadir,name+'meta_'+self.resolution+'.dat'),'r')
- except:
- raise IOError, msg
- polygons = []
- polygon_types = []
- # coastlines are polygons, other boundaries are line segments.
- if name == 'gshhs':
- Shape = _geoslib.Polygon
- else:
- Shape = _geoslib.LineString
- # see if map projection region polygon contains a pole.
- NPole = _geoslib.Point(self(0.,90.))
- SPole = _geoslib.Point(self(0.,-90.))
- boundarypolyxy = self._boundarypolyxy
- boundarypolyll = self._boundarypolyll
- hasNP = NPole.within(boundarypolyxy)
- hasSP = SPole.within(boundarypolyxy)
- containsPole = hasNP or hasSP
- # these projections cannot cross pole.
- if containsPole and\
- self.projection in ['merc','mill','cyl','robin','moll','sinu','geos']:
- #self.projection in ['tmerc','omerc','cass','merc','mill','cyl','robin','moll','sinu','geos']:
- raise ValueError('%s projection cannot cross pole'%(self.projection))
- # make sure orthographic projection has containsPole=True
- # we will compute the intersections in stereographic
- # coordinates, then transform to orthographic.
- if self.projection == 'ortho' and name == 'gshhs':
- containsPole = True
- lon_0=self.projparams['lon_0']
- lat_0=self.projparams['lat_0']
- re = self.projparams['R']
- # center of stereographic projection restricted to be
- # nearest one of 6 points on the sphere (every 90 deg lat/lon).
- lon0 = 90.*(np.around(lon_0/90.))
- lat0 = 90.*(np.around(lat_0/90.))
- if np.abs(int(lat0)) == 90: lon0=0.
- maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat_0=lat0,R=re)
- # boundary polygon for orthographic projection
- # in stereographic coorindates.
- b = self._boundarypolyll.boundary
- blons = b[:,0]; blats = b[:,1]
- b[:,0], b[:,1] = maptran(blons, blats)
- boundarypolyxy = _geoslib.Polygon(b)
- for line in bdatmetafile:
- linesplit = line.split()
- area = float(linesplit[1])
- south = float(linesplit[3])
- north = float(linesplit[4])
- if area < 0.: area = 1.e30
- useit = self.latmax>=south and self.latmin<=north and area>self.area_thresh
- if useit:
- type = int(linesplit[0])
- npts = int(linesplit[2])
- offsetbytes = int(linesplit[5])
- bytecount = int(linesplit[6])
- bdatfile.seek(offsetbytes,0)
- # read in binary string convert into an npts by 2
- # numpy array (first column is lons, second is lats).
- polystring = bdatfile.read(bytecount)
- # binary data is little endian.
- b = np.array(np.fromstring(polystring,dtype='<f4'),'f8')
- b.shape = (npts,2)
- b2 = b.copy()
- # if map boundary polygon is a valid one in lat/lon
- # coordinates (i.e. it does not contain either pole),
- # the intersections of the boundary geometries
- # and the map projection region can be computed before
- # transforming the boundary geometry to map projection
- # coordinates (this saves time, especially for small map
- # regions and high-resolution boundary geometries).
- if not containsPole:
- # close Antarctica.
- if name == 'gshhs' and south < -68 and area > 10000:
- lons = b[:,0]
- lats = b[:,1]
- lons2 = lons[:-2][::-1]
- lats2 = lats[:-2][::-1]
- lons1 = lons2 - 360.
- lons3 = lons2 + 360.
- lons = lons1.tolist()+lons2.tolist()+lons3.tolist()
- lats = lats2.tolist()+lats2.tolist()+lats2.tolist()
- lonstart,latstart = lons[0], lats[0]
- lonend,latend = lons[-1], lats[-1]
- lons.insert(0,lonstart)
- lats.insert(0,-90.)
- lons.append(lonend)
- lats.append(-90.)
- b = np.empty((len(lons),2),np.float64)
- b[:,0] = lons; b[:,1] = lats
- poly = _geoslib.Polygon(b)
- antart = True
- else:
- poly = Shape(b)
- antart = False
- # create duplicate polygons shifted by -360 and +360
- # (so as to properly treat polygons that cross
- # Greenwich meridian).
- if not antart:
- b2[:,0] = b[:,0]-360
- poly1 = Shape(b2)
- b2[:,0] = b[:,0]+360
- poly2 = Shape(b2)
- polys = [poly1,poly,poly2]
- else: # Antartica already extends from -360 to +720.
- polys = [poly]
- for poly in polys:
- # if polygon instersects map projection
- # region, process it.
- if poly.intersects(boundarypolyll):
- # if geometry intersection calculation fails,
- # just move on.
- try:
- geoms = poly.intersection(boundarypolyll)
- except:
- continue
- # iterate over geometries in intersection.
- for psub in geoms:
- # only coastlines are polygons,
- # which have a 'boundary' attribute.
- # otherwise, use 'coords' attribute
- # to extract coordinates.
- b = psub.boundary
- blons = b[:,0]; blats = b[:,1]
- # transformation from lat/lon to
- # map projection coordinates.
- bx, by = self(blons, blats)
- polygons.append(zip(bx,by))
- polygon_types.append(type)
- # if map boundary polygon is not valid in lat/lon
- # coordinates, compute intersection between map
- # projection region and boundary geometries in map
- # projection coordinates.
- else:
- # transform coordinates from lat/lon
- # to map projection coordinates.
- # special case for ortho, compute coastline polygon
- # vertices in stereographic coords.
- if name == 'gshhs' and self.projection == 'ortho':
- b[:,0], b[:,1] = maptran(b[:,0], b[:,1])
- else:
- b[:,0], b[:,1] = self(b[:,0], b[:,1])
- goodmask = np.logical_and(b[:,0]<1.e20,b[:,1]<1.e20)
- # if less than two points are valid in
- # map proj coords, skip this geometry.
- if np.sum(goodmask) <= 1: continue
- if name != 'gshhs':
- # if not a polygon,
- # just remove parts of geometry that are undefined
- # in this map projection.
- bx = np.compress(goodmask, b[:,0])
- by = np.compress(goodmask, b[:,1])
- # for orthographic projection, all points
- # outside map projection region are eliminated
- # with the above step, so we're done.
- if self.projection == 'ortho':
- polygons.append(zip(bx,by))
- polygon_types.append(type)
- continue
- # create a GEOS geometry object.
- poly = Shape(b)
- # if geometry instersects map projection
- # region, and doesn't have any invalid points, process it.
- if goodmask.all() and poly.intersects(boundarypolyxy):
- # if geometry intersection calculation fails,
- # just move on.
- try:
- geoms = poly.intersection(boundarypolyxy)
- except:
- continue
- # iterate over geometries in intersection.
- for psub in geoms:
- b = psub.boundary
- # if projection == 'ortho',
- # transform polygon from stereographic
- # to orthographic coordinates.
- if self.projection == 'ortho':
- # if coastline polygon covers more than 99%
- # of map region for fulldisk projection,
- # it's probably bogus, so skip it.
- areafrac = psub.area()/boundarypolyxy.area()
- if name == 'gshhs' and\
- self._fulldisk and\
- areafrac > 0.99: continue
- # inverse transform from stereographic
- # to lat/lon.
- b[:,0], b[:,1] = maptran(b[:,0], b[:,1], inverse=True)
- # orthographic.
- b[:,0], b[:,1]= self(b[:,0], b[:,1])
- polygons.append(zip(b[:,0],b[:,1]))
- polygon_types.append(type)
- return polygons, polygon_types
-
- def _getmapboundary(self):
- """
- create map boundary polygon (in lat/lon and x/y coordinates)
- """
- nx = 100
- ny = 100
- maptran = self
- if self.projection in ['ortho','geos']:
- # circular region.
- thetas = np.linspace(0.,2.*np.pi,2*nx*ny)[:-1]
- if self.projection == 'ortho':
- rminor = self.rmajor
- rmajor = self.rmajor
- else:
- rminor = self._height
- rmajor = self._width
- x = rmajor*np.cos(thetas) + rmajor
- y = rminor*np.sin(thetas) + rminor
- b = np.empty((len(x),2),np.float64)
- b[:,0]=x; b[:,1]=y
- boundaryxy = _geoslib.Polygon(b)
- # compute proj instance for full disk, if necessary.
- if not self._fulldisk:
- projparms = self.projparams.copy()
- del projparms['x_0']
- del projparms['y_0']
- if self.projection == 'ortho':
- llcrnrx = -self.rmajor
- llcrnry = -self.rmajor
- urcrnrx = -llcrnrx
- urcrnry = -llcrnry
- else:
- llcrnrx = -self._width
- llcrnry = -self._height
- urcrnrx = -llcrnrx
- urcrnry = -llcrnry
- projparms['x_0']=-llcrnrx
- projparms['y_0']=-llcrnry
- maptran = pyproj.Proj(projparms)
- elif self.projection in ['moll','robin','sinu']:
- # quasi-elliptical region.
- lon_0 = self.projparams['lon_0']
- # left side
- lats1 = np.linspace(-89.9,89.9,ny).tolist()
- lons1 = len(lats1)*[lon_0-179.9]
- # top.
- lons2 = np.linspace(lon_0-179.9,lon_0+179.9,nx).tolist()
- lats2 = len(lons2)*[89.9]
- # right side
- lats3 = np.linspace(89.9,-89.9,ny).tolist()
- lons3 = len(lats3)*[lon_0+179.9]
- # bottom.
- lons4 = np.linspace(lon_0+179.9,lon_0-179.9,nx).tolist()
- lats4 = len(lons4)*[-89.9]
- lons = np.array(lons1+lons2+lons3+lons4,np.float64)
- lats = np.array(lats1+lats2+lats3+lats4,np.float64)
- x, y = maptran(lons,lats)
- b = np.empty((len(x),2),np.float64)
- b[:,0]=x; b[:,1]=y
- boundaryxy = _geoslib.Polygon(b)
- else: # all other projections are rectangular.
- # left side (x = xmin, ymin <= y <= ymax)
- yy = np.linspace(self.ymin, self.ymax, ny)[:-1]
- x = len(yy)*[self.xmin]; y = yy.tolist()
- # top (y = ymax, xmin <= x <= xmax)
- xx = np.linspace(self.xmin, self.xmax, nx)[:-1]
- x = x + xx.tolist()
- y = y + len(xx)*[self.ymax]
- # right side (x = xmax, ymin <= y <= ymax)
- yy = np.linspace(self.ymax, self.ymin, ny)[:-1]
- x = x + len(yy)*[self.xmax]; y = y + yy.tolist()
- # bottom (y = ymin, xmin <= x <= xmax)
- xx = np.linspace(self.xmax, self.xmin, nx)[:-1]
- x = x + xx.tolist()
- y = y + len(xx)*[self.ymin]
- x = np.array(x,np.float64)
- y = np.array(y,np.float64)
- b = np.empty((4,2),np.float64)
- b[:,0]=[self.xmin,self.xmin,self.xmax,self.xmax]
- b[:,1]=[self.ymin,self.ymax,self.ymax,self.ymin]
- boundaryxy = _geoslib.Polygon(b)
- if self.projection in ['mill','merc','cyl']:
- # make sure map boundary doesn't quite include pole.
- if self.urcrnrlat > 89.9999:
- urcrnrlat = 89.9999
- else:
- urcrnrlat = self.urcrnrlat
- if self.llcrnrlat < -89.9999:
- llcrnrlat = -89.9999
- else:
- llcrnrlat = self.llcrnrlat
- lons = [self.llcrnrlon, self.llcrnrlon, self.urcrnrlon, self.urcrnrlon]
- lats = [llcrnrlat, urcrnrlat, urcrnrlat, llcrnrlat]
- x, y = self(lons, lats)
- b = np.empty((len(x),2),np.float64)
- b[:,0]=x; b[:,1]=y
- boundaryxy = _geoslib.Polygon(b)
- else:
- if self.projection not in ['moll','robin','sinu']:
- lons, lats = maptran(x,y,inverse=True)
- # fix lons so there are no jumps.
- n = 1
- lonprev = lons[0]
- for lon,lat in zip(lons[1:],lats[1:]):
- if np.abs(lon-lonprev) > 90.:
- if lonprev < 0:
- lon = lon - 360.
- else:
- lon = lon + 360
- lons[n] = lon
- lonprev = lon
- n = n + 1
- b = np.empty((len(lons),2),np.float64)
- b[:,0]=lons; b[:,1]=lats
- boundaryll = _geoslib.Polygon(b)
- return boundaryll, boundaryxy
-
-
- def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
- zorder=None,ax=None):
- """
- draw boundary around map projection region, optionally
- filling interior of region.
-
- linewidth - line width for boundary (default 1.)
- color - color of boundary line (default black)
- fill_color - fill the map region background with this
- color (default is no fill or fill with axis background color).
- zorder - sets the zorder for filling map background
- (default 0).
- ax - axes instance to use (default None, use default axes
- instance).
- returns PatchCollection representing map boundary.
- """
- # get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
- limb = None
- if self.projection == 'ortho':
- limb = Circle((self.rmajor,self.rmajor),self.rmajor)
- elif self.projection == 'geos':
- limb = Ellipse((self._width,self._height),2.*self._width,2.*self._height)
- if self.projection in ['ortho','geos'] and self._fulldisk:
- # elliptical region.
- ax.add_patch(limb)
- if fill_color is None:
- limb.set_fill(False)
- else:
- limb.set_facecolor(fill_color)
- limb.set_zorder(0)
- limb.set_edgecolor(color)
- limb.set_linewidth(linewidth)
- limb.set_clip_on(False)
- if zorder is not None:
- limb.set_zorder(zorder)
- elif self.projection in ['moll','robin','sinu']: # elliptical region.
- nx = 100; ny = 100
- # quasi-elliptical region.
- lon_0 = self.projparams['lon_0']
- # left side
- lats1 = np.linspace(-89.9,89.9,ny).tolist()
- lons1 = len(lats1)*[lon_0-179.9]
- # top.
- lons2 = np.linspace(lon_0-179.9,lon_0+179.9,nx).tolist()
- lats2 = len(lons2)*[89.9]
- # right side
- lats3 = np.linspace(89.9,-89.9,ny).tolist()
- lons3 = len(lats3)*[lon_0+179.9]
- # bottom.
- lons4 = np.linspace(lon_0+179.9,lon_0-179.9,nx).tolist()
- lats4 = len(lons4)*[-89.9]
- lons = np.array(lons1+lons2+lons3+lons4,np.float64)
- lats = np.array(lats1+lats2+lats3+lats4,np.float64)
- x, y = self(lons,lats)
- xy = zip(x,y)
- limb = Polygon(xy,edgecolor=color,linewidth=linewidth)
- ax.add_patch(limb)
- if fill_color is None:
- limb.set_fill(False)
- else:
- limb.set_facecolor(fill_color)
- limb.set_zorder(0)
- limb.set_clip_on(False)
- if zorder is not None:
- limb.set_zorder(zorder)
- else: # all other projections are rectangular.
- ax.axesPatch.set_linewidth(linewidth)
- if self.projection not in ['geos','ortho']:
- if fill_color is None:
- ax.axesPatch.set_facecolor(ax.get_axis_bgcolor())
- else:
- ax.axesPatch.set_facecolor(fill_color)
- ax.axesPatch.set_zorder(0)
- ax.axesPatch.set_edgecolor(color)
- ax.set_frame_on(True)
- if zorder is not None:
- ax.axesPatch.set_zorder(zorder)
- else:
- ax.axesPatch.set_facecolor(ax.get_axis_bgcolor())
- ax.axesPatch.set_edgecolor(color)
- ax.set_frame_on(True)
- if zorder is not None:
- ax.axesPatch.set_zorder(zorder)
- # for geos or ortho projections, also
- # draw and fill map projection limb, clipped
- # to rectangular region.
- ax.add_patch(limb)
- if fill_color is None:
- limb.set_fill(False)
- else:
- limb.set_facecolor(fill_color)
- limb.set_zorder(0)
- limb.set_edgecolor(color)
- limb.set_linewidth(linewidth)
- if zorder is not None:
- limb.set_zorder(zorder)
- limb.set_clip_on(True)
- # set axes limits to fit map region.
- self.set_axes_limits(ax=ax)
- return limb
-
- def fillcontinents(self,color='0.8',lake_color=None,ax=None,zorder=None):
- """
- Fill continents.
-
- color - color to fill continents (default gray).
- lake_color - color to fill inland lakes (default axes background).
- ax - axes instance (overrides default axes instance).
- zorder - sets the zorder for the continent polygons (if not specified,
- uses default zorder for a Polygon patch). Set to zero if you want to paint
- over the filled continents).
-
- After filling continents, lakes are re-filled with axis background color.
-
- returns Polygon object.
- """
- if self.resolution is None:
- raise AttributeError, 'there are no boundary datasets associated with this Basemap instance'
- # get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
- # get axis background color.
- axisbgc = ax.get_axis_bgcolor()
- npoly = 0
- for x,y in self.coastpolygons:
- xa = np.array(x,np.float32)
- ya = np.array(y,np.float32)
- # check to see if all four corners of domain in polygon (if so,
- # don't draw since it will just fill in the whole map).
- delx = 10; dely = 10
- if self.projection in ['cyl']:
- delx = 0.1
- dely = 0.1
- test1 = np.fabs(xa-self.urcrnrx) < delx
- test2 = np.fabs(xa-self.llcrnrx) < delx
- test3 = np.fabs(ya-self.urcrnry) < dely
- test4 = np.fabs(ya-self.llcrnry) < dely
- hasp1 = np.sum(test1*test3)
- hasp2 = np.sum(test2*test3)
- hasp4 = np.sum(test2*test4)
- hasp3 = np.sum(test1*test4)
- if not hasp1 or not hasp2 or not ...
[truncated message content] |
|
From: <js...@us...> - 2008-06-15 11:57:54
|
Revision: 5546
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5546&view=rev
Author: jswhit
Date: 2008-06-15 04:57:51 -0700 (Sun, 15 Jun 2008)
Log Message:
-----------
finished cleanup of docstrings so sphinx-generated API docs look nice.
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-06-14 21:14:34 UTC (rev 5545)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-15 11:57:51 UTC (rev 5546)
@@ -2391,6 +2391,8 @@
(see matplotlib.pyplot.scatter documentation).
Extra keyword ``ax`` can be used to override the default axes instance.
+
+ Other \**kwargs passed on to matplotlib.pyplot.scatter.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2427,6 +2429,8 @@
(see matplotlib.pyplot.plot documentation).
Extra keyword ``ax`` can be used to override the default axis instance.
+
+ Other \**kwargs passed on to matplotlib.pyplot.plot.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2466,6 +2470,8 @@
will be drawn over map region.
Extra keyword ``ax`` can be used to override the default axis instance.
+
+ Other \**kwargs passed on to matplotlib.pyplot.plot.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2507,15 +2513,16 @@
def pcolor(self,x,y,data,**kwargs):
"""
- Make a pseudo-color plot over the map.
+ Make a pseudo-color plot over the map
+ (see matplotlib.pyplot.pcolor documentation).
- see matplotlib.pyplot.pcolor documentation for definition of \**kwargs
-
If x or y are outside projection limb (i.e. they have values > 1.e20)
they will be convert to masked arrays with those values masked.
As a result, those values will not be plotted.
- extra keyword 'ax' can be used to override the default axis instance.
+ Extra keyword ``ax`` can be used to override the default axis instance.
+
+ Other \**kwargs passed on to matplotlib.pyplot.pcolor.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2557,11 +2564,12 @@
def pcolormesh(self,x,y,data,**kwargs):
"""
- Make a pseudo-color plot over the map.
+ Make a pseudo-color plot over the map
+ (see matplotlib.pyplot.pcolormesh documentation).
- see matplotlib.pyplot.pcolormesh documentation for definition of \**kwargs
+ Extra keyword ``ax`` can be used to override the default axis instance.
- extra keyword 'ax' can be used to override the default axis instance.
+ Other \**kwargs passed on to matplotlib.pyplot.pcolormesh.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2599,9 +2607,12 @@
def contour(self,x,y,data,*args,**kwargs):
"""
- Make a contour plot over the map (see matplotlib.pyplot.contour documentation).
+ Make a contour plot over the map
+ (see matplotlib.pyplot.contour documentation).
- extra keyword 'ax' can be used to override the default axis instance.
+ Extra keyword ``ax`` can be used to override the default axis instance.
+
+ Other \*args and \**kwargs passed on to matplotlib.pyplot.contour.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2666,11 +2677,15 @@
def contourf(self,x,y,data,*args,**kwargs):
"""
- Make a filled contour plot over the map (see matplotlib.pyplot.contourf documentation).
+ Make a filled contour plot over the map
+ (see matplotlib.pyplot.contourf documentation).
+
If x or y are outside projection limb (i.e. they have values > 1.e20),
the corresponing data elements will be masked.
Extra keyword 'ax' can be used to override the default axis instance.
+
+ Other \*args and \**kwargs passed on to matplotlib.pyplot.scatter.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2736,11 +2751,11 @@
def quiver(self, x, y, u, v, *args, **kwargs):
"""
Make a vector plot (u, v) with arrows on the map.
+ (see matplotlib.pyplot.quiver documentation).
- Extra arguments (\*args and \**kwargs) passed to quiver Axes method (see
- matplotlib.pyplot.quiver documentation for details).
+ Extra keyword ``ax`` can be used to override the default axis instance.
- extra keyword 'ax' can be used to override the default axis instance.
+ Other \*args and \**kwargs passed on to matplotlib.pyplot.quiver.
"""
if not kwargs.has_key('ax') and self.ax is None:
try:
@@ -2774,38 +2789,53 @@
def drawlsmask(self,rgba_land,rgba_ocean,lsmask=None,
lsmask_lons=None,lsmask_lats=None,lakes=False,**kwargs):
"""
- draw land-sea mask image.
+ Draw land-sea mask image.
- *Note* the land-sea mask image cannot be overlaid on top
- of other images, due to limitations in matplotlib image handling.
+ .. note::
+ The land-sea mask image cannot be overlaid on top
+ of other images, due to limitations in matplotlib image handling
+ (you can't specify the zorder of an image).
- land is colored with rgba integer tuple rgba_land.
- ocean is colored with rgba integer tuple rgba_ocean.
+ ============== ====================================================
+ Arguments Description
+ ============== ====================================================
+ rgba_land rgba integer tuple that describes desired
+ land color. For example, for green (non-transparent)
+ land areas, use rgba_land = (0,255,0,255).
+ rgba_ocean rgba integer tuple that describes desired
+ ocean color. For example, for blue (non-transparent)
+ ocean areas, use (0,0,255,255). To make transparent
+ blue oceans (useful if you just want to mask land
+ regions over another image), use
+ rgba_ocean = (0,0,255,0).
+ ============== ====================================================
- For example, to color oceans blue and land green, use
- rgba_ocean = (0,0,255,255) and rgba_land = (0,255,0,255).
- To make oceans transparent (useful if you just want to mask land
- regions over another image), use rgba_ocean = (0,0,255,0).
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ lakes If True, inland lakes are also colored with
+ rgba_ocean (default is lakes=False).
+ lsmask An array of 0's for ocean pixels, 1's for
+ land pixels and optionally 2's for inland
+ lake pixels defining a global land-sea mask.
+ Default is None, and default
+ 5-minute resolution land-sea mask is used.
+ lsmask_lons 1d array of longitudes for lsmask (ignored
+ if lsmask is None). Longitudes must be ordered
+ from -180 W eastward.
+ lsmask_lats 1d array of latitudes for lsmask (ignored
+ if lsmask is None). Latitudes must be ordered
+ from -90 S northward.
+ \**kwargs extra keyword arguments passed on to
+ :meth:`imshow`
+ ============== ====================================================
- If lakes=True, inland lakes are also colored with
- rgba_ocean (default is lakes=False).
-
- Default land-sea mask is from
- http://www.ngdc.noaa.gov/ecosys/cdroms/graham/graham/graham.htm
- and has 5-minute resolution.
-
- To specify your own global land-sea mask, set the
- lsmask keyword to a (nlats, nlons) array
- with 0's for ocean pixels, 1's for land pixels and
- optionally 2's for inland lake pixels.
- The lsmask_lons keyword should be a 1-d array
- with the longitudes of the mask, lsmask_lats should be
- a 1-d array with the latitudes. Longitudes should be ordered
- from -180 W eastward, latitudes from -90 S northward.
If any of the lsmask, lsmask_lons or lsmask_lats keywords are not
- set, the default land-sea mask is used.
+ set, the default land-sea mask from
+ http://www.ngdc.noaa.gov/ecosys/cdroms/graham/graham/graham.htm.
+ is used.
- extra keyword 'ax' can be used to override the default axis instance.
+ Extra keyword ``ax`` can be used to override the default axis instance.
"""
# look for axes instance (as keyword, an instance variable
# or from plt.gca().
@@ -2898,15 +2928,17 @@
def warpimage(self,image="bluemarble",**kwargs):
"""
- display an image (given by file keyword) as a background.
+ Display an image (given by ``image`` keyword) as a map background.
- Default (if file not specified) is to display
+ Default (if ``image`` not specified) is to display
'blue marble next generation' image from http://visibleearth.nasa.gov/.
Specified image must have pixels covering the whole globe in a regular
lat/lon grid, starting and -180W and the South Pole.
- extra keyword 'ax' can be used to override the default axis instance.
+ Extra keyword ``ax`` can be used to override the default axis instance.
+
+ \**kwargs passed on to :meth:`imshow`.
"""
try:
from PIL import Image
@@ -2987,36 +3019,36 @@
units='km',fontsize=9,yoffset=None,labelstyle='simple',\
fontcolor='k',fillcolor1='w',fillcolor2='k',ax=None):
"""
- draw a map scale at lon,lat representing distance in the map
- projection coordinates at lon0,lat0.
+ Draw a map scale at ``lon,lat`` of length ``length``
+ representing distance in the map
+ projection coordinates at ``lon0,lat0``.
- The length of the scale
- is specified by the length argument, with units given by the units
- keyword (default 'km').
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ units the units of the length argument (Default km).
+ barstyle ``simple`` or ``fancy`` (roughly corresponding
+ to the styles provided by Generic Mapping Tools).
+ Default ``simple``.
+ fontsize for map scale annotations, default 9.
+ color for map scale annotations, default black.
+ labelstype ``simple`` (default) or ``fancy``. For
+ ``fancy`` the map scale factor (ratio betwee
+ the actual distance and map projection distance
+ at lon0,lat0) and the value of lon0,lat0 are also
+ displayed on the top of the scale bar. For
+ ``simple``, just the units are display on top
+ and the distance below the scale bar.
+ yoffset yoffset controls how tall the scale bar is,
+ and how far the annotations are offset from the
+ scale bar. Default is 0.02 times the height of
+ the map (0.02*(self.ymax-self.ymin)).
+ fillcolor1(2) colors of the alternating filled regions
+ (default white and black). Only relevant for
+ 'fancy' barstyle.
+ ============== ====================================================
- Two styles of scale bar are available
- (specified by the labelstyle keyword) - 'simple' and 'fancy', which
- correspond roughly to the corresponding styles provided by
- the Generic Mapping Tools software. Default is 'simple'.
-
- The fontsize and color of the map scale annotations can be specified
- with the fontsize (default 9) and fontcolor (default black) keywords.
-
- labelstyle='simple' results in basic annotation (the units on top
- of the scalebar and the distance below). This is the default.
- If labelstyle='fancy' the map scale factor (ratio between
- the actual distance and map projection distance at lon0,lat0) and
- the value of lon0,lat0 are also printed on top of the scale bar.
-
- yoffset controls how tall the scale bar is, and how far the annotations
- are offset from the scale bar. Default is 0.02 times the height of the map
- (0.02*(self.ymax-self.ymin)).
-
- fillcolor1 and fillcolor2 are only relevant for the 'fancy' scale bar.
- They are the colors of the alternating filled regions (default white
- and black).
-
- extra keyword 'ax' can be used to override the default axis instance.
+ Extra keyword ``ax`` can be used to override the default axis instance.
"""
# get current axes instance (if none specified).
if ax is None and self.ax is None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-06-14 21:14:38
|
Revision: 5545
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5545&view=rev
Author: jswhit
Date: 2008-06-14 14:14:34 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
more docstring cleanups.
don't use PyNIO in NetCDFFile.
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-06-14 16:35:55 UTC (rev 5544)
+++ trunk/toolkits/basemap/Changelog 2008-06-14 21:14:34 UTC (rev 5545)
@@ -1,3 +1,5 @@
+ * don't try to use PyNIO in NetCDFFile (it was causing
+ too many suprises).
* improved documentation using Sphinx/docutils.
* change default behaviour of num2date and date2num to be
the same as matplotlib counterparts.
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-14 16:35:55 UTC (rev 5544)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008-06-14 21:14:34 UTC (rev 5545)
@@ -161,7 +161,8 @@
(because either they are computed internally, or entire globe is
always plotted).
- For the cylindrical projections(``cyl``, ``merc`` and ``mill``), the default is to use
+ For the cylindrical projections (``cyl``, ``merc`` and ``mill``),
+ the default is to use
llcrnrlon=-180,llcrnrlat=-90, urcrnrlon=180 and urcrnrlat=90). For all other
projections except ``ortho`` and ``geos``, either the lat/lon values of the
corners or width and height must be specified by the user.
@@ -3192,42 +3193,51 @@
def interp(datain,xin,yin,xout,yout,checkbounds=False,masked=False,order=1):
"""
- dataout = interp(datain,xin,yin,xout,yout,order=1)
+ Interpolate data (``datain``) on a rectilinear grid (with x = ``xin``
+ y = ``yin``) to a grid with x = ``xout``, y= ``yout``.
- interpolate data (datain) on a rectilinear grid (with x=xin
- y=yin) to a grid with x=xout, y=yout.
+ ============== ====================================================
+ Arguments Description
+ ============== ====================================================
+ datain a rank-2 array with 1st dimension corresponding to
+ y, 2nd dimension x.
+ xin, yin rank-1 arrays containing x and y of
+ datain grid in increasing order.
+ xout, yout rank-2 arrays containing x and y of desired output
+ grid.
+ ============== ====================================================
- datain is a rank-2 array with 1st dimension corresponding to y,
- 2nd dimension x.
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ checkbounds If True, values of xout and yout are checked to see
+ that they lie within the range specified by xin
+ and xin.
+ If False, and xout,yout are outside xin,yin,
+ interpolated values will be clipped to values on
+ boundary of input grid (xin,yin)
+ Default is False.
+ masked If True, points outside the range of xin and yin
+ are masked (in a masked array).
+ If masked is set to a number, then
+ points outside the range of xin and yin will be
+ set to that number. Default False.
+ order 0 for nearest-neighbor interpolation, 1 for
+ bilinear interpolation (default 1).
+ ============== ====================================================
- xin, yin are rank-1 arrays containing x and y of
- datain grid in increasing order.
+ .. note::
+ If datain is a masked array and order=1 (bilinear interpolation) is
+ used, elements of dataout will be masked if any of the four surrounding
+ points in datain are masked. To avoid this, do the interpolation in two
+ passes, first with order=1 (producing dataout1), then with order=0
+ (producing dataout2). Then replace all the masked values in dataout1
+ with the corresponding elements in dataout2 (using numpy.where).
+ This effectively uses nearest neighbor interpolation if any of the
+ four surrounding points in datain are masked, and bilinear interpolation
+ otherwise.
- xout, yout are rank-2 arrays containing x and y of desired output grid.
-
- If checkbounds=True, values of xout and yout are checked to see that
- they lie within the range specified by xin and xin. Default is False.
-
- If checkbounds=False, and xout,yout are outside xin,yin, interpolated
- values will be clipped to values on boundary of input grid (xin,yin)
- if masked=False.
-
- If masked=True, the return value will be a masked
- array with those points masked. If masked is set to a number, then
- points outside the range of xin and yin will be set to that number.
-
- The order keyword can be 0 for nearest-neighbor interpolation,
- or 1 for bilinear interpolation (default 1).
-
- If datain is a masked array and order=1 (bilinear interpolation) is
- used, elements of dataout will be masked if any of the four surrounding
- points in datain are masked. To avoid this, do the interpolation in two
- passes, first with order=1 (producing dataout1), then with order=0
- (producing dataout2). Then replace all the masked values in dataout1
- with the corresponding elements in dataout2 (using numpy.where).
- This effectively uses nearest neighbor interpolation if any of the
- four surrounding points in datain are masked, and bilinear interpolation
- otherwise.
+ Returns ``dataout``, the interpolated data on the grid ``xout, yout``.
"""
# xin and yin must be monotonically increasing.
if xin[-1]-xin[0] < 0 or yin[-1]-yin[0] < 0:
@@ -3311,21 +3321,28 @@
def shiftgrid(lon0,datain,lonsin,start=True):
"""
- shift global lat/lon grid east or west.
+ Shift global lat/lon grid east or west.
assumes wraparound (or cyclic point) is included.
- lon0: starting longitude for shifted grid
- (ending longitude if start=False). lon0 must be on
- input grid (within the range of lonsin).
+ ============== ====================================================
+ Arguments Description
+ ============== ====================================================
+ lon0 starting longitude for shifted grid
+ (ending longitude if start=False). lon0 must be on
+ input grid (within the range of lonsin).
+ datain original data.
+ lonsin original longitudes.
+ ============== ====================================================
- datain: original data.
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ start if True, lon0 represents the starting longitude
+ of the new grid. if False, lon0 is the ending
+ longitude. Default True.
+ ============== ====================================================
- lonsin: original longitudes.
-
- start[True]: if True, lon0 represents the starting longitude
- of the new grid. if False, lon0 is the ending longitude.
-
- returns dataout,lonsout (data and longitudes on shifted grid).
+ returns ``dataout,lonsout`` (data and longitudes on shifted grid).
"""
if np.fabs(lonsin[-1]-lonsin[0]-360.) > 1.e-4:
raise ValueError, 'cyclic point not included'
@@ -3348,9 +3365,8 @@
def addcyclic(arrin,lonsin):
"""
- arrout, lonsout = addcyclic(arrin, lonsin)
-
- Add cyclic (wraparound) point in longitude.
+ ``arrout, lonsout = addcyclic(arrin, lonsin)``
+ adds cyclic (wraparound) point in longitude to ``arrin`` and ``lonsin``.
"""
nlats = arrin.shape[0]
nlons = arrin.shape[1]
@@ -3383,85 +3399,71 @@
else:
return corners
-has_pynio = True
-try:
- from PyNGL import nio
-except ImportError:
- has_pynio = False
-
def NetCDFFile(file, maskandscale=True):
"""NetCDF File reader. API is the same as Scientific.IO.NetCDF.
- If 'file' is a URL that starts with 'http', it is assumed
+ If ``file`` is a URL that starts with `http`, it is assumed
to be a remote OPenDAP dataset, and the python dap client is used
to retrieve the data. Only the OPenDAP Array and Grid data
- types are recognized. If file does not start with 'http', it
- is assumed to be a local file. If possible, the file will be read
- with a pure python NetCDF reader, otherwise PyNIO
- (http://www.pyngl.ucar.edu/Nio.shtml) will be used (if it is installed).
- PyNIO supports NetCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS2 files.
- Data read from OPenDAP and NetCDF version 3 datasets will
+ types are recognized. If file does not start with `http`, it
+ is assumed to be a local netCDF file. Data will
automatically be converted to masked arrays if the variable has either
- a 'missing_value' or '_FillValue' attribute, and some data points
+ a ``missing_value`` or ``_FillValue`` attribute, and some data points
are equal to the value specified by that attribute. In addition,
- variables stored as integers that have the 'scale_factor' and
- 'add_offset' attribute will automatically be rescaled to floats when
- read. If PyNIO is used, neither of the automatic conversions will
- be performed. To suppress these automatic conversions, set the
- maskandscale keyword to False.
+ variables stored as integers that have the ``scale_factor`` and
+ ``add_offset`` attribute will automatically be rescaled to floats when
+ read. To suppress these automatic conversions, set the
+ ``maskandscale`` keyword to False.
"""
if file.startswith('http'):
return pupynere._RemoteFile(file,maskandscale)
else:
- # use pynio if it is installed and the file cannot
- # be read with the pure python netCDF reader. This allows
- # netCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS files
- # to be read.
- if has_pynio:
- try:
- f = pupynere._LocalFile(file,maskandscale)
- except:
- f = nio.open_file(file)
- # otherwise, use the pupynere netCDF 3 pure python reader.
- # (will fail if file is not a netCDF version 3 file).
- else:
- f = pupynere._LocalFile(file,maskandscale)
- return f
+ return pupynere._LocalFile(file,maskandscale)
def num2date(times,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'):
"""
Return datetime objects given numeric time values. The units
- of the numeric time values are described by the units argument
- and the calendar keyword. The returned datetime objects represent
+ of the numeric time values are described by the ``units`` argument
+ and the ``calendar`` keyword. The returned datetime objects represent
UTC with no time-zone offset, even if the specified
units contain a time-zone offset.
- Default behavior is the same as the matplotlib num2date function
+ Default behavior is the same as the matplotlib.dates.num2date function
but the reference time and calendar can be changed via the
- 'units' and 'calendar' keywords.
+ ``units`` and ``calendar`` keywords.
- Arguments:
+ ============== ====================================================
+ Arguments Description
+ ============== ====================================================
+ times numeric time values. Maximum resolution is 1 second.
+ ============== ====================================================
- times - numeric time values. Maximum resolution is 1 second.
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ units a string of the form '<time units> since
+ <reference time>' describing the units and
+ origin of the time coordinate.
+ <time units> can be days, hours, minutes
+ or seconds. <reference time> is the time origin.
+ Default is 'days since 0001-01-01 00:00:00'.
+ calendar describes the calendar used in the time
+ calculations. All the values currently defined in
+ the CF metadata convention
+ (http://cf-pcmdi.llnl.gov/documents/cf-conventions/)
+ are supported.
+ Valid calendars ``standard``, ``gregorian``,
+ ``proleptic_gregorian``, ``noleap``, ``365_day``,
+ ``julian``, ``all_leap``, ``366_day``.
+ Default is ``proleptic_gregorian``.
+ ============== ====================================================
- units - a string of the form '<time units> since <reference time>'
- describing the time units. <time units> can be days, hours, minutes
- or seconds. <reference time> is the time origin.
- Default is 'days since 0001-01-01 00:00:00'.
-
- calendar - describes the calendar used in the time calculations.
- All the values currently defined in the CF metadata convention
- (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) are supported.
- Valid calendars 'standard', 'gregorian', 'proleptic_gregorian'
- 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'.
- Default is 'standard'/'gregorian', which is a mixed
- Julian/Gregorian calendar. Defalut 'proleptic_gregorian'.
-
Returns a datetime instance, or an array of datetime instances.
The datetime instances returned are 'real' python datetime
objects if the date falls in the Gregorian calendar (i.e.
- calendar='proleptic_gregorian', or calendar = 'standard' or 'gregorian'
- and the date is after 1582-10-15). Otherwise, they are 'phony' datetime
+ calendar=``proleptic_gregorian``, or calendar = ``standard``
+ or ``gregorian`` and the date is after 1582-10-15).
+ Otherwise, they are 'phony' datetime
objects which support some but not all the methods of 'real' python
datetime objects. The datetime instances do not contain
a time-zone offset, even if the specified units contains one.
@@ -3472,34 +3474,44 @@
def date2num(dates,units='days since 0001-01-01 00:00:00',calendar='proleptic_gregorian'):
"""
Return numeric time values given datetime objects. The units
- of the numeric time values are described by the units argument
- and the calendar keyword. The datetime objects must
+ of the numeric time values are described by the ``units`` argument
+ and the ``calendar`` keyword. The datetime objects must
be in UTC with no time-zone offset. If there is a
time-zone offset in units, it will be applied to the
returned numeric values.
- Default behavior is the same as the matplotlib date2num function
+ Default behavior is the same as the matplotlib.dates.date2num function
but the reference time and calendar can be changed via the
- 'units' and 'calendar' keywords.
+ ``units`` and ``calendar`` keywords.
- Arguments:
+ ============== ====================================================
+ Arguments Description
+ ============== ====================================================
+ dates A datetime object or a sequence of datetime objects.
+ The datetime objects should not include a
+ time-zone offset.
+ ============== ====================================================
- dates - A datetime object or a sequence of datetime objects.
- The datetime objects should not include a time-zone offset.
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ units a string of the form '<time units> since
+ <reference time>' describing the units and
+ origin of the time coordinate.
+ <time units> can be days, hours, minutes
+ or seconds. <reference time> is the time origin.
+ Default is 'days since 0001-01-01 00:00:00'.
+ calendar describes the calendar used in the time
+ calculations. All the values currently defined in
+ the CF metadata convention
+ (http://cf-pcmdi.llnl.gov/documents/cf-conventions/)
+ are supported.
+ Valid calendars ``standard``, ``gregorian``,
+ ``proleptic_gregorian``, ``noleap``, ``365_day``,
+ ``julian``, ``all_leap``, ``366_day``.
+ Default is ``proleptic_gregorian``.
+ ============== ====================================================
- units - a string of the form '<time units> since <reference time>'
- describing the time units. <time units> can be days, hours, minutes
- or seconds. <reference time> is the time origin.
- Default is 'days since 0001-01-01 00:00:00'.
-
- calendar - describes the calendar used in the time calculations.
- All the values currently defined in the CF metadata convention
- (http://cf-pcmdi.llnl.gov/documents/cf-conventions/) are supported.
- Valid calendars 'standard', 'gregorian', 'proleptic_gregorian'
- 'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'.
- Default is 'standard'/'gregorian', which is a mixed
- Julian/Gregorian calendar. Default 'proleptic_gregorian'.
-
Returns a numeric time value, or an array of numeric time values.
The maximum resolution of the numeric time values is 1 second.
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py 2008-06-14 16:35:55 UTC (rev 5544)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py 2008-06-14 21:14:34 UTC (rev 5545)
@@ -37,12 +37,6 @@
from dap.client import open as open_remote
from dap.dtypes import ArrayType, GridType, typemap
-has_pynio = True
-try:
- from PyNGL import nio
-except ImportError:
- has_pynio = False
-
ABSENT = '\x00' * 8
ZERO = '\x00' * 4
NC_BYTE = '\x00\x00\x00\x01'
@@ -76,37 +70,19 @@
to be a remote OPenDAP dataset, and the python dap client is used
to retrieve the data. Only the OPenDAP Array and Grid data
types are recognized. If file does not start with 'http', it
- is assumed to be a local file. If possible, the file will be read
- with a pure python NetCDF reader, otherwise PyNIO
- (http://www.pyngl.ucar.edu/Nio.shtml) will be used (if it is installed).
- PyNIO supports NetCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS2 files.
- Data read from OPenDAP and NetCDF version 3 datasets will
+ is assumed to be a local netCDF file. Data will
automatically be converted to masked arrays if the variable has either
a 'missing_value' or '_FillValue' attribute, and some data points
are equal to the value specified by that attribute. In addition,
variables stored as integers that have the 'scale_factor' and
'add_offset' attribute will automatically be rescaled to floats when
- read. If PyNIO is used, neither of the automatic conversions will
- be performed. To suppress these automatic conversions, set the
+ read. To suppress these automatic conversions, set the
maskandscale keyword to False.
"""
if file.startswith('http'):
return _RemoteFile(file,maskandscale)
else:
- # use pynio if it is installed and the file cannot
- # be read with the pure python netCDF reader. This allows
- # netCDF version 4, GRIB1, GRIB2, HDF4 and HDFEOS files
- # to be read.
- if has_pynio:
- try:
- f = _LocalFile(file,maskandscale)
- except:
- f = nio.open_file(file)
- # otherwise, use the pupynere netCDF 3 pure python reader.
- # (will fail if file is not a netCDF version 3 file).
- else:
- f = _LocalFile(file,maskandscale)
- return f
+ return _LocalFile(file,maskandscale)
def _maskandscale(var,datout):
totalmask = zeros(datout.shape,numpy.bool)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 16:35:57
|
Revision: 5544
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5544&view=rev
Author: dsdale
Date: 2008-06-14 09:35:55 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
don't use the contents directive, it doesnt format well in pdf
Modified Paths:
--------------
trunk/matplotlib/doc/faq/howto_faq.rst
trunk/matplotlib/doc/faq/installing_faq.rst
trunk/matplotlib/doc/faq/troubleshooting_faq.rst
Modified: trunk/matplotlib/doc/faq/howto_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/howto_faq.rst 2008-06-14 16:24:07 UTC (rev 5543)
+++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-06-14 16:35:55 UTC (rev 5544)
@@ -1,10 +1,9 @@
.. _howto-faq:
-*****
-HOWTO
-*****
+*********
+HOWTO FAQ
+*********
-
.. _howto-ticks:
How do I configure the tick linewidths?
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:24:07 UTC (rev 5543)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:35:55 UTC (rev 5544)
@@ -4,9 +4,7 @@
Installation FAQ
******************
-.. contents::
-
How do I report a compilation problem?
======================================
Modified: trunk/matplotlib/doc/faq/troubleshooting_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/troubleshooting_faq.rst 2008-06-14 16:24:07 UTC (rev 5543)
+++ trunk/matplotlib/doc/faq/troubleshooting_faq.rst 2008-06-14 16:35:55 UTC (rev 5544)
@@ -1,8 +1,8 @@
.. _troubleshooting-faq:
-===================
+*******************
Troubleshooting FAQ
-===================
+*******************
.. _matplotlib-version:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 16:24:12
|
Revision: 5543
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5543&view=rev
Author: dsdale
Date: 2008-06-14 09:24:07 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
installation faq updates
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:19:53 UTC (rev 5542)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:24:07 UTC (rev 5543)
@@ -44,14 +44,14 @@
How do I cleanly rebuild and reinstall everything?
==================================================
-1. Delete the caches from your :ref:`.matplotlib configuration directory
-<locating-matplotlib-config-dir>`.
+The steps depend on your platform and installation method.
-The next steps depend on your platform and installation method.
-
Easy Install
------------
+1. Delete the caches from your :ref:`.matplotlib configuration directory
+ <locating-matplotlib-config-dir>`.
+
2. Run::
easy_install -m PackageName
@@ -63,8 +63,11 @@
Windows installer
-----------------
+1. Delete the caches from your :ref:`.matplotlib configuration directory
+ <locating-matplotlib-config-dir>`.
+
2. Use :menuselection:`Start --> Control Panel` to start the :program:`Add and
-Remove Software` utility.
+ Remove Software` utility.
Source install
--------------
@@ -76,7 +79,11 @@
does not properly clean the build directory, and does nothing to the
install directory. To cleanly rebuild:
+1. Delete the caches from your :ref:`.matplotlib configuration directory
+ <locating-matplotlib-config-dir>`.
+
2. Delete the ``build`` directory in the source tree
+
3. Delete any matplotlib directories or eggs from your `installation directory
<locating-matplotlib-install>`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 16:19:55
|
Revision: 5542
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5542&view=rev
Author: dsdale
Date: 2008-06-14 09:19:53 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
added local table of contents to the installation faq
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:07:24 UTC (rev 5541)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:19:53 UTC (rev 5542)
@@ -4,6 +4,7 @@
Installation FAQ
******************
+.. contents::
How do I report a compilation problem?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 16:07:31
|
Revision: 5541
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5541&view=rev
Author: dsdale
Date: 2008-06-14 09:07:24 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
updated installation faq, added to glossary
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
trunk/matplotlib/doc/glossary/index.rst
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 14:59:09 UTC (rev 5540)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 16:07:24 UTC (rev 5541)
@@ -150,32 +150,46 @@
Here is a summary of the matplotlib renderers (there is an eponymous
backed for each):
-======== ====================== ======================================================================================
-Renderer Filetypes Description
-======== ====================== ======================================================================================
-AGG png :term:`raster graphics` -- high quality images using the `Anti-Grain Geometry`_ engine
-PS ps, eps :term:`vector graphics` -- Postscript_ output
-PDF pdf :term:`vector graphics` -- `Portable Document Format`_
-SVG svg :term:`vector graphics` -- `Scalable Vector Graphics`_
-Cairo png, ps, pdf, svn, ... :term:`vector graphics` -- `Cairo graphics`_
-GDK png, jpg, tiff, ... :term:`raster graphics` -- the `Gimp Drawing Kit`_ for GTK
-======== ====================== ======================================================================================
+============= ============ ================================================
+Renderer Filetypes Description
+============= ============ ================================================
+:term:`AGG` :term:`png` :term:`raster graphics` -- high quality images
+ using the `Anti-Grain Geometry`_ engine
+PS :term:`ps` :term:`vector graphics` -- Postscript_ output
+ :term:`eps`
+PDF :term:`pdf` :term:`vector graphics` --
+ `Portable Document Format`_
+SVG :term:`svg` :term:`vector graphics` --
+ `Scalable Vector Graphics`_
+:term:`Cairo` :term:`png` :term:`vector graphics` --
+ :term:`ps` `Cairo graphics`_
+ :term:`pdf`
+ :term:`svg`
+ ...
+:term:`GDK` :term:`png` :term:`raster graphics` --
+ :term:`jpg` the `Gimp Drawing Kit`_
+ :term:`tiff`
+ ...
+============= ============ ================================================
And here are the user interfaces and renderer combinations supported:
-============ =====================================================================================
+============ ================================================================
Backend Description
-============ =====================================================================================
-GTKAgg Agg rendering to a GTK canvas (requires PyGTK_)
-GTK GDK rendering to a GTK canvas (not recommended) (requires PyGTK_)
-GTKCairo Cairo rendering to a GTK Canvas (requires PyGTK_)
-WXAgg Agg rendering to to a wxWidgets canvas (requires wxPython_)
-WX Native wxWidgets drawing to a wxWidgets Canvas (not recommended) (requires wxPython_)
-TkAgg Agg rendering to a Tk canvas (requires TkInter_)
-QtAgg Agg rendering to a Qt canvas (requires PyQt_)
-Qt4Agg Agg rendering to a Qt4 canvas (requires PyQt4_)
-FLTKAgg Agg rendering to a FLTK canvas (requires pyFLTK_)
-============ =====================================================================================
+============ ================================================================
+GTKAgg Agg rendering to a :term:`GTK` canvas (requires PyGTK_)
+GTK GDK rendering to a :term:`GTK` canvas (not recommended)
+ (requires PyGTK_)
+GTKCairo Cairo rendering to a :term:`GTK` Canvas (requires PyGTK_)
+WXAgg Agg rendering to to a :term:`wxWidgets` canvas
+ (requires wxPython_)
+WX Native :term:`wxWidgets` drawing to a :term:`wxWidgets` Canvas
+ (not recommended) (requires wxPython_)
+TkAgg Agg rendering to a :term:`Tk` canvas (requires TkInter_)
+QtAgg Agg rendering to a :term:`Qt` canvas (requires PyQt_)
+Qt4Agg Agg rendering to a :term:`Qt4` canvas (requires PyQt4_)
+FLTKAgg Agg rendering to a :term:`FLTK` canvas (requires pyFLTK_)
+============ ================================================================
.. _`Anti-Grain Geometry`: http://www.antigrain.com/
.. _Postscript: http://en.wikipedia.org/wiki/PostScript
Modified: trunk/matplotlib/doc/glossary/index.rst
===================================================================
--- trunk/matplotlib/doc/glossary/index.rst 2008-06-14 14:59:09 UTC (rev 5540)
+++ trunk/matplotlib/doc/glossary/index.rst 2008-06-14 16:07:24 UTC (rev 5541)
@@ -4,12 +4,69 @@
.. glossary::
+ AGG
+ The Anti-Grain Geometry rendering engine, capable of rendering
+ high-quality images.
+
+ Cairo
+ The Cairo graphics engine
+
+ EPS
+ Encapsulated Postscript
+
+ FLTK
+ FLTK (pronounced "fulltick") is a cross-platform C++ GUI toolkit for
+ UNIX/Linux (X11), Microsoft Windows, and MacOS X
+
+ GDK
+ The Gimp Drawing Kit for GTK+
+
+ GTK
+ The GTK graphical user interface library
+
+ JPG
+ A compression method and file format for photographic images
+
+ PDF
+ Adobe's Portable Document Format
+
+ PNG
+ PNG stands for Portable Network Graphics, a raster graphics format that
+ employs lossless data compression which is more suitable for line art
+ than the lossy jpg format. Unlike the gif format, png is not encumbered
+ by requirements for a patent license.
+
+ PS
+ Postscript
+
+ Qt
+ Qt is a cross-platform application framework for desktop and embedded
+ development.
+
+ Qt4
+ Qt4 is the most recent version of Qt cross-platform application framework
+ for desktop and embedded development.
+
raster graphics
Raster graphics, or bitmaps, represent an image as an array of pixels
which is resolution dependent. Raster graphics are generally most
practical for photo-realistic images, but do not scale easily without
loss of quality.
+ SVG
+ The Scalable Vector Graphics format.
+
+ TIFF
+ Tagged Image File Format
+
+ Tk
+ Tk is a graphical user interface for Tcl and many other dynamic
+ languages. It can produce rich, native applications that run unchanged
+ across Windows, Mac OS X, Linux and more.
+
+ wxWidgets
+ A cross-platform GUI and tools library for GTK, MS Windows, and MacOS.
+
vector graphics
The use of geometrical primitives based upon mathematical equations to
represent images in computer graphics. Primitives can include points,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 14:59:11
|
Revision: 5540
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5540&view=rev
Author: dsdale
Date: 2008-06-14 07:59:09 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
remove gtk backends from API reference for now
fixed a broken link in installation faq
Modified Paths:
--------------
trunk/matplotlib/doc/api/backend_gtkagg_api.rst
trunk/matplotlib/doc/faq/installing_faq.rst
Modified: trunk/matplotlib/doc/api/backend_gtkagg_api.rst
===================================================================
--- trunk/matplotlib/doc/api/backend_gtkagg_api.rst 2008-06-14 14:32:13 UTC (rev 5539)
+++ trunk/matplotlib/doc/api/backend_gtkagg_api.rst 2008-06-14 14:59:09 UTC (rev 5540)
@@ -2,6 +2,9 @@
:mod:`matplotlib.backends.backend_gtkagg`
=========================================
-.. automodule:: matplotlib.backends.backend_gtkagg
- :members:
- :undoc-members:
\ No newline at end of file
+**TODO** We'll add this later, importing the gtk backends requires an active
+X-session, which is not compatible with cron jobs.
+
+.. .. automodule:: matplotlib.backends.backend_gtkagg
+.. :members:
+.. :undoc-members:
\ No newline at end of file
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 14:32:13 UTC (rev 5539)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 14:59:09 UTC (rev 5540)
@@ -196,14 +196,14 @@
How do I compile matplotlib with PyGTK-2.4?
-------------------------------------------
-There is a `bug <pygtk-2.4-bug>`_ in PyGTK-2.4. You need to edit
+There is a `bug in PyGTK-2.4`_. You need to edit
:file:`pygobject.h` to add the :cmacro:`G_BEGIN_DECLS` and :cmacro:`G_END_DECLS`
macros, and rename :cdata:`typename` parameter to :cdata:`typename_`::
- const char *typename,
+ const char *typename_,
-.. _`bug <pygtk-2.4-bug>`: http://bugzilla.gnome.org/show_bug.cgi?id=155304
+.. _`bug in PyGTK-2.4`: http://bugzilla.gnome.org/show_bug.cgi?id=155304
OS-X questions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 14:32:15
|
Revision: 5539
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5539&view=rev
Author: dsdale
Date: 2008-06-14 07:32:13 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
improvements to installation faq
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 14:10:27 UTC (rev 5538)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 14:32:13 UTC (rev 5539)
@@ -43,38 +43,43 @@
How do I cleanly rebuild and reinstall everything?
==================================================
-# TODO: include for binary installs
+1. Delete the caches from your :ref:`.matplotlib configuration directory
+<locating-matplotlib-config-dir>`.
-Unfortunately::
+The next steps depend on your platform and installation method.
- python setup.py clean
+Easy Install
+------------
-does not properly clean the build directory, and does nothing to the
-install directory. To cleanly rebuild:
+2. Run::
- * delete the ``build`` directory in the source tree
- * delete ``site-packages/matplotlib`` directory in the Python
- installation. The location of ``site-packages`` is
- platform-specific. You can find out where matplotlib is installed by doing::
+ easy_install -m PackageName
- > python -c 'import matplotlib; print matplotlib.__file__'
+3. Delete any .egg files or directories from your `installation directory
+ <locating-matplotlib-install>`.
- and then making sure you remove the matplotlib directory (and
- any matplotlib*.egg files) you find there.
- * you may also want to clear some of the cache data that
- matplotlib stores in your ``.matplotlib`` directory. You can
- find the location of this directory by doing::
+Windows installer
+-----------------
- import matplotlib
- print matplotlib.get_configdir()
+2. Use :menuselection:`Start --> Control Panel` to start the :program:`Add and
+Remove Software` utility.
- A typical location for the config directory is :file:`.matplotlib`, and the following
- caches may need to be cleared after a major update::
+Source install
+--------------
- rm -rf ~/.matplotlib/tex.cache
- rm -rf ~/.matplotlib/fontManager.cache
+Unfortunately::
+ python setup.py clean
+
+does not properly clean the build directory, and does nothing to the
+install directory. To cleanly rebuild:
+
+2. Delete the ``build`` directory in the source tree
+3. Delete any matplotlib directories or eggs from your `installation directory
+ <locating-matplotlib-install>`
+
+
Backends
========
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 14:11:11
|
Revision: 5538
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5538&view=rev
Author: dsdale
Date: 2008-06-14 07:10:27 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
added to the installation faq
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 13:40:01 UTC (rev 5537)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 14:10:27 UTC (rev 5538)
@@ -11,11 +11,40 @@
See :ref:`reporting-problems`.
+matplotlib compiled fine, but I can't get anything to plot
+==========================================================
+
+The first thing to try is a :ref:`clean install <clean-install>` and see if
+that helps. If not, the best way to test your install is by running a script,
+rather than working interactively from a python shell or an integrated
+development environment such as :program:`IDLE` which add additional
+complexities. Open up a UNIX shell or a DOS command prompt and cd into a
+directory containing a minimal example in a file. Something like
+:file:`simple_plot.py`, or for example::
+
+ from pylab import *
+ plot([1,2,3])
+ show()
+
+and run it with::
+
+ python simple_plot.py --verbose-helpful
+
+This will give you additional information about which backends matplotlib is
+loading, version information, and more. At this point you might want to make
+sure you understand matplotlib's :ref:`configuration <customizing-matplotlib>`
+process, governed by the :file:`matplotlibrc` configuration file which contains
+instructions within and the concept of the matplotlib backend.
+
+If you are still having trouble, see :ref:`reporting-problems`.
+
.. _clean-install:
How do I cleanly rebuild and reinstall everything?
==================================================
+# TODO: include for binary installs
+
Unfortunately::
python setup.py clean
@@ -46,10 +75,13 @@
rm -rf ~/.matplotlib/tex.cache
rm -rf ~/.matplotlib/fontManager.cache
+Backends
+========
+
.. _what-is-a-backend:
What is a backend?
-==================
+------------------
A lot of documentation on the website and in the mailing lists refers
to the "backend" and many new users are confused by this term.
@@ -154,6 +186,21 @@
.. _pyFLTK: http://pyfltk.sourceforge.net
+.. _pygtk-2.4:
+
+How do I compile matplotlib with PyGTK-2.4?
+-------------------------------------------
+
+There is a `bug <pygtk-2.4-bug>`_ in PyGTK-2.4. You need to edit
+:file:`pygobject.h` to add the :cmacro:`G_BEGIN_DECLS` and :cmacro:`G_END_DECLS`
+macros, and rename :cdata:`typename` parameter to :cdata:`typename_`::
+
+ - const char *typename,
+ + const char *typename_,
+
+.. _`bug <pygtk-2.4-bug>`: http://bugzilla.gnome.org/show_bug.cgi?id=155304
+
+
OS-X questions
==============
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-06-14 13:40:07
|
Revision: 5537
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5537&view=rev
Author: dsdale
Date: 2008-06-14 06:40:01 -0700 (Sat, 14 Jun 2008)
Log Message:
-----------
updates to installation faq and glossary
Modified Paths:
--------------
trunk/matplotlib/doc/faq/installing_faq.rst
trunk/matplotlib/doc/glossary/index.rst
Modified: trunk/matplotlib/doc/faq/installing_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 13:21:19 UTC (rev 5536)
+++ trunk/matplotlib/doc/faq/installing_faq.rst 2008-06-14 13:40:01 UTC (rev 5537)
@@ -113,34 +113,47 @@
Here is a summary of the matplotlib renderers (there is an eponymous
backed for each):
-=============================== =====================================================================================
-Renderer (Filetypes) Description
-=============================== =====================================================================================
-Agg (png) raster - high quality images using the `antigrain <http://antigrain.html>`_ engine
-PS (ps, eps) vector - postscript output
-PDF (pdf) vector - portable document format
-SVG (svg) vector - scalar vector graphics
-Cairo (png, ps, pdf, svn, ...) vector - `cairo graphics <http://cairographics.org>`_
-GDK (png, jpg, tiff..) raster - the GDK drawing API for GTK
-=============================== =====================================================================================
+======== ====================== ======================================================================================
+Renderer Filetypes Description
+======== ====================== ======================================================================================
+AGG png :term:`raster graphics` -- high quality images using the `Anti-Grain Geometry`_ engine
+PS ps, eps :term:`vector graphics` -- Postscript_ output
+PDF pdf :term:`vector graphics` -- `Portable Document Format`_
+SVG svg :term:`vector graphics` -- `Scalable Vector Graphics`_
+Cairo png, ps, pdf, svn, ... :term:`vector graphics` -- `Cairo graphics`_
+GDK png, jpg, tiff, ... :term:`raster graphics` -- the `Gimp Drawing Kit`_ for GTK
+======== ====================== ======================================================================================
And here are the user interfaces and renderer combinations supported:
-============ ===================================================================================================
+============ =====================================================================================
Backend Description
-============ ===================================================================================================
-GTKAgg Agg rendering to a GTK canvas (`pygtk <http://www.pygtk.org>`_)
-GTK GDK rendering to a GTK canvas (not recommended) (`pygtk <http://www.pygtk.org>`_)
-GTKCairo Cairo rendering to a GTK Canvas (`pygtk <http://www.pygtk.org>`_)
-WXAgg Agg rendering to to a WX canvas (`wxpython <http://www.wxpython.org>`_)
-WX Native WX drawing to a WX Canvas (not recommended) (`wxpython <http://www.wxpython.org>`_)
-TkAgg Agg rendering to a Tkinter canvas (`tkinter <http://wiki.python.org/moin/TkInter>`_)
-QtAgg Agg rendering to a Qt canvas (`pyqt <http://www.riverbankcomputing.co.uk/software/pyqt/intro>`_)
-Qt4Agg Agg rendering to a Qt4 canvas (`pyqt <http://www.riverbankcomputing.co.uk/software/pyqt/intro>`_)
-FLTKAgg Agg rendering to a FLTK canvas (`pyfltk <http://pyfltk.sourceforge.net>`_)
-============ ===================================================================================================
+============ =====================================================================================
+GTKAgg Agg rendering to a GTK canvas (requires PyGTK_)
+GTK GDK rendering to a GTK canvas (not recommended) (requires PyGTK_)
+GTKCairo Cairo rendering to a GTK Canvas (requires PyGTK_)
+WXAgg Agg rendering to to a wxWidgets canvas (requires wxPython_)
+WX Native wxWidgets drawing to a wxWidgets Canvas (not recommended) (requires wxPython_)
+TkAgg Agg rendering to a Tk canvas (requires TkInter_)
+QtAgg Agg rendering to a Qt canvas (requires PyQt_)
+Qt4Agg Agg rendering to a Qt4 canvas (requires PyQt4_)
+FLTKAgg Agg rendering to a FLTK canvas (requires pyFLTK_)
+============ =====================================================================================
+.. _`Anti-Grain Geometry`: http://www.antigrain.com/
+.. _Postscript: http://en.wikipedia.org/wiki/PostScript
+.. _`Portable Document Format`: http://en.wikipedia.org/wiki/Portable_Document_Format
+.. _`Scalable Vector Graphics`: http://en.wikipedia.org/wiki/Scalable_Vector_Graphics
+.. _`Cairo graphics`: http://en.wikipedia.org/wiki/Cairo_(graphics)
+.. _`Gimp Drawing Kit`: http://en.wikipedia.org/wiki/GDK
+.. _PyGTK: http://www.pygtk.org
+.. _wxPython: http://www.wxpython.org/
+.. _TkInter: http://wiki.python.org/moin/TkInter
+.. _PyQt: http://www.riverbankcomputing.co.uk/software/pyqt/intro
+.. _PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/intro
+.. _pyFLTK: http://pyfltk.sourceforge.net
+
OS-X questions
==============
Modified: trunk/matplotlib/doc/glossary/index.rst
===================================================================
--- trunk/matplotlib/doc/glossary/index.rst 2008-06-14 13:21:19 UTC (rev 5536)
+++ trunk/matplotlib/doc/glossary/index.rst 2008-06-14 13:40:01 UTC (rev 5537)
@@ -7,8 +7,8 @@
raster graphics
Raster graphics, or bitmaps, represent an image as an array of pixels
which is resolution dependent. Raster graphics are generally most
- practical for photo-realistic images, but do not easily without loss of
- quality.
+ practical for photo-realistic images, but do not scale easily without
+ loss of quality.
vector graphics
The use of geometrical primitives based upon mathematical equations to
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|