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: <jd...@us...> - 2008-11-23 19:56:41
|
Revision: 6437
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6437&view=rev
Author: jdh2358
Date: 2008-11-23 19:56:37 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
moved fill_between to axes/pyplot method
Modified Paths:
--------------
trunk/matplotlib/boilerplate.py
trunk/matplotlib/doc/_templates/index.html
trunk/matplotlib/examples/api/fill_where_demo.py
trunk/matplotlib/examples/pylab_examples/fill_between.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/lib/matplotlib/pyplot.py
Added Paths:
-----------
trunk/matplotlib/examples/api/span_regions.py
Modified: trunk/matplotlib/boilerplate.py
===================================================================
--- trunk/matplotlib/boilerplate.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/boilerplate.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -64,6 +64,7 @@
'csd',
'errorbar',
'fill',
+ 'fill_between',
'hexbin',
'hist',
'hlines',
Modified: trunk/matplotlib/doc/_templates/index.html
===================================================================
--- trunk/matplotlib/doc/_templates/index.html 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/doc/_templates/index.html 2008-11-23 19:56:37 UTC (rev 6437)
@@ -409,8 +409,21 @@
</td>
</tr>
+
<tr>
<th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.fill_between">fill_between</a>
+
+ </th>
+
+ <td align="left">
+ make filled polygons between two curves
+ </td>
+
+ </tr>
+
+ <tr>
+ <th align="left">
<a href="api/pyplot_api.html#matplotlib.pyplot.findobj">findobj</a>
</th>
Modified: trunk/matplotlib/examples/api/fill_where_demo.py
===================================================================
--- trunk/matplotlib/examples/api/fill_where_demo.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/examples/api/fill_where_demo.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -17,7 +17,7 @@
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('using fill_between_where')
-ax.plot(t, s1, t, s2)
+ax.plot(t, s1, t, s2, color='black')
ax.axhline(0, color='black', lw=2)
collection = collections.PolyCollection.fill_between_where(
@@ -32,7 +32,7 @@
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('using span_where')
-ax.plot(t, s1, '-')
+ax.plot(t, s1, , color='black')
ax.axhline(0, color='black', lw=2)
collection = collections.BrokenBarHCollection.span_where(
Added: trunk/matplotlib/examples/api/span_regions.py
===================================================================
--- trunk/matplotlib/examples/api/span_regions.py (rev 0)
+++ trunk/matplotlib/examples/api/span_regions.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -0,0 +1,38 @@
+"""
+Illustrate some helper functions for shading regions where a logical
+mask is True
+
+See :meth:`matplotlib.collections.BrokenBarHCollection.span_where`
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.collections as collections
+
+
+t = np.arange(0.0, 2, 0.01)
+s1 = np.sin(2*np.pi*t)
+s2 = 1.2*np.sin(4*np.pi*t)
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using span_where')
+ax.plot(t, s1, color='black')
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.BrokenBarHCollection.span_where(
+ t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.BrokenBarHCollection.span_where(
+ t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+
+plt.show()
+
+
+
+
+
Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -3,27 +3,31 @@
from pylab import figure, show
import numpy as np
-x = np.arange(0, 2, 0.01)
+x = np.arange(0.0, 2, 0.01)
y1 = np.sin(2*np.pi*x)
-y2 = np.sin(4*np.pi*x) + 2
+y2 = 1.2*np.sin(4*np.pi*x)
fig = figure()
-ax = fig.add_subplot(311)
-ax2 = fig.add_subplot(312)
-ax3 = fig.add_subplot(313)
+ax1 = fig.add_subplot(311)
+ax2 = fig.add_subplot(312, sharex=ax1)
+ax3 = fig.add_subplot(313, sharex=ax1)
+ax1.fill_between(x, 0, y1)
+ax1.set_ylabel('between y1 and 0')
-xs, ys = mlab.poly_between(x, 0, y1)
-ax.fill(xs, ys)
-ax.set_ylabel('between y1 and 0')
-
-xs, ys = mlab.poly_between(x, y1, 1)
-ax2.fill(xs, ys)
+ax2.fill_between(x, y1, 1)
ax2.set_ylabel('between y1 and 1')
-xs, ys = mlab.poly_between(x, y1, y2)
-ax3.fill(xs, ys)
+ax3.fill_between(x, y1, y2)
ax3.set_ylabel('between y1 and y2')
ax3.set_xlabel('x')
+
+fig = figure()
+ax = fig.add_subplot(111)
+ax1.plot(x, y1, x, y2, color='black')
+ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
+ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
+ax.set_title('fill between where')
+
show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -1302,6 +1302,7 @@
if autolim:
if collection._paths and len(collection._paths):
self.update_datalim(collection.get_datalim(self.transData))
+
collection._remove_method = lambda h: self.collections.remove(h)
def add_line(self, line):
@@ -5456,12 +5457,8 @@
supports are supported by the fill format string.
If you would like to fill below a curve, eg. shade a region
- between 0 and *y* along *x*, use
- :func:`~matplotlib.pylab.poly_between`, eg.::
+ between 0 and *y* along *x*, use :meth:`fill_between`
- xs, ys = poly_between(x, 0, y)
- axes.fill(xs, ys, facecolor='red', alpha=0.5)
-
The *closed* kwarg will close the polygon when *True* (default).
kwargs control the Polygon properties:
@@ -5472,9 +5469,6 @@
.. plot:: mpl_examples/pylab_examples/fill_demo.py
- .. seealso::
- :file:`examples/pylab_examples/fill_between.py`:
- For more examples.
"""
if not self._hold: self.cla()
@@ -5486,6 +5480,92 @@
return patches
fill.__doc__ = cbook.dedent(fill.__doc__) % martist.kwdocd
+ def fill_between(self, x, y1, y2=0, where=None, **kwargs):
+ """
+ call signature::
+
+ fill_between(x, y1, y2=0, where=None, **kwargs)
+
+ Create a :class:`~matplotlib.collectionsPolyCollection`
+ filling the regions between *y1* and *y2* where
+ ``where==True``
+
+ *x*
+ an N length np array of the x data
+
+ *y1*
+ an N length scalar or np array of the x data
+
+ *y2*
+ an N length scalar or np array of the x data
+
+ *where*
+ if None, default to fill between everywhere. If not None,
+ it is a a N length numpy boolean array and the fill will
+ only happen over the regions where ``where==True``
+
+ *kwargs*
+ keyword args passed on to the :class:`PolyCollection`
+
+ .. seealso::
+ :file:`examples/pylab_examples/fill_between.py`:
+ For more examples.
+
+ kwargs control the Polygon properties:
+
+ %(PolyCollection)s
+
+ """
+ x = np.asarray(x)
+ if not cbook.iterable(y1):
+ y1 = np.ones_like(x)*y1
+
+ if not cbook.iterable(y2):
+ y2 = np.ones_like(x)*y2
+
+ if where is None:
+ where = np.ones(len(x), np.bool)
+
+ y1 = np.asarray(y1)
+ y2 = np.asarray(y2)
+ where = np.asarray(where)
+ assert( (len(x)==len(y1)) and (len(x)==len(y2)) and len(x)==len(where))
+
+ polys = []
+ for ind0, ind1 in mlab.contiguous_regions(where):
+ theseverts = []
+ xslice = x[ind0:ind1]
+ y1slice = y1[ind0:ind1]
+ y2slice = y2[ind0:ind1]
+
+ if not len(xslice):
+ continue
+
+ N = len(xslice)
+ X = np.zeros((2*N+2, 2), np.float)
+
+ # the purpose of the next two lines is for when y2 is a
+ # scalar like 0 and we want the fill to go all the way
+ # down to 0 even if none of the y1 sample points do
+ X[0] = xslice[0], y2slice[0]
+ X[N+1] = xslice[-1], y2slice[-1]
+
+ X[1:N+1,0] = xslice
+ X[1:N+1,1] = y1slice
+ X[N+2:,0] = xslice[::-1]
+ X[N+2:,1] = y2slice[::-1]
+
+ polys.append(X)
+
+ collection = mcoll.PolyCollection(polys, **kwargs)
+
+ self.update_datalim_numerix(x[where], y1[where])
+ self.update_datalim_numerix(x[where], y2[where])
+ self.add_collection(collection)
+ self.autoscale_view()
+ return collection
+ fill_between.__doc__ = cbook.dedent(fill_between.__doc__) % martist.kwdocd
+
#### plotting z(x,y): imshow, pcolor and relatives, contour
def imshow(self, X, cmap=None, norm=None, aspect=None,
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -673,66 +673,6 @@
return Collection.draw(self, renderer)
- @staticmethod
- def fill_between_where(x, y1, y2, where, **kwargs):
- """
- Create a :class:`PolyCollection` filling the regions between *y*
- and *yboundary7* where ``where==True``
-
-
- *x*
- an N length np array of the x data
-
- *y1*
- an N length scalar or np array of the x data
-
- *y2*
- an N length scalar or np array of the x data
-
- *where*
- an N length numpy boolean array
-
- *kwargs*
- keyword args passed on to the :class:`PolyCollection`
-
- """
- if not cbook.iterable(y1):
- y1 = np.ones_like(x)*y1
-
- if not cbook.iterable(y2):
- y2 = np.ones_like(x)*y2
-
- assert( (len(x)==len(y1)) and (len(x)==len(y2)) )
-
- polys = []
- for ind0, ind1 in mlab.contiguous_regions(where):
- theseverts = []
- xslice = x[ind0:ind1]
- y1slice = y1[ind0:ind1]
- y2slice = y2[ind0:ind1]
-
- if not len(xslice):
- continue
-
- N = len(xslice)
- X = np.zeros((2*N+2, 2), np.float)
-
- # the purpose of the next two lines is for when y2 is a
- # scalar like 0 and we want the fill to go all the way
- # down to 0 even if none of the y1 sample points do
- X[0] = xslice[0], y2slice[0]
- X[N+1] = xslice[-1], y2slice[-1]
-
- X[1:N+1,0] = xslice
- X[1:N+1,1] = y1slice
- X[N+2:,0] = xslice[::-1]
- X[N+2:,1] = y2slice[::-1]
-
- polys.append(X)
-
- collection = PolyCollection(polys, **kwargs)
- return collection
-
class BrokenBarHCollection(PolyCollection):
"""
A collection of horizontal bars spanning *yrange* with a sequence of
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-11-23 19:18:24 UTC (rev 6436)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-11-23 19:56:37 UTC (rev 6437)
@@ -1120,61 +1120,62 @@
"""
Plotting commands
- ========= =================================================
- Command Description
- ========= =================================================
- axes Create a new axes
- axis Set or return the current axis limits
- bar make a bar chart
- boxplot make a box and whiskers chart
- cla clear current axes
- clabel label a contour plot
- clf clear a figure window
- close close a figure window
- colorbar add a colorbar to the current figure
- cohere make a plot of coherence
- contour make a contour plot
- contourf make a filled contour plot
- csd make a plot of cross spectral density
- draw force a redraw of the current figure
- errorbar make an errorbar graph
- figlegend add a legend to the figure
- figimage add an image to the figure, w/o resampling
- figtext add text in figure coords
- figure create or change active figure
- fill make filled polygons
- gca return the current axes
- gcf return the current figure
- gci get the current image, or None
- getp get a handle graphics property
- hist make a histogram
- hold set the hold state on current axes
- legend add a legend to the axes
- loglog a log log plot
- imread load image file into array
- imshow plot image data
- matshow display a matrix in a new figure preserving aspect
- pcolor make a pseudocolor plot
- plot make a line plot
- plotfile plot data from a flat file
- psd make a plot of power spectral density
- quiver make a direction field (arrows) plot
- rc control the default params
- savefig save the current figure
- scatter make a scatter plot
- setp set a handle graphics property
- semilogx log x axis
- semilogy log y axis
- show show the figures
- specgram a spectrogram plot
- stem make a stem plot
- subplot make a subplot (numrows, numcols, axesnum)
- table add a table to the axes
- text add some text at location x,y to the current axes
- title add a title to the current axes
- xlabel add an xlabel to the current axes
- ylabel add a ylabel to the current axes
- ========= =================================================
+ ========= =================================================
+ Command Description
+ ========= =================================================
+ axes Create a new axes
+ axis Set or return the current axis limits
+ bar make a bar chart
+ boxplot make a box and whiskers chart
+ cla clear current axes
+ clabel label a contour plot
+ clf clear a figure window
+ close close a figure window
+ colorbar add a colorbar to the current figure
+ cohere make a plot of coherence
+ contour make a contour plot
+ contourf make a filled contour plot
+ csd make a plot of cross spectral density
+ draw force a redraw of the current figure
+ errorbar make an errorbar graph
+ figlegend add a legend to the figure
+ figimage add an image to the figure, w/o resampling
+ figtext add text in figure coords
+ figure create or change active figure
+ fill make filled polygons
+ fill_between make filled polygons
+ gca return the current axes
+ gcf return the current figure
+ gci get the current image, or None
+ getp get a handle graphics property
+ hist make a histogram
+ hold set the hold state on current axes
+ legend add a legend to the axes
+ loglog a log log plot
+ imread load image file into array
+ imshow plot image data
+ matshow display a matrix in a new figure preserving aspect
+ pcolor make a pseudocolor plot
+ plot make a line plot
+ plotfile plot data from a flat file
+ psd make a plot of power spectral density
+ quiver make a direction field (arrows) plot
+ rc control the default params
+ savefig save the current figure
+ scatter make a scatter plot
+ setp set a handle graphics property
+ semilogx log x axis
+ semilogy log y axis
+ show show the figures
+ specgram a spectrogram plot
+ stem make a stem plot
+ subplot make a subplot (numrows, numcols, axesnum)
+ table add a table to the axes
+ text add some text at location x,y to the current axes
+ title add a title to the current axes
+ xlabel add an xlabel to the current axes
+ ylabel add a ylabel to the current axes
+ ========= =================================================
The following commands will set the default colormap accordingly:
@@ -1493,7 +1494,6 @@
## Plotting part 2: autogenerated wrappers for axes methods ##
-### Do not edit below this point
# This function was autogenerated by boilerplate.py. Do not edit as
# changes will be lost
def acorr(*args, **kwargs):
@@ -1870,6 +1870,50 @@
# This function was autogenerated by boilerplate.py. Do not edit as
# changes will be lost
+def fill_between(*args, **kwargs):
+ # allow callers to override the hold state by passing hold=True|False
+ b = ishold()
+ h = kwargs.pop('hold', None)
+ if h is not None:
+ hold(h)
+ try:
+ ret = gca().fill_between(*args, **kwargs)
+ draw_if_interactive()
+ except:
+ hold(b)
+ raise
+
+ hold(b)
+ return ret
+if Axes.fill_between.__doc__ is not None:
+ fill_between.__doc__ = dedent(Axes.fill_between.__doc__) + """
+
+Additional kwargs: hold = [True|False] overrides default hold state"""
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
+def hexbin(*args, **kwargs):
+ # allow callers to override the hold state by passing hold=True|False
+ b = ishold()
+ h = kwargs.pop('hold', None)
+ if h is not None:
+ hold(h)
+ try:
+ ret = gca().hexbin(*args, **kwargs)
+ draw_if_interactive()
+ except:
+ hold(b)
+ raise
+ gci._current = ret
+ hold(b)
+ return ret
+if Axes.hexbin.__doc__ is not None:
+ hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """
+
+Additional kwargs: hold = [True|False] overrides default hold state"""
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
def hist(*args, **kwargs):
# allow callers to override the hold state by passing hold=True|False
b = ishold()
@@ -2156,28 +2200,6 @@
# This function was autogenerated by boilerplate.py. Do not edit as
# changes will be lost
-def hexbin(*args, **kwargs):
- # allow callers to override the hold state by passing hold=True|False
- b = ishold()
- h = kwargs.pop('hold', None)
- if h is not None:
- hold(h)
- try:
- ret = gca().hexbin(*args, **kwargs)
- draw_if_interactive()
- except:
- hold(b)
- raise
- gci._current = ret
- hold(b)
- return ret
-if Axes.hexbin.__doc__ is not None:
- hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py. Do not edit as
-# changes will be lost
def semilogx(*args, **kwargs):
# allow callers to override the hold state by passing hold=True|False
b = ishold()
@@ -2438,10 +2460,8 @@
# changes will be lost
def autumn():
'''
- Set the default colormap to *autumn* and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to autumn and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='autumn')
im = gci()
@@ -2455,10 +2475,8 @@
# changes will be lost
def bone():
'''
- Set the default colormap to bone and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to bone and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='bone')
im = gci()
@@ -2472,10 +2490,8 @@
# changes will be lost
def cool():
'''
- Set the default colormap to cool and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to cool and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='cool')
im = gci()
@@ -2489,10 +2505,8 @@
# changes will be lost
def copper():
'''
- Set the default colormap to copper and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to copper and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='copper')
im = gci()
@@ -2506,10 +2520,8 @@
# changes will be lost
def flag():
'''
- Set the default colormap to flag and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to flag and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='flag')
im = gci()
@@ -2523,10 +2535,8 @@
# changes will be lost
def gray():
'''
- Set the default colormap to gray and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to gray and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='gray')
im = gci()
@@ -2540,10 +2550,8 @@
# changes will be lost
def hot():
'''
- Set the default colormap to hot and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to hot and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='hot')
im = gci()
@@ -2557,10 +2565,8 @@
# changes will be lost
def hsv():
'''
- Set the default colormap to hsv and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to hsv and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='hsv')
im = gci()
@@ -2574,10 +2580,8 @@
# changes will be lost
def jet():
'''
- Set the default colormap to jet and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to jet and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='jet')
im = gci()
@@ -2591,10 +2595,8 @@
# changes will be lost
def pink():
'''
- Set the default colormap to pink and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to pink and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='pink')
im = gci()
@@ -2608,10 +2610,8 @@
# changes will be lost
def prism():
'''
- Set the default colormap to prism and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to prism and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='prism')
im = gci()
@@ -2625,10 +2625,8 @@
# changes will be lost
def spring():
'''
- Set the default colormap to spring and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to spring and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='spring')
im = gci()
@@ -2642,10 +2640,8 @@
# changes will be lost
def summer():
'''
- Set the default colormap to summer and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to summer and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='summer')
im = gci()
@@ -2659,10 +2655,8 @@
# changes will be lost
def winter():
'''
- Set the default colormap to winter and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to winter and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='winter')
im = gci()
@@ -2676,10 +2670,8 @@
# changes will be lost
def spectral():
'''
- Set the default colormap to spectral and apply to current image if any.
-
- .. seealso::
- :func:`colormaps`
+ set the default colormap to spectral and apply to current image if any.
+ See help(colormaps) for more information
'''
rc('image', cmap='spectral')
im = gci()
@@ -2687,3 +2679,5 @@
if im is not None:
im.set_cmap(cm.spectral)
draw_if_interactive()
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-23 19:18:29
|
Revision: 6436
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6436&view=rev
Author: jdh2358
Date: 2008-11-23 19:18:24 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
fixed text docstring
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2008-11-23 19:16:40 UTC (rev 6435)
+++ trunk/matplotlib/lib/matplotlib/text.py 2008-11-23 19:18:24 UTC (rev 6436)
@@ -375,7 +375,7 @@
if not isinstance(self.arrow_patch, FancyArrowPatch):
return
-
+
if self._bbox_patch:
trans = self.get_transform()
@@ -1295,8 +1295,8 @@
instance is created with the given dictionary and is
drawn. Otherwise, a YAArow patch instance is created and
drawn. Valid keys for YAArow are
-
+
========= ===========================================================
Key Description
========= ===========================================================
@@ -1314,10 +1314,10 @@
Valid keys for FancyArrowPatch are
-
+
=============== ======================================================
- Key Description
+ Key Description
=============== ======================================================
arrowstyle
connectionstyle
@@ -1383,7 +1383,7 @@
self.arrowprops = arrowprops
self.arrow = None
-
+
if arrowprops and arrowprops.has_key("arrowstyle"):
self._arrow_relpos = arrowprops.pop("relpos", (0.5, 0.5))
@@ -1392,7 +1392,7 @@
else:
self.arrow_patch = None
-
+
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
def contains(self,event):
@@ -1402,7 +1402,7 @@
t = t or a
# self.arrow_patch is currently not checked as this can be a line - JJ
-
+
return t,tinfo
@@ -1551,7 +1551,7 @@
# Then it will be shrinked by shirnkA and shrinkB
# (in points). If patch A is not set, self.bbox_patch
# is used.
-
+
self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1))
mutation_scale = d.pop("mutation_scale", self.get_size())
self.arrow_patch.set_mutation_scale(mutation_scale)
@@ -1562,7 +1562,7 @@
else:
patchA = d.pop("patchA", self._bbox)
self.arrow_patch.set_patchA(patchA)
-
+
else:
# pick the x,y corner of the text bbox closest to point
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-23 19:16:44
|
Revision: 6435
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6435&view=rev
Author: jdh2358
Date: 2008-11-23 19:16:40 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
remove deprecated fill example
Removed Paths:
-------------
trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py
Deleted: trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py 2008-11-23 19:15:01 UTC (rev 6434)
+++ trunk/matplotlib/examples/pylab_examples/fill_between_posneg.py 2008-11-23 19:16:40 UTC (rev 6435)
@@ -1,101 +0,0 @@
-#!/usr/bin/env python
-"""
-From: James Boyle <bo...@ll...>
-Subject: possible candidate for examples directory using fill
-To: John Hunter <jdh...@ni...>
-Date: Tue, 8 Mar 2005 15:44:11 -0800
-
-I often compare the output from two sensors and I am interested in the
-sign of the differences.
-
-I wrote the enclosed code for find the polygons of the positive and
-negative regions of the difference of two curves. It is written for
-simple-minded straightforwardness rather than speed or elegance.
-It is easy to fill in the two sets of polygons with contrasting colors.
-For efficiency one could use collections but my curves are such that
-fill is quick enough.
-
-The code uses a simple linear technique to find the crossover point,
-this too could be made more sophisticated if one desired.
-
-I have found this code to be very handy for the comparisons I perform
--
-maybe someone else would find it useful.
-
---Jim
-"""
-
-#!/usr/bin/env python
-
-from pylab import *
-
-def findZero(i,x,y1,y2):
- im1 = i-1
- m1 = (y1[i] - y1[im1])/(x[i] - x[im1])
- m2 = (y2[i] - y2[im1])/(x[i] - x[im1])
- b1 = y1[im1] - m1*x[im1]
- b2 = y2[im1] - m2*x[im1]
- xZero = (b1 - b2)/(m2 - m1)
- yZero = m1*xZero + b1
- return (xZero, yZero)
-
-def posNegFill(x,y1,y2):
- diff = y2 - y1
- pos = []
- neg = []
- xx1 = [x[0]]
- xx2 = [x[0]]
- yy1 = [y1[0]]
- yy2 = [y2[0]]
- oldSign = (diff[0] < 0 )
- npts = x.shape[0]
- for i in range(1,npts):
- newSign = (diff[i] < 0)
- if newSign != oldSign:
- xz,yz = findZero(i,x,y1,y2)
- xx1.append(xz)
- yy1.append(yz)
- xx2.reverse()
- xx1.extend(xx2)
- yy2.reverse()
- yy1.extend(yy2)
- if oldSign:
- neg.append( (xx1,yy1) )
- else:
- pos.append( (xx1,yy1) )
- xx1 = [xz,x[i]]
- xx2 = [xz,x[i]]
- yy1 = [yz,y1[i]]
- yy2 = [yz,y2[i]]
- oldSign = newSign
- else:
- xx1.append( x[i])
- xx2.append( x[i])
- yy1.append(y1[i])
- yy2.append(y2[i])
- if i == npts-1:
- xx2.reverse()
- xx1.extend(xx2)
- yy2.reverse()
- yy1.extend(yy2)
- if oldSign :
- neg.append( (xx1,yy1) )
- else:
- pos.append( (xx1,yy1) )
- return pos,neg
-
-x1 = arange(0, 2, 0.01)
-y1 = sin(2*pi*x1)
-y2 = sin(4*pi*x1)
-
-# find positive and negative polygons of difference
-pos,neg = posNegFill(x1,y1,y2)
-# positive y2 > y1 is blue
-for x,y in pos:
- p = fill(x,y,'b')
-
-# negative Y2 < y1 is red
-for x,y in neg:
- p = fill(x,y,'r')
-
-show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-23 19:15:04
|
Revision: 6434
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6434&view=rev
Author: jdh2358
Date: 2008-11-23 19:15:01 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
updated api for fill_between_where and span_where
Modified Paths:
--------------
trunk/matplotlib/examples/api/fill_where_demo.py
trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/examples/api/fill_where_demo.py
===================================================================
--- trunk/matplotlib/examples/api/fill_where_demo.py 2008-11-23 19:05:58 UTC (rev 6433)
+++ trunk/matplotlib/examples/api/fill_where_demo.py 2008-11-23 19:15:01 UTC (rev 6434)
@@ -1,6 +1,9 @@
"""
Illustrate some helper functions for shading regions where a logical
mask is True
+
+See :meth:`matplotlib.collections.PolyCollection.fill_between_where`
+and :meth:`matplotlib.collections.BrokenBarHCollection.span_where`
"""
import numpy as np
import matplotlib.pyplot as plt
@@ -18,26 +21,26 @@
ax.axhline(0, color='black', lw=2)
collection = collections.PolyCollection.fill_between_where(
- t, s1, s2, s1>=s2, color='green', alpha=0.5)
+ t, s1, s2, where=s1>=s2, color='green', alpha=0.5)
ax.add_collection(collection)
collection = collections.PolyCollection.fill_between_where(
- t, s1, s2, s1<=s2, color='red', alpha=0.5)
+ t, s1, s2, where=s1<=s2, color='red', alpha=0.5)
ax.add_collection(collection)
fig = plt.figure()
ax = fig.add_subplot(111)
-ax.set_title('using span_masked')
+ax.set_title('using span_where')
ax.plot(t, s1, '-')
ax.axhline(0, color='black', lw=2)
-collection = collections.BrokenBarHCollection.span_masked(
- t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_where(
+ t, ymin=0, ymax=1, where=s1>0, facecolor='green', alpha=0.5)
ax.add_collection(collection)
-collection = collections.BrokenBarHCollection.span_masked(
- t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_where(
+ t, ymin=-1, ymax=0, where=s1<0, facecolor='red', alpha=0.5)
ax.add_collection(collection)
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-11-23 19:05:58 UTC (rev 6433)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-11-23 19:15:01 UTC (rev 6434)
@@ -674,10 +674,10 @@
@staticmethod
- def fill_between_where(x, y1, y2, mask, **kwargs):
+ def fill_between_where(x, y1, y2, where, **kwargs):
"""
Create a :class:`PolyCollection` filling the regions between *y*
- and *yboundary7* where ``mask==True``
+ and *yboundary7* where ``where==True``
*x*
@@ -689,7 +689,7 @@
*y2*
an N length scalar or np array of the x data
- *mask*
+ *where*
an N length numpy boolean array
*kwargs*
@@ -705,7 +705,7 @@
assert( (len(x)==len(y1)) and (len(x)==len(y2)) )
polys = []
- for ind0, ind1 in mlab.contiguous_regions(mask):
+ for ind0, ind1 in mlab.contiguous_regions(where):
theseverts = []
xslice = x[ind0:ind1]
y1slice = y1[ind0:ind1]
@@ -756,17 +756,17 @@
@staticmethod
- def span_masked(x, mask, ymin, ymax, **kwargs):
+ def span_where(x, ymin, ymax, where, **kwargs):
"""
Create a BrokenBarHCollection to plot horizontal bars from
- over the regions in *x* where *mask* is True. The bars range
+ over the regions in *x* where *where* is True. The bars range
on the y-axis from *ymin* to *ymax*
A :class:`BrokenBarHCollection` is returned.
**kwargs are passed on to the collection
"""
xranges = []
- for ind0, ind1 in mlab.contiguous_regions(mask):
+ for ind0, ind1 in mlab.contiguous_regions(where):
xslice = x[ind0:ind1]
if not len(xslice):
continue
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-23 19:06:02
|
Revision: 6433
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6433&view=rev
Author: jdh2358
Date: 2008-11-23 19:05:58 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
renamed fill where examples
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
Added Paths:
-----------
trunk/matplotlib/examples/api/fill_where_demo.py
Removed Paths:
-------------
trunk/matplotlib/examples/api/filled_masked_regions.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-11-23 19:04:35 UTC (rev 6432)
+++ trunk/matplotlib/CHANGELOG 2008-11-23 19:05:58 UTC (rev 6433)
@@ -1,10 +1,7 @@
2008-11-20 Added some static helper methods
BrokenHBarCollection.span_masked and
- PolyCollection.fill_between_masked for visualizing
- non-masked regions. In the longer term, the better
- solution will be to fix the relevant classes and functions
- to handle masked data, so this may be a temporary solution
- - JDH
+ PolyCollection.fill_between_where for visualizing logical
+ regions. See examples/api/fill_where_demo.py - JDH
2008-11-12 Add x_isdata and y_isdata attributes to Artist instances,
and use them to determine whether either or both
Copied: trunk/matplotlib/examples/api/fill_where_demo.py (from rev 6432, trunk/matplotlib/examples/api/filled_masked_regions.py)
===================================================================
--- trunk/matplotlib/examples/api/fill_where_demo.py (rev 0)
+++ trunk/matplotlib/examples/api/fill_where_demo.py 2008-11-23 19:05:58 UTC (rev 6433)
@@ -0,0 +1,50 @@
+"""
+Illustrate some helper functions for shading regions where a logical
+mask is True
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.collections as collections
+
+
+t = np.arange(0.0, 2, 0.01)
+s1 = np.sin(2*np.pi*t)
+s2 = 1.2*np.sin(4*np.pi*t)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using fill_between_where')
+ax.plot(t, s1, t, s2)
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.PolyCollection.fill_between_where(
+ t, s1, s2, s1>=s2, color='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.PolyCollection.fill_between_where(
+ t, s1, s2, s1<=s2, color='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using span_masked')
+ax.plot(t, s1, '-')
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.BrokenBarHCollection.span_masked(
+ t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.BrokenBarHCollection.span_masked(
+ t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+
+plt.show()
+
+
+
+
+
Deleted: trunk/matplotlib/examples/api/filled_masked_regions.py
===================================================================
--- trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-23 19:04:35 UTC (rev 6432)
+++ trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-23 19:05:58 UTC (rev 6433)
@@ -1,50 +0,0 @@
-"""
-Illustrate some helper functions for shading regions where a logical
-mask is True
-"""
-import numpy as np
-import matplotlib.pyplot as plt
-import matplotlib.collections as collections
-
-
-t = np.arange(0.0, 2, 0.01)
-s1 = np.sin(2*np.pi*t)
-s2 = 1.2*np.sin(4*np.pi*t)
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.set_title('using fill_between_where')
-ax.plot(t, s1, t, s2)
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.PolyCollection.fill_between_where(
- t, s1, s2, s1>=s2, color='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.PolyCollection.fill_between_where(
- t, s1, s2, s1<=s2, color='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-fig = plt.figure()
-ax = fig.add_subplot(111)
-ax.set_title('using span_masked')
-ax.plot(t, s1, '-')
-ax.axhline(0, color='black', lw=2)
-
-collection = collections.BrokenBarHCollection.span_masked(
- t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
-ax.add_collection(collection)
-
-collection = collections.BrokenBarHCollection.span_masked(
- t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
-ax.add_collection(collection)
-
-
-
-plt.show()
-
-
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-23 19:04:40
|
Revision: 6432
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6432&view=rev
Author: jdh2358
Date: 2008-11-23 19:04:35 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
generalized fill between poly collection
Modified Paths:
--------------
trunk/matplotlib/examples/api/filled_masked_regions.py
trunk/matplotlib/lib/matplotlib/collections.py
Modified: trunk/matplotlib/examples/api/filled_masked_regions.py
===================================================================
--- trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-21 18:20:00 UTC (rev 6431)
+++ trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-23 19:04:35 UTC (rev 6432)
@@ -8,31 +8,36 @@
t = np.arange(0.0, 2, 0.01)
-s = np.sin(2*np.pi*t)
+s1 = np.sin(2*np.pi*t)
+s2 = 1.2*np.sin(4*np.pi*t)
fig = plt.figure()
ax = fig.add_subplot(111)
-ax.set_title('using fill_between_masked')
-ax.plot(t, s, '-')
+ax.set_title('using fill_between_where')
+ax.plot(t, s1, t, s2)
ax.axhline(0, color='black', lw=2)
-collection = collections.PolyCollection.fill_between_masked(t, s, s>=0, yboundary=0, color='green', alpha=0.5)
+collection = collections.PolyCollection.fill_between_where(
+ t, s1, s2, s1>=s2, color='green', alpha=0.5)
ax.add_collection(collection)
-collection = collections.PolyCollection.fill_between_masked(t, s, s<=0, yboundary=0, color='red', alpha=0.5)
+collection = collections.PolyCollection.fill_between_where(
+ t, s1, s2, s1<=s2, color='red', alpha=0.5)
ax.add_collection(collection)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('using span_masked')
-ax.plot(t, s, '-')
+ax.plot(t, s1, '-')
ax.axhline(0, color='black', lw=2)
-collection = collections.BrokenBarHCollection.span_masked(t, s>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_masked(
+ t, s1>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
ax.add_collection(collection)
-collection = collections.BrokenBarHCollection.span_masked(t, s<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
+collection = collections.BrokenBarHCollection.span_masked(
+ t, s1<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
ax.add_collection(collection)
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-11-21 18:20:00 UTC (rev 6431)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-11-23 19:04:35 UTC (rev 6432)
@@ -674,7 +674,7 @@
@staticmethod
- def fill_between_masked(x, y, mask, yboundary=0, **kwargs):
+ def fill_between_where(x, y1, y2, mask, **kwargs):
"""
Create a :class:`PolyCollection` filling the regions between *y*
and *yboundary7* where ``mask==True``
@@ -683,35 +683,50 @@
*x*
an N length np array of the x data
- *y*
- an N length np array of the y data
+ *y1*
+ an N length scalar or np array of the x data
+ *y2*
+ an N length scalar or np array of the x data
+
*mask*
an N length numpy boolean array
- *yboundary*
- a scalar to fill between *y* and the boundary
-
*kwargs*
keyword args passed on to the :class:`PolyCollection`
"""
+ if not cbook.iterable(y1):
+ y1 = np.ones_like(x)*y1
+
+ if not cbook.iterable(y2):
+ y2 = np.ones_like(x)*y2
+
+ assert( (len(x)==len(y1)) and (len(x)==len(y2)) )
+
polys = []
for ind0, ind1 in mlab.contiguous_regions(mask):
theseverts = []
xslice = x[ind0:ind1]
- yslice = y[ind0:ind1]
+ y1slice = y1[ind0:ind1]
+ y2slice = y2[ind0:ind1]
+
if not len(xslice):
continue
N = len(xslice)
X = np.zeros((2*N+2, 2), np.float)
- X[0] = xslice[0], yboundary
- X[N+1] = xslice[-1], yboundary
+
+ # the purpose of the next two lines is for when y2 is a
+ # scalar like 0 and we want the fill to go all the way
+ # down to 0 even if none of the y1 sample points do
+ X[0] = xslice[0], y2slice[0]
+ X[N+1] = xslice[-1], y2slice[-1]
+
X[1:N+1,0] = xslice
- X[1:N+1,1] = yslice
+ X[1:N+1,1] = y1slice
X[N+2:,0] = xslice[::-1]
- X[N+2:,1] = yboundary
+ X[N+2:,1] = y2slice[::-1]
polys.append(X)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-21 18:20:03
|
Revision: 6431
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6431&view=rev
Author: jdh2358
Date: 2008-11-21 18:20:00 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
raise on out of range text location in backend agg
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-11-21 16:52:25 UTC (rev 6430)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-11-21 18:20:00 UTC (rev 6431)
@@ -686,9 +686,8 @@
y = Py::Int( args[2] );
}
catch (Py::TypeError) {
- //x,y out of range; todo issue warning?
Py_XDECREF(image_array);
- return Py::Object();
+ throw Py::TypeError("Invalid input arguments to draw_text_image");
}
double angle = Py::Float( args[3] );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2008-11-21 16:52:29
|
Revision: 6430
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6430&view=rev
Author: leejjoon
Date: 2008-11-21 16:52:25 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
fixed a bug the get_text_width_height_descent() method of the pdf backend not returning the correct text height.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-11-21 11:28:32 UTC (rev 6429)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2008-11-21 16:52:25 UTC (rev 6430)
@@ -1577,7 +1577,8 @@
dvi = dviread.Dvi(dvifile, self.dpi)
page = iter(dvi).next()
dvi.close()
- return page.width, page.height, page.descent
+ # A total height (including the descent) needs to be returned.
+ return page.width, page.height+page.descent, page.descent
if ismath:
w, h, d, glyphs, rects, used_characters = \
self.mathtext_parser.parse(s, self.dpi, prop)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-21 11:28:35
|
Revision: 6429
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6429&view=rev
Author: jdh2358
Date: 2008-11-21 11:28:32 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
Merged revisions 6086,6365,6427-6428 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint
........
r6086 | mdboom | 2008-09-11 15:28:11 -0500 (Thu, 11 Sep 2008) | 2 lines
Fix backticks in PS output.
........
r6365 | mdboom | 2008-11-05 09:15:28 -0600 (Wed, 05 Nov 2008) | 1 line
Fix bug in zoom rectangle with twin axes
........
r6427 | jdh2358 | 2008-11-21 05:14:12 -0600 (Fri, 21 Nov 2008) | 1 line
fixed poly between
........
r6428 | jdh2358 | 2008-11-21 05:15:04 -0600 (Fri, 21 Nov 2008) | 1 line
fixed poly below
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/mlab.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6073,6149
+ /branches/v0_91_maint:1-6428
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-11-21 11:15:04 UTC (rev 6428)
+++ trunk/matplotlib/CHANGELOG 2008-11-21 11:28:32 UTC (rev 6429)
@@ -54,6 +54,10 @@
2008-10-08 Add path simplification support to paths with gaps. - EF
+=======
+2008-11-05 Fix bug with zoom to rectangle and twin axes - MGD
+
+>>>>>>> .merge-right.r6428
2008-10-05 Fix problem with AFM files that don't specify the font's
full name or family name. - JKS
@@ -97,6 +101,10 @@
2008-09-10 Add "filled" kwarg to Path.intersects_path and
Path.intersects_bbox. - MGD
+=======
+2008-09-11 Fix use of backticks in PS - MGD
+
+>>>>>>> .merge-right.r6086
2008-09-07 Changed full arrows slightly to avoid an xpdf rendering
problem reported by Friedrich Hagedorn. - JKS
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-11-21 11:15:04 UTC (rev 6428)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-11-21 11:28:32 UTC (rev 6429)
@@ -1883,6 +1883,8 @@
for cur_xypress in self._xypress:
x, y = event.x, event.y
lastx, lasty, a, ind, lim, trans = cur_xypress
+ if a._sharex or a._sharey:
+ continue
# ignore singular clicks - 5 pixels is a threshold
if abs(x-lastx)<5 or abs(y-lasty)<5:
self._xypress = None
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-11-21 11:15:04 UTC (rev 6428)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-11-21 11:28:32 UTC (rev 6429)
@@ -1438,6 +1438,181 @@
else: return X
+def slopes(x,y):
+ """
+ SLOPES calculate the slope y'(x) Given data vectors X and Y SLOPES
+ calculates Y'(X), i.e the slope of a curve Y(X). The slope is
+ estimated using the slope obtained from that of a parabola through
+ any three consecutive points.
+
+ This method should be superior to that described in the appendix
+ of A CONSISTENTLY WELL BEHAVED METHOD OF INTERPOLATION by Russel
+ W. Stineman (Creative Computing July 1980) in at least one aspect:
+
+ Circles for interpolation demand a known aspect ratio between x-
+ and y-values. For many functions, however, the abscissa are given
+ in different dimensions, so an aspect ratio is completely
+ arbitrary.
+
+ The parabola method gives very similar results to the circle
+ method for most regular cases but behaves much better in special
+ cases
+
+ Norbert Nemec, Institute of Theoretical Physics, University or
+ Regensburg, April 2006 Norbert.Nemec at physik.uni-regensburg.de
+
+ (inspired by a original implementation by Halldor Bjornsson,
+ Icelandic Meteorological Office, March 2006 halldor at vedur.is)
+ """
+ # Cast key variables as float.
+ x=np.asarray(x, np.float_)
+ y=np.asarray(y, np.float_)
+
+ yp=np.zeros(y.shape, np.float_)
+
+ dx=x[1:] - x[:-1]
+ dy=y[1:] - y[:-1]
+ dydx = dy/dx
+ yp[1:-1] = (dydx[:-1] * dx[1:] + dydx[1:] * dx[:-1])/(dx[1:] + dx[:-1])
+ yp[0] = 2.0 * dy[0]/dx[0] - yp[1]
+ yp[-1] = 2.0 * dy[-1]/dx[-1] - yp[-2]
+ return yp
+
+
+def stineman_interp(xi,x,y,yp=None):
+ """
+ STINEMAN_INTERP Well behaved data interpolation. Given data
+ vectors X and Y, the slope vector YP and a new abscissa vector XI
+ the function stineman_interp(xi,x,y,yp) uses Stineman
+ interpolation to calculate a vector YI corresponding to XI.
+
+ Here's an example that generates a coarse sine curve, then
+ interpolates over a finer abscissa:
+
+ x = linspace(0,2*pi,20); y = sin(x); yp = cos(x)
+ xi = linspace(0,2*pi,40);
+ yi = stineman_interp(xi,x,y,yp);
+ plot(x,y,'o',xi,yi)
+
+ The interpolation method is described in the article A
+ CONSISTENTLY WELL BEHAVED METHOD OF INTERPOLATION by Russell
+ W. Stineman. The article appeared in the July 1980 issue of
+ Creative Computing with a note from the editor stating that while
+ they were
+
+ not an academic journal but once in a while something serious
+ and original comes in adding that this was
+ "apparently a real solution" to a well known problem.
+
+ For yp=None, the routine automatically determines the slopes using
+ the "slopes" routine.
+
+ X is assumed to be sorted in increasing order
+
+ For values xi[j] < x[0] or xi[j] > x[-1], the routine tries a
+ extrapolation. The relevance of the data obtained from this, of
+ course, questionable...
+
+ original implementation by Halldor Bjornsson, Icelandic
+ Meteorolocial Office, March 2006 halldor at vedur.is
+
+ completely reworked and optimized for Python by Norbert Nemec,
+ Institute of Theoretical Physics, University or Regensburg, April
+ 2006 Norbert.Nemec at physik.uni-regensburg.de
+
+ """
+
+ # Cast key variables as float.
+ x=np.asarray(x, np.float_)
+ y=np.asarray(y, np.float_)
+ assert x.shape == y.shape
+ N=len(y)
+
+ if yp is None:
+ yp = slopes(x,y)
+ else:
+ yp=np.asarray(yp, np.float_)
+
+ xi=np.asarray(xi, np.float_)
+ yi=np.zeros(xi.shape, np.float_)
+
+ # calculate linear slopes
+ dx = x[1:] - x[:-1]
+ dy = y[1:] - y[:-1]
+ s = dy/dx #note length of s is N-1 so last element is #N-2
+
+ # find the segment each xi is in
+ # this line actually is the key to the efficiency of this implementation
+ idx = np.searchsorted(x[1:-1], xi)
+
+ # now we have generally: x[idx[j]] <= xi[j] <= x[idx[j]+1]
+ # except at the boundaries, where it may be that xi[j] < x[0] or xi[j] > x[-1]
+
+ # the y-values that would come out from a linear interpolation:
+ sidx = s.take(idx)
+ xidx = x.take(idx)
+ yidx = y.take(idx)
+ xidxp1 = x.take(idx+1)
+ yo = yidx + sidx * (xi - xidx)
+
+ # the difference that comes when using the slopes given in yp
+ dy1 = (yp.take(idx)- sidx) * (xi - xidx) # using the yp slope of the left point
+ dy2 = (yp.take(idx+1)-sidx) * (xi - xidxp1) # using the yp slope of the right point
+
+ dy1dy2 = dy1*dy2
+ # The following is optimized for Python. The solution actually
+ # does more calculations than necessary but exploiting the power
+ # of numpy, this is far more efficient than coding a loop by hand
+ # in Python
+ yi = yo + dy1dy2 * np.choose(np.array(np.sign(dy1dy2), np.int32)+1,
+ ((2*xi-xidx-xidxp1)/((dy1-dy2)*(xidxp1-xidx)),
+ 0.0,
+ 1/(dy1+dy2),))
+ return yi
+
+def inside_poly(points, verts):
+ """
+ points is a sequence of x,y points
+ verts is a sequence of x,y vertices of a poygon
+
+ return value is a sequence of indices into points for the points
+ that are inside the polygon
+ """
+ res, = np.nonzero(nxutils.points_inside_poly(points, verts))
+ return res
+
+def poly_below(ymin, xs, ys):
+ """
+ given a arrays *xs* and *ys*, return the vertices of a polygon
+ that has a scalar lower bound *ymin* and an upper bound at the *ys*.
+
+ intended for use with Axes.fill, eg::
+
+ xv, yv = poly_below(0, x, y)
+ ax.fill(xv, yv)
+ """
+ return poly_between(xs, ys, xmin)
+
+
+def poly_between(x, ylower, yupper):
+ """
+ given a sequence of x, ylower and yupper, return the polygon that
+ fills the regions between them. ylower or yupper can be scalar or
+ iterable. If they are iterable, they must be equal in length to x
+
+ return value is x, y arrays for use with Axes.fill
+ """
+ Nx = len(x)
+ if not cbook.iterable(ylower):
+ ylower = ylower*np.ones(Nx)
+
+ if not cbook.iterable(yupper):
+ yupper = yupper*np.ones(Nx)
+
+ x = np.concatenate( (x, x[::-1]) )
+ y = np.concatenate( (yupper, ylower[::-1]) )
+ return x,y
+
### the following code was written and submitted by Fernando Perez
### from the ipython numutils package under a BSD license
# begin fperez functions
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-21 11:15:08
|
Revision: 6428
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6428&view=rev
Author: jdh2358
Date: 2008-11-21 11:15:04 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
fixed poly below
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/mlab.py
Modified: branches/v0_91_maint/lib/matplotlib/mlab.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/mlab.py 2008-11-21 11:14:12 UTC (rev 6427)
+++ branches/v0_91_maint/lib/matplotlib/mlab.py 2008-11-21 11:15:04 UTC (rev 6428)
@@ -1435,9 +1435,10 @@
that has a horzintal base at ymin and an upper bound at the ys.
ymin is a scalar, and xs and ys are arrays
- intended for use with Axes.fill, eg
- xv, yv = poly_below(0, x, y)
- ax.fill(xv, yv)
+ intended for use with Axes.fill, eg::
+
+ xv, yv = poly_below(0, x, y)
+ ax.fill(xv, yv)
"""
return poly_between(xs, ys, xmin)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-21 11:14:18
|
Revision: 6427
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6427&view=rev
Author: jdh2358
Date: 2008-11-21 11:14:12 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
fixed poly between
Modified Paths:
--------------
branches/v0_91_maint/lib/matplotlib/mlab.py
Modified: branches/v0_91_maint/lib/matplotlib/mlab.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/mlab.py 2008-11-21 00:06:53 UTC (rev 6426)
+++ branches/v0_91_maint/lib/matplotlib/mlab.py 2008-11-21 11:14:12 UTC (rev 6427)
@@ -1429,27 +1429,17 @@
res, = np.nonzero(nxutils.points_inside_poly(points, verts))
return res
-def poly_below(xmin, xs, ys):
+def poly_below(ymin, xs, ys):
"""
given a sequence of xs and ys, return the vertices of a polygon
- that has a horzontal base at xmin and an upper bound at the ys.
- xmin is a scalar.
+ that has a horzintal base at ymin and an upper bound at the ys.
+ ymin is a scalar, and xs and ys are arrays
intended for use with Axes.fill, eg
xv, yv = poly_below(0, x, y)
ax.fill(xv, yv)
"""
- xs = np.asarray(xs)
- ys = np.asarray(ys)
- Nx = len(xs)
- Ny = len(ys)
- assert(Nx==Ny)
- x = xmin*np.ones(2*Nx)
- y = np.ones(2*Nx)
- x[:Nx] = xs
- y[:Nx] = ys
- y[Nx:] = ys[::-1]
- return x, y
+ return poly_between(xs, ys, xmin)
def poly_between(x, ylower, yupper):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-11-21 00:07:05
|
Revision: 6426
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6426&view=rev
Author: efiring
Date: 2008-11-21 00:06:53 +0000 (Fri, 21 Nov 2008)
Log Message:
-----------
Add an embryonic usage_faq.rst, based on a reply to a question on the list
Modified Paths:
--------------
trunk/matplotlib/doc/faq/index.rst
Added Paths:
-----------
trunk/matplotlib/doc/faq/usage_faq.rst
Modified: trunk/matplotlib/doc/faq/index.rst
===================================================================
--- trunk/matplotlib/doc/faq/index.rst 2008-11-20 23:03:17 UTC (rev 6425)
+++ trunk/matplotlib/doc/faq/index.rst 2008-11-21 00:06:53 UTC (rev 6426)
@@ -15,6 +15,6 @@
:maxdepth: 2
installing_faq.rst
- usage.rst
+ usage_faq.rst
howto_faq.rst
troubleshooting_faq.rst
Added: trunk/matplotlib/doc/faq/usage_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/usage_faq.rst (rev 0)
+++ trunk/matplotlib/doc/faq/usage_faq.rst 2008-11-21 00:06:53 UTC (rev 6426)
@@ -0,0 +1,82 @@
+.. _usage-faq:
+
+***************
+Usage
+***************
+
+.. contents::
+ :backlinks: none
+
+.. _pylab:
+
+Matplotlib, pylab, and pyplot: how are they related?
+====================================================
+
+Matplotlib is the whole package; :mod:`pylab` is a module in matplotlib
+that gets
+installed alongside :mod:`matplotlib`; and :mod:`matplotlib.pyplot` is a
+module in matplotlib.
+
+Pyplot provides a Matlab-style state-machine interface to
+the underlying object-oriented plotting library in matplotlib.
+
+Pylab combines the pyplot functionality (for plotting) with the numpy
+functionality (for mathematics and for working with arrays)
+in a single namespace, making that namespace
+(or environment) even more Matlab-like. This is what you get if
+you use the
+*ipython* shell with the *-pylab* option, which imports everything
+from pylab and makes plotting fully interactive.
+
+We have been gradually converting the matplotlib examples
+from pure Matlab-style, using "from pylab import \*", to a preferred
+style in which pyplot is used for some convenience functions, either
+pyplot or the object-oriented style is used for the remainder of the
+plotting code, and numpy is used explicitly for numeric array operations.
+
+In this preferred style, the imports at the top are::
+
+ import matplotlib.pyplot as plt
+ import numpy as np
+
+Then one calls, for example, np.arange, np.zeros, np.pi, plt.figure,
+plt.plot, plt.show, etc.
+
+Example, pure Matlab-style::
+
+ from pylab import *
+ x = arange(0, 10, 0.2)
+ y = sin(x)
+ plot(x, y)
+ show()
+
+Now in preferred style, but still using pyplot interface::
+
+ import matplotlib.pyplot as plt
+ import numpy as np
+ x = np.arange(0, 10, 0.2)
+ y = np.sin(x)
+ plt.plot(x, y)
+ plt.show()
+
+And using pyplot convenience functions, but object-orientation for the rest::
+
+ import matplotlib.pyplot as plt
+ import numpy as np
+ x = np.arange(0, 10, 0.2)
+ y = np.sin(x)
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.plot(x, y)
+ plt.show()
+
+So, why do all the extra typing required as one moves away from the pure
+matlab-style? For very simple things like this example, the only
+advantage is educational: the wordier styles are more explicit, more
+clear as to where things come from and what is going on. For more
+complicated applications, the explicitness and clarity become
+increasingly valuable, and the richer and more complete object-oriented
+interface will likely make the program easier to write and maintain.
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-11-20 23:03:34
|
Revision: 6425
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6425&view=rev
Author: efiring
Date: 2008-11-20 23:03:17 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
Fix specification of gray level in slider_demo; thanks to Matthias Michler
Modified Paths:
--------------
trunk/matplotlib/examples/widgets/slider_demo.py
Modified: trunk/matplotlib/examples/widgets/slider_demo.py
===================================================================
--- trunk/matplotlib/examples/widgets/slider_demo.py 2008-11-20 20:22:08 UTC (rev 6424)
+++ trunk/matplotlib/examples/widgets/slider_demo.py 2008-11-20 23:03:17 UTC (rev 6425)
@@ -26,7 +26,7 @@
samp.on_changed(update)
resetax = axes([0.8, 0.025, 0.1, 0.04])
-button = Button(resetax, 'Reset', color=axcolor, hovercolor=0.975)
+button = Button(resetax, 'Reset', color=axcolor, hovercolor='0.975')
def reset(event):
sfreq.reset()
samp.reset()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-20 20:22:13
|
Revision: 6424
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6424&view=rev
Author: jdh2358
Date: 2008-11-20 20:22:08 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
reverted a bug I introduced when toying around with copy region in agg
Modified Paths:
--------------
trunk/matplotlib/examples/event_handling/path_editor.py
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/examples/event_handling/path_editor.py
===================================================================
--- trunk/matplotlib/examples/event_handling/path_editor.py 2008-11-20 18:58:54 UTC (rev 6423)
+++ trunk/matplotlib/examples/event_handling/path_editor.py 2008-11-20 20:22:08 UTC (rev 6424)
@@ -1,3 +1,5 @@
+import matplotlib
+matplotlib.use('TkAgg')
import numpy as np
import matplotlib.path as mpath
import matplotlib.patches as mpatches
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-11-20 18:58:54 UTC (rev 6423)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-11-20 20:22:08 UTC (rev 6424)
@@ -701,6 +701,9 @@
theseverts = []
xslice = x[ind0:ind1]
yslice = y[ind0:ind1]
+ if not len(xslice):
+ continue
+
N = len(xslice)
X = np.zeros((2*N+2, 2), np.float)
X[0] = xslice[0], yboundary
@@ -750,6 +753,8 @@
xranges = []
for ind0, ind1 in mlab.contiguous_regions(mask):
xslice = x[ind0:ind1]
+ if not len(xslice):
+ continue
xranges.append((xslice[0], xslice[-1]-xslice[0]))
collection = BrokenBarHCollection(xranges, [ymin, ymax-ymin], **kwargs)
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-11-20 18:58:54 UTC (rev 6423)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-11-20 20:22:08 UTC (rev 6424)
@@ -386,7 +386,7 @@
throw Py::TypeError("Invalid bbox provided to copy_from_bbox");
// std::cout << l << " " << b << " " << r << " " << t << " " << (height - (int)b) << " " << height - (int)t << std::endl;
- agg::rect_i rect((int)l, height - (int)b, (int)r, height - (int)t);
+ agg::rect_i rect((int)l, height - (int)t, (int)r, height - (int)b);
BufferRegion* reg = NULL;
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-20 18:58:57
|
Revision: 6423
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6423&view=rev
Author: jdh2358
Date: 2008-11-20 18:58:54 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
added some helper functions for poly collections and masked regions
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/src/_backend_agg.cpp
Added Paths:
-----------
trunk/matplotlib/examples/api/filled_masked_regions.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-11-20 15:46:46 UTC (rev 6422)
+++ trunk/matplotlib/CHANGELOG 2008-11-20 18:58:54 UTC (rev 6423)
@@ -1,3 +1,11 @@
+2008-11-20 Added some static helper methods
+ BrokenHBarCollection.span_masked and
+ PolyCollection.fill_between_masked for visualizing
+ non-masked regions. In the longer term, the better
+ solution will be to fix the relevant classes and functions
+ to handle masked data, so this may be a temporary solution
+ - JDH
+
2008-11-12 Add x_isdata and y_isdata attributes to Artist instances,
and use them to determine whether either or both
coordinates are used when updating dataLim. This is
Added: trunk/matplotlib/examples/api/filled_masked_regions.py
===================================================================
--- trunk/matplotlib/examples/api/filled_masked_regions.py (rev 0)
+++ trunk/matplotlib/examples/api/filled_masked_regions.py 2008-11-20 18:58:54 UTC (rev 6423)
@@ -0,0 +1,45 @@
+"""
+Illustrate some helper functions for shading regions where a logical
+mask is True
+"""
+import numpy as np
+import matplotlib.pyplot as plt
+import matplotlib.collections as collections
+
+
+t = np.arange(0.0, 2, 0.01)
+s = np.sin(2*np.pi*t)
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using fill_between_masked')
+ax.plot(t, s, '-')
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.PolyCollection.fill_between_masked(t, s, s>=0, yboundary=0, color='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.PolyCollection.fill_between_masked(t, s, s<=0, yboundary=0, color='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+fig = plt.figure()
+ax = fig.add_subplot(111)
+ax.set_title('using span_masked')
+ax.plot(t, s, '-')
+ax.axhline(0, color='black', lw=2)
+
+collection = collections.BrokenBarHCollection.span_masked(t, s>0, ymin=0, ymax=1, facecolor='green', alpha=0.5)
+ax.add_collection(collection)
+
+collection = collections.BrokenBarHCollection.span_masked(t, s<0, ymin=-1, ymax=0, facecolor='red', alpha=0.5)
+ax.add_collection(collection)
+
+
+
+plt.show()
+
+
+
+
+
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2008-11-20 15:46:46 UTC (rev 6422)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2008-11-20 18:58:54 UTC (rev 6423)
@@ -19,6 +19,7 @@
import matplotlib.artist as artist
import matplotlib.backend_bases as backend_bases
import matplotlib.path as mpath
+import matplotlib.mlab as mlab
class Collection(artist.Artist, cm.ScalarMappable):
"""
@@ -234,7 +235,7 @@
self._urls = [None,]
else:
self._urls = urls
-
+
def get_urls(self): return self._urls
def set_offsets(self, offsets):
@@ -671,6 +672,49 @@
for x in self._sizes]
return Collection.draw(self, renderer)
+
+ @staticmethod
+ def fill_between_masked(x, y, mask, yboundary=0, **kwargs):
+ """
+ Create a :class:`PolyCollection` filling the regions between *y*
+ and *yboundary7* where ``mask==True``
+
+
+ *x*
+ an N length np array of the x data
+
+ *y*
+ an N length np array of the y data
+
+ *mask*
+ an N length numpy boolean array
+
+ *yboundary*
+ a scalar to fill between *y* and the boundary
+
+ *kwargs*
+ keyword args passed on to the :class:`PolyCollection`
+
+ """
+ polys = []
+ for ind0, ind1 in mlab.contiguous_regions(mask):
+ theseverts = []
+ xslice = x[ind0:ind1]
+ yslice = y[ind0:ind1]
+ N = len(xslice)
+ X = np.zeros((2*N+2, 2), np.float)
+ X[0] = xslice[0], yboundary
+ X[N+1] = xslice[-1], yboundary
+ X[1:N+1,0] = xslice
+ X[1:N+1,1] = yslice
+ X[N+2:,0] = xslice[::-1]
+ X[N+2:,1] = yboundary
+
+ polys.append(X)
+
+ collection = PolyCollection(polys, **kwargs)
+ return collection
+
class BrokenBarHCollection(PolyCollection):
"""
A collection of horizontal bars spanning *yrange* with a sequence of
@@ -692,6 +736,25 @@
PolyCollection.__init__(self, verts, **kwargs)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
+
+ @staticmethod
+ def span_masked(x, mask, ymin, ymax, **kwargs):
+ """
+ Create a BrokenBarHCollection to plot horizontal bars from
+ over the regions in *x* where *mask* is True. The bars range
+ on the y-axis from *ymin* to *ymax*
+
+ A :class:`BrokenBarHCollection` is returned.
+ **kwargs are passed on to the collection
+ """
+ xranges = []
+ for ind0, ind1 in mlab.contiguous_regions(mask):
+ xslice = x[ind0:ind1]
+ xranges.append((xslice[0], xslice[-1]-xslice[0]))
+
+ collection = BrokenBarHCollection(xranges, [ymin, ymax-ymin], **kwargs)
+ return collection
+
class RegularPolyCollection(Collection):
"""Draw a collection of regular polygons with *numsides*."""
_path_generator = mpath.Path.unit_regular_polygon
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-11-20 15:46:46 UTC (rev 6422)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-11-20 18:58:54 UTC (rev 6423)
@@ -159,7 +159,7 @@
import csv, warnings, copy, os
import numpy as np
-
+ma = np.ma
from matplotlib import verbose
import matplotlib.nxutils as nxutils
@@ -247,7 +247,7 @@
#The checks for if y is x are so that we can use the same function to
#implement the core of psd(), csd(), and spectrogram() without doing
#extra calculations. We return the unaveraged Pxy, freqs, and t.
-
+
#Make sure we're dealing with a numpy array. If y and x were the same
#object to start with, keep them that way
same_data = y is x
@@ -309,7 +309,7 @@
Pxy /= (np.abs(windowVals)**2).sum()
t = 1./Fs * (ind + NFFT / 2.)
freqs = float(Fs) / pad_to * np.arange(numFreqs)
-
+
return Pxy, freqs, t
#Split out these keyword docs so that they can be used elsewhere
@@ -2104,7 +2104,8 @@
def csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',',
- converterd=None, names=None, missing='', missingd=None):
+ converterd=None, names=None, missing='', missingd=None,
+ use_mrecords=True):
"""
Load data from comma/space/tab delimited file in *fname* into a
numpy record array and return the record array.
@@ -2139,9 +2140,11 @@
be masked, e.g. '0000-00-00' or 'unused'
- *missing*: a string whose value signals a missing field regardless of
- the column it appears in, e.g. 'unused'
+ the column it appears in
- If no rows are found, *None* is returned -- see :file:`examples/loadrec.py`
+ - *use_mrecords*: if True, return an mrecords.fromrecords record array if any of the data are missing
+
+ If no rows are found, *None* is returned -- see :file:`examples/loadrec.py`
"""
if converterd is None:
@@ -2338,7 +2341,8 @@
if not len(rows):
return None
- if np.any(rowmasks):
+
+ if use_mrecords and np.any(rowmasks):
try: from numpy.ma import mrecords
except ImportError:
raise RuntimeError('numpy 1.05 or later is required for masked array support')
@@ -2938,19 +2942,25 @@
xv, yv = poly_below(0, x, y)
ax.fill(xv, yv)
"""
- xs = np.asarray(xs)
- ys = np.asarray(ys)
+ if ma.isMaskedArray(xs) or ma.isMaskedArray(ys):
+ nx = ma
+ else:
+ nx = np
+
+ xs = nx.asarray(xs)
+ ys = nx.asarray(ys)
Nx = len(xs)
Ny = len(ys)
assert(Nx==Ny)
- x = xmin*np.ones(2*Nx)
- y = np.ones(2*Nx)
+ x = xmin*nx.ones(2*Nx)
+ y = nx.ones(2*Nx)
x[:Nx] = xs
y[:Nx] = ys
y[Nx:] = ys[::-1]
return x, y
+
def poly_between(x, ylower, yupper):
"""
Given a sequence of *x*, *ylower* and *yupper*, return the polygon
@@ -2961,17 +2971,23 @@
Return value is *x*, *y* arrays for use with
:meth:`matplotlib.axes.Axes.fill`.
"""
+ if ma.isMaskedArray(ylower) or ma.isMaskedArray(yupper) or ma.isMaskedArray(x):
+ nx = ma
+ else:
+ nx = np
+
Nx = len(x)
if not cbook.iterable(ylower):
- ylower = ylower*np.ones(Nx)
+ ylower = ylower*nx.ones(Nx)
if not cbook.iterable(yupper):
- yupper = yupper*np.ones(Nx)
+ yupper = yupper*nx.ones(Nx)
- x = np.concatenate( (x, x[::-1]) )
- y = np.concatenate( (yupper, ylower[::-1]) )
+ x = nx.concatenate( (x, x[::-1]) )
+ y = nx.concatenate( (yupper, ylower[::-1]) )
return x,y
+
def is_closed_polygon(X):
"""
Tests whether first and last object in a sequence are the same. These are
@@ -2980,6 +2996,28 @@
"""
return np.all(X[0] == X[-1])
+
+def contiguous_regions(mask):
+ """
+ return a list of (ind0, ind1) such that mask[ind0:ind1].all() is
+ True and we cover all such regions
+
+ TODO: this is a pure python implementation which probably has a much faster numpy impl
+ """
+
+ in_region = None
+ boundaries = []
+ for i, val in enumerate(mask):
+ if in_region is None and val:
+ in_region = i
+ elif in_region is not None and not val:
+ boundaries.append((in_region, i))
+ in_region = None
+
+ if in_region is not None:
+ boundaries.append((in_region, i+1))
+ return boundaries
+
##################################################
# Vector and path length geometry calculations
##################################################
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-11-20 15:46:46 UTC (rev 6422)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-11-20 18:58:54 UTC (rev 6423)
@@ -385,7 +385,8 @@
if (!py_convert_bbox(box_obj.ptr(), l, b, r, t))
throw Py::TypeError("Invalid bbox provided to copy_from_bbox");
- agg::rect_i rect((int)l, height - (int)t, (int)r, height - (int)b);
+ // std::cout << l << " " << b << " " << r << " " << t << " " << (height - (int)b) << " " << height - (int)t << std::endl;
+ agg::rect_i rect((int)l, height - (int)b, (int)r, height - (int)t);
BufferRegion* reg = NULL;
try {
@@ -419,9 +420,11 @@
BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
if (region->data==NULL)
- return Py::Object();
- //throw Py::ValueError("Cannot restore_region from NULL data");
+ throw Py::ValueError("Cannot restore_region from NULL data");
+ //return Py::Object();
+ //std::cout << "restoring " << region->width << " " << region->height << " " << region->stride << " " << region->rect.x1 << " " << region->rect.y1 << std::endl;
+
agg::rendering_buffer rbuf;
rbuf.attach(region->data,
region->width,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-11-20 15:46:49
|
Revision: 6422
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6422&view=rev
Author: jswhit
Date: 2008-11-20 15:46:46 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
added save_background.py example.
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-11-20 13:19:50 UTC (rev 6421)
+++ trunk/toolkits/basemap/Changelog 2008-11-20 15:46:46 UTC (rev 6422)
@@ -1,4 +1,6 @@
version 0.99.2 (not yet released)
+ * Added save_background.py example, showing how to re-use
+ a map background without redrawing coastlines.
* Added embedding_map_in_wx.py example (courtesy of
Mauro Cavalcanti).
* Added masked array support to shiftgrid function
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-11-20 13:20:00
|
Revision: 6421
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6421&view=rev
Author: jswhit
Date: 2008-11-20 13:19:50 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
added more comments.
Modified Paths:
--------------
trunk/toolkits/basemap/examples/save_background.py
Modified: trunk/toolkits/basemap/examples/save_background.py
===================================================================
--- trunk/toolkits/basemap/examples/save_background.py 2008-11-20 13:15:07 UTC (rev 6420)
+++ trunk/toolkits/basemap/examples/save_background.py 2008-11-20 13:19:50 UTC (rev 6421)
@@ -25,6 +25,8 @@
# generate the second figure, re-using the background
# from figure 1.
fig2 = plt.figure(2,frameon=False,**figprops)
+# make sure frame is off, or everything in existing background
+# will be obliterated.
ax2 = fig2.add_subplot(111,frameon=False)
# restore previous background.
fig2.canvas.restore_region(background)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-11-20 13:15:11
|
Revision: 6420
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6420&view=rev
Author: jswhit
Date: 2008-11-20 13:15:07 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
cosmetic fixes
Modified Paths:
--------------
trunk/toolkits/basemap/examples/save_background.py
Modified: trunk/toolkits/basemap/examples/save_background.py
===================================================================
--- trunk/toolkits/basemap/examples/save_background.py 2008-11-20 13:08:44 UTC (rev 6419)
+++ trunk/toolkits/basemap/examples/save_background.py 2008-11-20 13:15:07 UTC (rev 6420)
@@ -19,18 +19,19 @@
map.fillcontinents(color='coral',lake_color='aqua')
fig1.canvas.draw()
background = fig1.canvas.copy_from_bbox(fig1.bbox)
+# save figure 1.
fig1.savefig('figure1.png', dpi=100)
-
# generate the second figure, re-using the background
# from figure 1.
fig2 = plt.figure(2,frameon=False,**figprops)
-ax2 = fig2.add_subplot(111, frameon=False, xticks=[], yticks=[])
+ax2 = fig2.add_subplot(111,frameon=False)
# restore previous background.
fig2.canvas.restore_region(background)
# draw parallels and meridians on existing background.
map.drawparallels(range(-90,90,30))
map.drawmeridians(range(-180,180,60))
+# save figure 2.
fig2.savefig('figure2.png', dpi=100)
print 'images saved in figure1.png and figure2.png'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-11-20 13:08:54
|
Revision: 6419
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6419&view=rev
Author: jswhit
Date: 2008-11-20 13:08:44 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
example showing how to re-use a map background.
Modified Paths:
--------------
trunk/toolkits/basemap/MANIFEST.in
trunk/toolkits/basemap/examples/README
Added Paths:
-----------
trunk/toolkits/basemap/examples/save_background.py
Modified: trunk/toolkits/basemap/MANIFEST.in
===================================================================
--- trunk/toolkits/basemap/MANIFEST.in 2008-11-20 12:27:42 UTC (rev 6418)
+++ trunk/toolkits/basemap/MANIFEST.in 2008-11-20 13:08:44 UTC (rev 6419)
@@ -11,6 +11,7 @@
include setup.cfg
include setupegg.py
include src/*
+include examples/save_background.py
include examples/embedding_map_in_wx.py
include examples/cubed_sphere.py
include examples/simpletest.py
Modified: trunk/toolkits/basemap/examples/README
===================================================================
--- trunk/toolkits/basemap/examples/README 2008-11-20 12:27:42 UTC (rev 6418)
+++ trunk/toolkits/basemap/examples/README 2008-11-20 13:08:44 UTC (rev 6419)
@@ -120,3 +120,6 @@
embedding_map_in_wx.py is an example of how to embed Basemap using wx or wxagg
in a GUI application.
+
+save_background.py shows how to save a map background and reuse it in another
+figure (without having to redraw coastlines).
Added: trunk/toolkits/basemap/examples/save_background.py
===================================================================
--- trunk/toolkits/basemap/examples/save_background.py (rev 0)
+++ trunk/toolkits/basemap/examples/save_background.py 2008-11-20 13:08:44 UTC (rev 6419)
@@ -0,0 +1,36 @@
+import matplotlib
+matplotlib.use('Agg')
+from mpl_toolkits.basemap import Basemap
+import matplotlib.pyplot as plt
+
+# this example shows how to save a map background and
+# reuse it in another figure.
+
+# make sure we have all the same properties on all figs
+figprops = dict(figsize=(8,6), dpi=100, facecolor='white')
+
+# generate the first figure.
+fig1 = plt.figure(1,**figprops)
+ax1 = fig1.add_subplot(111)
+# create basemap instance, plot coastlines.
+map = Basemap(projection='moll',lon_0=0)
+map.drawcoastlines()
+map.drawmapboundary(fill_color='aqua')
+map.fillcontinents(color='coral',lake_color='aqua')
+fig1.canvas.draw()
+background = fig1.canvas.copy_from_bbox(fig1.bbox)
+fig1.savefig('figure1.png', dpi=100)
+
+
+# generate the second figure, re-using the background
+# from figure 1.
+fig2 = plt.figure(2,frameon=False,**figprops)
+ax2 = fig2.add_subplot(111, frameon=False, xticks=[], yticks=[])
+# restore previous background.
+fig2.canvas.restore_region(background)
+# draw parallels and meridians on existing background.
+map.drawparallels(range(-90,90,30))
+map.drawmeridians(range(-180,180,60))
+fig2.savefig('figure2.png', dpi=100)
+
+print 'images saved in figure1.png and figure2.png'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-11-20 12:27:48
|
Revision: 6418
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6418&view=rev
Author: jswhit
Date: 2008-11-20 12:27:42 +0000 (Thu, 20 Nov 2008)
Log Message:
-----------
added new embedding_map_in_wx.py example, courtesy of Mauro Cavalcanti.
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
trunk/toolkits/basemap/MANIFEST.in
trunk/toolkits/basemap/README
trunk/toolkits/basemap/examples/README
trunk/toolkits/basemap/examples/run_all.py
Added Paths:
-----------
trunk/toolkits/basemap/examples/embedding_map_in_wx.py
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2008-11-19 15:16:26 UTC (rev 6417)
+++ trunk/toolkits/basemap/Changelog 2008-11-20 12:27:42 UTC (rev 6418)
@@ -1,4 +1,6 @@
version 0.99.2 (not yet released)
+ * Added embedding_map_in_wx.py example (courtesy of
+ Mauro Cavalcanti).
* Added masked array support to shiftgrid function
(thanks to Jesper Larsen).
* defer import of netcdf stuff till it is needed (in NetCDFFile
Modified: trunk/toolkits/basemap/MANIFEST.in
===================================================================
--- trunk/toolkits/basemap/MANIFEST.in 2008-11-19 15:16:26 UTC (rev 6417)
+++ trunk/toolkits/basemap/MANIFEST.in 2008-11-20 12:27:42 UTC (rev 6418)
@@ -11,6 +11,7 @@
include setup.cfg
include setupegg.py
include src/*
+include examples/embedding_map_in_wx.py
include examples/cubed_sphere.py
include examples/simpletest.py
include examples/hires.py
Modified: trunk/toolkits/basemap/README
===================================================================
--- trunk/toolkits/basemap/README 2008-11-19 15:16:26 UTC (rev 6417)
+++ trunk/toolkits/basemap/README 2008-11-20 12:27:42 UTC (rev 6418)
@@ -122,5 +122,6 @@
Jesper Larsen
Ryan May
David Huard
+Mauro Cavalcanti
for valuable contributions.
Modified: trunk/toolkits/basemap/examples/README
===================================================================
--- trunk/toolkits/basemap/examples/README 2008-11-19 15:16:26 UTC (rev 6417)
+++ trunk/toolkits/basemap/examples/README 2008-11-20 12:27:42 UTC (rev 6418)
@@ -117,3 +117,6 @@
run_all.py is a driver script that runs all the examples except fcstmaps.py,
testgdal.py, geos_demo_2.py, warpimage.py, and pnganim.py (which
rely on external dependencies and/or an internet connection).
+
+embedding_map_in_wx.py is an example of how to embed Basemap using wx or wxagg
+in a GUI application.
Added: trunk/toolkits/basemap/examples/embedding_map_in_wx.py
===================================================================
--- trunk/toolkits/basemap/examples/embedding_map_in_wx.py (rev 0)
+++ trunk/toolkits/basemap/examples/embedding_map_in_wx.py 2008-11-20 12:27:42 UTC (rev 6418)
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+"""
+An example of how to use wx or wxagg in an application with the Basemap module
+"""
+
+from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
+from matplotlib.backends.backend_wx import NavigationToolbar2Wx
+from matplotlib.figure import Figure
+
+from mpl_toolkits.basemap import Basemap
+
+from wx import *
+
+class CanvasFrame(Frame):
+
+ def __init__(self):
+ Frame.__init__(self,None,-1,
+ 'CanvasFrame',size=(550,350))
+
+ self.SetBackgroundColour(NamedColor("WHITE"))
+
+ self.figure = Figure()
+
+ self.canvas = FigureCanvas(self, -1, self.figure)
+ self.ax = self.figure.add_subplot(111)
+
+ self.sizer = BoxSizer(VERTICAL)
+ self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW)
+ self.SetSizer(self.sizer)
+ self.Fit()
+
+ self.add_toolbar() # comment this out for no toolbar
+
+ self.plot_map()
+
+ def add_toolbar(self):
+ self.toolbar = NavigationToolbar2Wx(self.canvas)
+ self.toolbar.Realize()
+ if Platform == '__WXMAC__':
+ # Mac platform (OSX 10.3, MacPython) does not seem to cope with
+ # having a toolbar in a sizer. This work-around gets the buttons
+ # back, but at the expense of having the toolbar at the top
+ self.SetToolBar(self.toolbar)
+ else:
+ # On Windows platform, default window size is incorrect, so set
+ # toolbar width to figure width.
+ tw, th = self.toolbar.GetSizeTuple()
+ fw, fh = self.canvas.GetSizeTuple()
+ # By adding toolbar in sizer, we are able to put it at the bottom
+ # of the frame - so appearance is closer to GTK version.
+ # As noted above, doesn't work for Mac.
+ self.toolbar.SetSize(Size(fw, th))
+ self.sizer.Add(self.toolbar, 0, LEFT | EXPAND)
+ # update the axes menu on the toolbar
+ self.toolbar.update()
+
+ def plot_map(self):
+ map = Basemap(ax=self.ax)
+ map.drawcoastlines()
+ map.drawcountries()
+ map.drawmapboundary()
+ map.fillcontinents(color='lime', lake_color='aqua')
+ map.drawmapboundary(fill_color='aqua')
+ self.figure.canvas.draw()
+
+class App(App):
+
+ def OnInit(self):
+ 'Create the main window and insert the custom frame'
+ frame = CanvasFrame()
+ frame.Show(True)
+ return True
+
+app = App(0)
+app.MainLoop()
Modified: trunk/toolkits/basemap/examples/run_all.py
===================================================================
--- trunk/toolkits/basemap/examples/run_all.py 2008-11-19 15:16:26 UTC (rev 6417)
+++ trunk/toolkits/basemap/examples/run_all.py 2008-11-20 12:27:42 UTC (rev 6418)
@@ -6,6 +6,7 @@
test_files.remove('pnganim.py')
test_files.remove('geos_demo_2.py')
test_files.remove('plotsst.py')
+test_files.remove('embedding_map_in_wx.py')
print test_files
py_path = os.environ.get('PYTHONPATH')
if py_path is None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-11-19 15:16:35
|
Revision: 6417
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6417&view=rev
Author: mdboom
Date: 2008-11-19 15:16:26 +0000 (Wed, 19 Nov 2008)
Log Message:
-----------
Update sidebar.
Modified Paths:
--------------
trunk/matplotlib/doc/_templates/indexsidebar.html
Modified: trunk/matplotlib/doc/_templates/indexsidebar.html
===================================================================
--- trunk/matplotlib/doc/_templates/indexsidebar.html 2008-11-19 14:51:30 UTC (rev 6416)
+++ trunk/matplotlib/doc/_templates/indexsidebar.html 2008-11-19 15:16:26 UTC (rev 6417)
@@ -34,9 +34,7 @@
<p>For details on what's new, see the detailed <a href="{{
pathto('_static/CHANGELOG', 1) }}">changelog</a>. Anything that could
required changes to your existing codes is logged in the <a href="{{
-pathto('_static/API_CHANGES', 1) }}">api changes</a> file. And if you
-are migrating from 0.91 to 0.98, also see the <a href="{{
-pathto('_static/MIGRATION.txt', 1) }}">migration</a> file.</p>
+pathto('api/api_changes.html', 1) }}">api changes</a> file.</p>
<h3>Other stuff</h3>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-19 14:51:43
|
Revision: 6416
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6416&view=rev
Author: jdh2358
Date: 2008-11-19 14:51:30 +0000 (Wed, 19 Nov 2008)
Log Message:
-----------
added new links to sidebar
Modified Paths:
--------------
trunk/matplotlib/doc/_templates/gallery.html
trunk/matplotlib/doc/_templates/indexsidebar.html
trunk/matplotlib/doc/make.py
trunk/matplotlib/doc/users/index.rst
Modified: trunk/matplotlib/doc/_templates/gallery.html
===================================================================
--- trunk/matplotlib/doc/_templates/gallery.html 2008-11-19 14:45:44 UTC (rev 6415)
+++ trunk/matplotlib/doc/_templates/gallery.html 2008-11-19 14:51:30 UTC (rev 6416)
@@ -125,6 +125,10 @@
<a href="examples/pylab_examples/color_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/color_demo.png" border="0" alt="color_demo"/></a>
+<a href="examples/pylab_examples/colorbar_tick_labelling_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_00.png" border="0" alt="colorbar_tick_labelling_demo"/></a>
+
+<a href="examples/pylab_examples/colorbar_tick_labelling_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/colorbar_tick_labelling_demo_01.png" border="0" alt="colorbar_tick_labelling_demo"/></a>
+
<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_00.png" border="0" alt="contour_demo"/></a>
<a href="examples/pylab_examples/contour_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/contour_demo_01.png" border="0" alt="contour_demo"/></a>
@@ -159,6 +163,8 @@
<a href="examples/pylab_examples/customize_rc.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png" border="0" alt="customize_rc"/></a>
+<a href="examples/pylab_examples/dannys_example.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dannys_example.png" border="0" alt="dannys_example"/></a>
+
<a href="examples/pylab_examples/dash_control.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dash_control.png" border="0" alt="dash_control"/></a>
<a href="examples/pylab_examples/dashpointlabel.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png" border="0" alt="dashpointlabel"/></a>
@@ -239,6 +245,8 @@
<a href="examples/pylab_examples/ganged_plots.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/ganged_plots.png" border="0" alt="ganged_plots"/></a>
+<a href="examples/pylab_examples/geo_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo.png" border="0" alt="geo_demo"/></a>
+
<a href="examples/pylab_examples/gradient_bar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/gradient_bar.png" border="0" alt="gradient_bar"/></a>
<a href="examples/pylab_examples/griddata_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/griddata_demo.png" border="0" alt="griddata_demo"/></a>
@@ -453,6 +461,8 @@
<a href="examples/pylab_examples/step_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png" border="0" alt="step_demo"/></a>
+<a href="examples/pylab_examples/stix_fonts_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo.png" border="0" alt="stix_fonts_demo"/></a>
+
<a href="examples/pylab_examples/subplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png" border="0" alt="subplot_demo"/></a>
<a href="examples/pylab_examples/subplot_toolbar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png" border="0" alt="subplot_toolbar"/></a>
@@ -461,12 +471,18 @@
<a href="examples/pylab_examples/subplots_adjust.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_adjust.png" border="0" alt="subplots_adjust"/></a>
+<a href="examples/pylab_examples/symlog_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/symlog_demo.png" border="0" alt="symlog_demo"/></a>
+
<a href="examples/pylab_examples/table_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png" border="0" alt="table_demo"/></a>
+<a href="examples/pylab_examples/tex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png" border="0" alt="tex_demo"/></a>
+
<a href="examples/pylab_examples/text_handles.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png" border="0" alt="text_handles"/></a>
<a href="examples/pylab_examples/text_rotation.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png" border="0" alt="text_rotation"/></a>
+<a href="examples/pylab_examples/text_rotation_relative_to_line.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation_relative_to_line.png" border="0" alt="text_rotation_relative_to_line"/></a>
+
<a href="examples/pylab_examples/text_themes.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_themes.png" border="0" alt="text_themes"/></a>
<a href="examples/pylab_examples/to_numeric.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/to_numeric.png" border="0" alt="to_numeric"/></a>
@@ -477,6 +493,8 @@
<a href="examples/pylab_examples/unicode_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/unicode_demo.png" border="0" alt="unicode_demo"/></a>
+<a href="examples/pylab_examples/usetex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png" border="0" alt="usetex_demo"/></a>
+
<a href="examples/pylab_examples/vertical_ticklabels.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vertical_ticklabels.png" border="0" alt="vertical_ticklabels"/></a>
<a href="examples/pylab_examples/vline_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_demo.png" border="0" alt="vline_demo"/></a>
Modified: trunk/matplotlib/doc/_templates/indexsidebar.html
===================================================================
--- trunk/matplotlib/doc/_templates/indexsidebar.html 2008-11-19 14:45:44 UTC (rev 6415)
+++ trunk/matplotlib/doc/_templates/indexsidebar.html 2008-11-19 14:51:30 UTC (rev 6416)
@@ -31,6 +31,12 @@
<a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a>,
but it is a good idea to ping us on the mailing list too.</p>
+<p>For details on what's new, see the detailed <a href="{{
+pathto('_static/CHANGELOG', 1) }}">changelog</a>. Anything that could
+required changes to your existing codes is logged in the <a href="{{
+pathto('_static/API_CHANGES', 1) }}">api changes</a> file. And if you
+are migrating from 0.91 to 0.98, also see the <a href="{{
+pathto('_static/MIGRATION.txt', 1) }}">migration</a> file.</p>
<h3>Other stuff</h3>
Modified: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py 2008-11-19 14:45:44 UTC (rev 6415)
+++ trunk/matplotlib/doc/make.py 2008-11-19 14:51:30 UTC (rev 6416)
@@ -16,6 +16,10 @@
def sf():
'push a copy to the sf site'
+ shutil.copy('../CHANGELOG', 'build/html/_static/CHANGELOG')
+ shutil.copy('../API_CHANGES', 'build/html/_static/API_CHANGES')
+ shutil.copy('../MIGRATION.txt', 'build/html/_static/MIGRATION.txt')
+
os.system('cd build/html; rsync -avz . jdh2358,mat...@we...:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude')
def sfpdf():
Modified: trunk/matplotlib/doc/users/index.rst
===================================================================
--- trunk/matplotlib/doc/users/index.rst 2008-11-19 14:45:44 UTC (rev 6415)
+++ trunk/matplotlib/doc/users/index.rst 2008-11-19 14:51:30 UTC (rev 6416)
@@ -28,3 +28,4 @@
credits.rst
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-11-19 14:45:51
|
Revision: 6415
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6415&view=rev
Author: mdboom
Date: 2008-11-19 14:45:44 +0000 (Wed, 19 Nov 2008)
Log Message:
-----------
Converted API_CHANGES to reST and included it in the documentation tree.
Modified Paths:
--------------
trunk/matplotlib/doc/api/index.rst
Added Paths:
-----------
trunk/matplotlib/doc/api/api_changes.rst
Removed Paths:
-------------
trunk/matplotlib/API_CHANGES
Deleted: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES 2008-11-18 23:38:53 UTC (rev 6414)
+++ trunk/matplotlib/API_CHANGES 2008-11-19 14:45:44 UTC (rev 6415)
@@ -1,1310 +0,0 @@
-Changes for 0.98.x
-==================
-
-* set_xlim, ylim now return a copy of the viewlim array to
- avoid modify inplace surprises
-
-* AFM.get_fullname() and get_familyname() no longer raise an
- exception if the AFM file does not specify these optional attributes,
- but returns a guess based on the required FontName attribute.
-
-* Changed precision kwarg in spy; default is 0, and the string value
- 'present' is used for sparse arrays only to show filled locations.
-
-* EllipseCollection added.
-
-* Added angles kwarg to quiver for more flexible specification of
- the arrow angles.
-
-* Deprecated (raise NotImplementedError) all the mlab2 functions from
- matplotlib.mlab out of concern that some of them were not clean room
- implementations.
-
-* Methods get_offsets and set_offsets added to Collections base
- class.
-
-* Figure.figurePatch renamed Figure.patch, Axes.axesPatch renamed
- Axes.patch, Axes.axesFrame renamed Axes.frame, Axes.get_frame, which
- returns Axes.patch, is deprecated. Examples and users guide updated
-
-* Changes in the ContourLabeler attributes (clabel function) so that they
- all have a form like .labelAttribute. The three attributes that are most
- likely to be used by end users, .cl, .cl_xy and .cl_cvalues have been
- maintained for the moment (in addition to their renamed versions), but they
- are depricated and will eventually be removed.
-
-* Moved several function in mlab.py and cbook.py into a separate module
- numerical_methods.py because they were unrelated to the initial purpose of
- mlab or cbook and appeared more coherent elsewhere.
-
-Changes for 0.98.1
-==================
-
-* Removed broken axes3d support and replaced it with a non implemented
- error pointing to 0.91.x
-
-Changes for 0.98.0
-==================
-
- matplotlib.image.imread now no longer always returns RGBA -- if
- the image is luminance or RGB, it will return a MxN or MxNx3 array
- if possible. Also uint8 is no longer always forced to float.
-
- Rewrote the cm.ScalarMappable callback infrastructure to use
- cbook.CallbackRegistry rather than custom callback handling. Amy
- users of add_observer/notify of the cm.ScalarMappable should uae
- the cm.ScalarMappable.callbacksSM CallbackRegistry instead.
-
- New axes function and Axes method provide control over the plot
- color cycle: axes.set_default_color_cycle(clist) and
- Axes.set_color_cycle(clist).
-
- matplotlib now requires python2.4, so matplotlib.cbook will no
- loner provide set, enumerate, reversed or izip compatability functions
-
- In numpy 1.0 bins are specified by the left edges only. The axes
- method "hist" now uses future numpy 1.3 semantic for histograms.
- Providing binedges, the last value gives the upper-right edge now,
- which was implicitly set to +infinity in numpy 1.0. This also means
- that the last bin doesn't contain upper outliers any more by default.
-
- New axes method and pyplot function, hexbin, is an alternative
- to scatter for large datasets. It makes something like a
- pcolor of a 2-D histogram, but uses hexagonal bins.
-
- New kwarg, "symmetric", in MaxNLocator
- allows one require an axis to be centered on zero.
-
- toolkits must now be imported from mpl_toolkits (not matplotlib.toolkits)
-
-TRANSFORMS REFACTORING
-
- The primary goal of this refactoring was to make it easier to
- extend matplotlib to support new kinds of projections. This is
- primarily an internal improvement, and the possible user-visible
- changes it allows are yet to come.
-
- See transforms.py for a description of the design of the new
- transformation framework.
-
- For efficiency, many of these functions return views into Numpy
- arrays. This means that if you hold on to a reference to them,
- their contents may change. If you want to store a snapshot of
- their current values, use the Numpy array method copy().
-
- The view intervals are now stored only in one place -- in the Axes
- instance, not in the formatter instances as well. This means
- formatters must get their limits from their Axis, which in turn
- looks up its limits from the Axes. If a Locator is used
- temporarily and not assigned to an Axis or Axes, (e.g. in
- contour.py), a dummy axis must be created to store its bounds.
- Call Locator.create_dummy_axis() to do so.
-
- The functionality of Pbox has been merged with Bbox. Its methods
- now all return copies rather than modifying in place.
-
- The following lists many of the simple changes necessary to update
- code from the old transformation framework to the new one. In
- particular, methods that return a copy are named with a verb in
- the past tense, whereas methods that alter an object in place are
- named with a very in the present tense.
-
- transforms.py
- Bbox.get_bounds() Bbox.bounds
-
- Bbox.width() Bbox.width
-
- Bbox.height() Bbox.height
-
- Bbox.intervalx().get_bounds() Bbox.intervalx
- Bbox.intervalx().set_bounds()
- [Bbox.intervalx is now a property.]
-
- Bbox.intervaly().get_bounds() Bbox.intervaly
- Bbox.intervaly().set_bounds()
- [Bbox.intervaly is now a property.]
-
- Bbox.xmin() Bbox.x0 or Bbox.xmin
- Bbox.ymin() Bbox.y0 or Bbox.ymin
- Bbox.xmax() Bbox.x1 or Bbox.xmax
- Bbox.ymax() Bbox.y1 or Bbox.ymax
- [The Bbox is bound by the points (x0, y0) to (x1, y1) and
- there is no defined order to these points, that is, x0 is not
- necessarily the left edge of the box. To get the left edge of
- the Bbox, use the read-only property xmin.]
-
- Bbox.overlaps(bboxes) Bbox.count_overlaps(bboxes)
-
- bbox_all(bboxes) Bbox.union(bboxes)
- [Bbox.union is a staticmethod.]
-
- lbwh_to_bbox(l, b, w, h) Bbox.from_bounds(x0, y0, w, h)
-
- inverse_transform_bbox(trans, bbox) bbox.inverse_transformed(trans)
-
- Interval.contains_open(v) interval_contains_open(tuple, v)
- Interval.contains(v) interval_contains_open(tuple, v)
-
- identity_transform() IdentityTransform()
-
- blend_xy_sep_transform(xtrans, ytrans) blended_transform_factory(xtrans, ytrans)
-
- scale_transform(xs, ys) Affine2D().scale(xs[, ys])
-
- get_bbox_transform(boxin, boxout) BboxTransform(boxin, boxout) or
- BboxTransformFrom(boxin) or
- BboxTransformTo(boxout)
-
- Transform.seq_xy_tup(points) Transform.transform(points)
-
- Transform.inverse_xy_tup(points) Transform.inverted().transform(points)
-
- axes.py
- Axes.get_position() Axes.get_position()
- [Axes.get_position() used to return a list of points, not it
- returns a transforms.Bbox instance.]
-
- Axes.set_position() Axes.set_position()
- [Axes.set_position() now accepts either four scalars or a
- transforms Bbox instance.]
-
- [also returns a Bbox]
- Axes.toggle_log_lineary() Axes.set_yscale()
- [Since the recfactoring allows for more than two scale types
- ('log' or 'linear'), it no longer makes sense to have a
- toggle. Axes.toggle_log_lineary() has been removed.]
-
- Axes.hlines(linestyle=) Axes.hlines(linestyles=)
- Axes.vlines(linestyle=) Axes.vlines(linestyles=)
- [The kwarg 'linestyle' has been replaced with 'linestyles',
- which accepts either a single linestyle or a list of
- linestyles to use.]
-
- Subplot class is gone -- now there is only SubplotBase.
-
- The Polar class has moved to projections/polar.py
-
- artist.py
- Artist.set_clip_path(path) Artist.set_clip_path(path, transform)
- [set_clip_path now accepts a path.Path instance and a
- transformation that will be applied to the path immediately
- before clipping.]
-
- collections.py
- linestyle linestyles
- [Linestyles are now treated like all other collection
- attributes -- a single value or multiple values may be
- provided.]
-
- colors.py
- ColorConvertor.to_rgba_list(c) ColorConvertor.to_rgba_array(c)
- [ColorConvertor.to_rgba_array(c) returns an Nx4 Numpy array of
- RGBA color quadruples.]
-
- contour.py
- Contour._segments Contour.get_paths()
- [Contour.get_paths() now returns a list of path.Path instances.]
-
- figure.py
- Figure.dpi.get()/set() Figure.dpi (a property)
-
- patches.py
- get_verts() get_path()
- [Patch.get_path() returns a path.Path instance.]
-
- backend_bases.py
- GraphicsContext.set_clip_rectangle(tuple) GraphicsContext.set_clip_rectangle(bbox)
-
- GraphicsContext.get_clip_path() GraphicsContext.get_clip_path()
- [GraphicsContext.get_clip_path() returns a tuple of the form
- (path, affine_transform), where path is a path.Path instance
- and affine_transform is a transforms.Affine2D instance.]
-
- GraphicsContext.set_clip_path(clippath) GraphicsContext.set_clip_path(clippath)
- [Now accepts only an instance of transforms.TransformedPath.]
-
- RendererBase class:
- **new methods** --->
- draw_path(self, gc, path, transform, rgbFace)
-
- draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace)
-
- draw_path_collection(self, master_transform, cliprect, clippath,
- clippath_trans, paths, all_transforms, offsets,
- offsetTrans, facecolors, edgecolors, linewidths,
- linestyles, antialiaseds) [optional]
-
-
- **changed methods** --->
- draw_image(self, x, y, im, bbox) draw_image(self, x, y, im, bbox,
- clippath, clippath_trans)
-
- **removed methods** --->
- draw_arc
- draw_line_collection
- draw_line
- draw_lines
- draw_point
- draw_quad_mesh
- draw_poly_collection
- draw_polygon
- draw_rectangle
- draw_regpoly_collection
-
-END OF TRANSFORMS REFACTORING
-
-
-
-
-0.91.2 Released
-
- For csv2rec, checkrows=0 is the new default indicating all rows
- will be checked for type inference
-
- A warning is issued when an image is drawn on log-scaled
- axes, since it will not log-scale the image data.
-
- Moved rec2gtk to matplotlib.toolkits.gtktools
-
- Moved rec2excel to matplotlib.toolkits.exceltools
-
- Removed, dead/experimental ExampleInfo, Namespace and Importer
- code from matplotlib/__init__.py
-
-0.91.1 Released
-
-0.91.0 Released
-
- Changed cbook.is_file_like to cbook.is_writable_file_like and
- corrected behavior.
-
- Added ax kwarg to pyplot.colorbar and Figure.colorbar so that
- one can specify the axes object from which space for the colorbar
- is to be taken, if one does not want to make the colorbar axes
- manually.
-
- Changed cbook.reversed so it yields a tuple rather than a
- (index, tuple). This agrees with the python reversed builtin,
- and cbook only defines reversed if python doesnt provide the
- builtin.
-
- Made skiprows=1 the default on csv2rec
-
- The gd and paint backends have been deleted.
-
- The errorbar method and function now accept additional kwargs
- so that upper and lower limits can be indicated by capping the
- bar with a caret instead of a straight line segment.
-
- The dviread.py file now has a parser for files like psfonts.map
- and pdftex.map, to map TeX font names to external files.
-
- The file type1font.py contains a new class for Type 1 fonts.
- Currently it simply reads pfa and pfb format files and stores the
- data in a way that is suitable for embedding in pdf files. In the
- future the class might actually parse the font to allow e.g.
- subsetting.
-
- FT2Font now supports FT_Attach_File. In practice this can be used
- to read an afm file in addition to a pfa/pfb file, to get metrics
- and kerning information for a Type 1 font.
-
- The AFM class now supports querying CapHeight and stem widths. The
- get_name_char method now has an isord kwarg like get_width_char.
-
- Changed pcolor default to shading='flat'; but as noted now in the
- docstring, it is preferable to simply use the edgecolor kwarg.
-
- The mathtext font commands (\cal, \rm, \it, \tt) now behave as TeX
- does: they are in effect until the next font change command or the
- end of the grouping. Therefore uses of $\cal{R}$ should be
- changed to ${\cal R}$. Alternatively, you may use the new
- LaTeX-style font commands (\mathcal, \mathrm, \mathit, \mathtt)
- which do affect the following group, eg. $\mathcal{R}$.
-
- Text creation commands have a new default linespacing and
- a new linespacing kwarg, which is a multiple of the maximum
- vertical extent of a line of ordinary text. The default is
- 1.2; linespacing=2 would be like ordinary double spacing, for
- example.
-
- Changed default kwarg in colors.Normalize.__init__ to clip=False;
- clipping silently defeats the purpose of the special over, under,
- and bad values in the colormap, thereby leading to unexpected
- behavior. The new default should reduce such surprises.
-
- Made the emit property of set_xlim and set_ylim true by default;
- removed the Axes custom callback handling into a 'callbacks'
- attribute which is a cbook.CallbackRegistry instance. This now
- supports the xlim_changed and ylim_changed Axes events.
-
-0.90.1 released
-
- The file dviread.py has a (very limited and fragile) dvi reader
- for usetex support. The API might change in the future so don't
- depend on it yet.
-
- Removed deprecated support for a float value as a gray-scale;
- now it must be a string, like '0.5'. Added alpha kwarg to
- ColorConverter.to_rgba_list.
-
- New method set_bounds(vmin, vmax) for formatters, locators sets
- the viewInterval and dataInterval from floats.
-
- Removed deprecated colorbar_classic.
-
- Line2D.get_xdata and get_ydata valid_only=False kwarg is replaced
- by orig=True. When True, it returns the original data, otherwise
- the processed data (masked, converted)
-
- Some modifications to the units interface.
- units.ConversionInterface.tickers renamed to
- units.ConversionInterface.axisinfo and it now returns a
- units.AxisInfo object rather than a tuple. This will make it
- easier to add axis info functionality (eg I added a default label
- on this iteration) w/o having to change the tuple length and hence
- the API of the client code everytime new functionality is added.
- Also, units.ConversionInterface.convert_to_value is now simply
- named units.ConversionInterface.convert.
-
- Axes.errorbar uses Axes.vlines and Axes.hlines to draw its error
- limits int he vertical and horizontal direction. As you'll see
- in the changes below, these funcs now return a LineCollection
- rather than a list of lines. The new return signature for
- errorbar is ylins, caplines, errorcollections where
- errorcollections is a xerrcollection, yerrcollection
-
- Axes.vlines and Axes.hlines now create and returns a LineCollection, not a list
- of lines. This is much faster. The kwarg signature has changed,
- so consult the docs
-
- MaxNLocator accepts a new Boolean kwarg ('integer') to force
- ticks to integer locations.
-
- Commands that pass an argument to the Text constructor or to
- Text.set_text() now accept any object that can be converted
- with '%s'. This affects xlabel(), title(), etc.
-
- Barh now takes a **kwargs dict instead of most of the old
- arguments. This helps ensure that bar and barh are kept in sync,
- but as a side effect you can no longer pass e.g. color as a
- positional argument.
-
- ft2font.get_charmap() now returns a dict that maps character codes
- to glyph indices (until now it was reversed)
-
- Moved data files into lib/matplotlib so that setuptools' develop
- mode works. Re-organized the mpl-data layout so that this source
- structure is maintained in the installation. (I.e. the 'fonts' and
- 'images' sub-directories are maintained in site-packages.).
- Suggest removing site-packages/matplotlib/mpl-data and
- ~/.matplotlib/ttffont.cache before installing
-
-0.90.0 released
-
- All artists now implement a "pick" method which users should not
- call. Rather, set the "picker" property of any artist you want to
- pick on (the epsilon distance in points for a hit test) and
- register with the "pick_event" callback. See
- examples/pick_event_demo.py for details
-
- Bar, barh, and hist have "log" binary kwarg: log=True
- sets the ordinate to a log scale.
-
- Boxplot can handle a list of vectors instead of just
- an array, so vectors can have different lengths.
-
- Plot can handle 2-D x and/or y; it plots the columns.
-
- Added linewidth kwarg to bar and barh.
-
- Made the default Artist._transform None (rather than invoking
- identity_transform for each artist only to have it overridden
- later). Use artist.get_transform() rather than artist._transform,
- even in derived classes, so that the default transform will be
- created lazily as needed
-
- New LogNorm subclass of Normalize added to colors.py.
- All Normalize subclasses have new inverse() method, and
- the __call__() method has a new clip kwarg.
-
- Changed class names in colors.py to match convention:
- normalize -> Normalize, no_norm -> NoNorm. Old names
- are still available for now.
-
- Removed obsolete pcolor_classic command and method.
-
- Removed lineprops and markerprops from the Annotation code and
- replaced them with an arrow configurable with kwarg arrowprops.
- See examples/annotation_demo.py - JDH
-
-0.87.7 released
-
- Completely reworked the annotations API because I found the old
- API cumbersome. The new design is much more legible and easy to
- read. See matplotlib.text.Annotation and
- examples/annotation_demo.py
-
- markeredgecolor and markerfacecolor cannot be configured in
- matplotlibrc any more. Instead, markers are generally colored
- automatically based on the color of the line, unless marker colors
- are explicitely set as kwargs - NN
-
- Changed default comment character for load to '#' - JDH
-
- math_parse_s_ft2font_svg from mathtext.py & mathtext2.py now returns
- width, height, svg_elements. svg_elements is an instance of Bunch (
- cmbook.py) and has the attributes svg_glyphs and svg_lines, which are both
- lists.
-
- Renderer.draw_arc now takes an additional parameter, rotation.
- It specifies to draw the artist rotated in degrees anti-
- clockwise. It was added for rotated ellipses.
-
- Renamed Figure.set_figsize_inches to Figure.set_size_inches to
- better match the get method, Figure.get_size_inches.
-
- Removed the copy_bbox_transform from transforms.py; added
- shallowcopy methods to all transforms. All transforms already
- had deepcopy methods.
-
- FigureManager.resize(width, height): resize the window
- specified in pixels
-
- barh: x and y args have been renamed to width and bottom
- respectively, and their order has been swapped to maintain
- a (position, value) order.
-
- bar and barh: now accept kwarg 'edgecolor'.
-
- bar and barh: The left, height, width and bottom args can
- now all be scalars or sequences; see docstring.
-
- barh: now defaults to edge aligned instead of center
- aligned bars
-
- bar, barh and hist: Added a keyword arg 'align' that
- controls between edge or center bar alignment.
-
- Collections: PolyCollection and LineCollection now accept
- vertices or segments either in the original form [(x,y),
- (x,y), ...] or as a 2D numerix array, with X as the first column
- and Y as the second. Contour and quiver output the numerix
- form. The transforms methods Bbox.update() and
- Transformation.seq_xy_tups() now accept either form.
-
- Collections: LineCollection is now a ScalarMappable like
- PolyCollection, etc.
-
- Specifying a grayscale color as a float is deprecated; use
- a string instead, e.g., 0.75 -> '0.75'.
-
- Collections: initializers now accept any mpl color arg, or
- sequence of such args; previously only a sequence of rgba
- tuples was accepted.
-
- Colorbar: completely new version and api; see docstring. The
- original version is still accessible as colorbar_classic, but
- is deprecated.
-
- Contourf: "extend" kwarg replaces "clip_ends"; see docstring.
- Masked array support added to pcolormesh.
-
- Modified aspect-ratio handling:
- Removed aspect kwarg from imshow
- Axes methods:
- set_aspect(self, aspect, adjustable=None, anchor=None)
- set_adjustable(self, adjustable)
- set_anchor(self, anchor)
- Pylab interface:
- axis('image')
-
- Backend developers: ft2font's load_char now takes a flags
- argument, which you can OR together from the LOAD_XXX
- constants.
-
-API Changes in matplotlib-0.86
-
- Matplotlib data is installed into the matplotlib module.
- This is similar to package_data. This should get rid of
- having to check for many possibilities in _get_data_path().
- The MATPLOTLIBDATA env key is still checked first to allow
- for flexibility.
-
- 1) Separated the color table data from cm.py out into
- a new file, _cm.py, to make it easier to find the actual
- code in cm.py and to add new colormaps. Everything
- from _cm.py is imported by cm.py, so the split should be
- transparent.
- 2) Enabled automatic generation of a colormap from
- a list of colors in contour; see modified
- examples/contour_demo.py.
- 3) Support for imshow of a masked array, with the
- ability to specify colors (or no color at all) for
- masked regions, and for regions that are above or
- below the normally mapped region. See
- examples/image_masked.py.
- 4) In support of the above, added two new classes,
- ListedColormap, and no_norm, to colors.py, and modified
- the Colormap class to include common functionality. Added
- a clip kwarg to the normalize class.
-
-
-API Changes in matplotlib-0.85
-
- Made xtick and ytick separate props in rc
-
- made pos=None the default for tick formatters rather than 0 to
- indicate "not supplied"
-
- Removed "feature" of minor ticks which prevents them from
- overlapping major ticks. Often you want major and minor ticks at
- the same place, and can offset the major ticks with the pad. This
- could be made configurable
-
- Changed the internal structure of contour.py to a more OO style.
- Calls to contour or contourf in axes.py or pylab.py now return
- a ContourSet object which contains references to the
- LineCollections or PolyCollections created by the call,
- as well as the configuration variables that were used.
- The ContourSet object is a "mappable" if a colormap was used.
-
- Added a clip_ends kwarg to contourf. From the docstring:
- * clip_ends = True
- If False, the limits for color scaling are set to the
- minimum and maximum contour levels.
- True (default) clips the scaling limits. Example:
- if the contour boundaries are V = [-100, 2, 1, 0, 1, 2, 100],
- then the scaling limits will be [-100, 100] if clip_ends
- is False, and [-3, 3] if clip_ends is True.
- Added kwargs linewidths, antialiased, and nchunk to contourf. These
- are experimental; see the docstring.
-
- Changed Figure.colorbar():
- kw argument order changed;
- if mappable arg is a non-filled ContourSet, colorbar() shows
- lines instead hof polygons.
- if mappable arg is a filled ContourSet with clip_ends=True,
- the endpoints are not labelled, so as to give the
- correct impression of open-endedness.
-
- Changed LineCollection.get_linewidths to get_linewidth, for
- consistency.
-
-
-API Changes in matplotlib-0.84
-
- Unified argument handling between hlines and vlines. Both now
- take optionally a fmt argument (as in plot) and a keyword args
- that can be passed onto Line2D.
-
- Removed all references to "data clipping" in rc and lines.py since
- these were not used and not optimized. I'm sure they'll be
- resurrected later with a better implementation when needed.
-
- 'set' removed - no more deprecation warnings. Use 'setp' instead.
-
- Backend developers: Added flipud method to image and removed it
- from to_str. Removed origin kwarg from backend.draw_image.
- origin is handled entirely by the frontend now.
-
-API Changes in matplotlib-0.83
-
- - Made HOME/.matplotlib the new config dir where the matplotlibrc
- file, the ttf.cache, and the tex.cache live. The new default
- filenames in .matplotlib have no leading dot and are not hidden.
- Eg, the new names are matplotlibrc, tex.cache, and ttffont.cache.
- This is how ipython does it so it must be right.
-
- If old files are found, a warning is issued and they are moved to
- the new location.
-
- - backends/__init__.py no longer imports new_figure_manager,
- draw_if_interactive and show from the default backend, but puts
- these imports into a call to pylab_setup. Also, the Toolbar is no
- longer imported from WX/WXAgg. New usage:
-
- from backends import pylab_setup
- new_figure_manager, draw_if_interactive, show = pylab_setup()
-
- - Moved Figure.get_width_height() to FigureCanvasBase. It now
- returns int instead of float.
-
-API Changes in matplotlib-0.82
-
- - toolbar import change in GTKAgg, GTKCairo and WXAgg
-
- - Added subplot config tool to GTK* backends -- note you must now
- import the NavigationToolbar2 from your backend of choice rather
- than from backend_gtk because it needs to know about the backend
- specific canvas -- see examples/embedding_in_gtk2.py. Ditto for
- wx backend -- see examples/embedding_in_wxagg.py
-
-
- - hist bin change
-
- Sean Richards notes there was a problem in the way we created
- the binning for histogram, which made the last bin
- underrepresented. From his post:
-
- I see that hist uses the linspace function to create the bins
- and then uses searchsorted to put the values in their correct
- bin. Thats all good but I am confused over the use of linspace
- for the bin creation. I wouldn't have thought that it does
- what is needed, to quote the docstring it creates a "Linear
- spaced array from min to max". For it to work correctly
- shouldn't the values in the bins array be the same bound for
- each bin? (i.e. each value should be the lower bound of a
- bin). To provide the correct bins for hist would it not be
- something like
-
- def bins(xmin, xmax, N):
- if N==1: return xmax
- dx = (xmax-xmin)/N # instead of N-1
- return xmin + dx*arange(N)
-
-
- This suggestion is implemented in 0.81. My test script with these
- changes does not reveal any bias in the binning
-
- from matplotlib.numerix.mlab import randn, rand, zeros, Float
- from matplotlib.mlab import hist, mean
-
- Nbins = 50
- Ntests = 200
- results = zeros((Ntests,Nbins), typecode=Float)
- for i in range(Ntests):
- print 'computing', i
- x = rand(10000)
- n, bins = hist(x, Nbins)
- results[i] = n
- print mean(results)
-
-
-API CHANGES in matplotlib-0.81
-
- - pylab and artist "set" functions renamed to setp to avoid clash
- with python2.4 built-in set. Current version will issue a
- deprecation warning which will be removed in future versions
-
- - imshow interpolation arguments changes for advanced interpolation
- schemes. See help imshow, particularly the interpolation,
- filternorm and filterrad kwargs
-
- - Support for masked arrays has been added to the plot command and
- to the Line2D object. Only the valid points are plotted. A
- "valid_only" kwarg was added to the get_xdata() and get_ydata()
- methods of Line2D; by default it is False, so that the original
- data arrays are returned. Setting it to True returns the plottable
- points.
-
- - contour changes:
-
- Masked arrays: contour and contourf now accept masked arrays as
- the variable to be contoured. Masking works correctly for
- contour, but a bug remains to be fixed before it will work for
- contourf. The "badmask" kwarg has been removed from both
- functions.
-
- Level argument changes:
-
- Old version: a list of levels as one of the positional
- arguments specified the lower bound of each filled region; the
- upper bound of the last region was taken as a very large
- number. Hence, it was not possible to specify that z values
- between 0 and 1, for example, be filled, and that values
- outside that range remain unfilled.
-
- New version: a list of N levels is taken as specifying the
- boundaries of N-1 z ranges. Now the user has more control over
- what is colored and what is not. Repeated calls to contourf
- (with different colormaps or color specifications, for example)
- can be used to color different ranges of z. Values of z
- outside an expected range are left uncolored.
-
- Example:
- Old: contourf(z, [0, 1, 2]) would yield 3 regions: 0-1, 1-2, and >2.
- New: it would yield 2 regions: 0-1, 1-2. If the same 3 regions were
- desired, the equivalent list of levels would be [0, 1, 2,
- 1e38].
-
-
-API CHANGES in matplotlib-0.80
-
- - xlim/ylim/axis always return the new limits regardless of
- arguments. They now take kwargs which allow you to selectively
- change the upper or lower limits while leaving unnamed limits
- unchanged. See help(xlim) for example
-
-API CHANGES in matplotlib-0.73
-
- - Removed deprecated ColormapJet and friends
-
- - Removed all error handling from the verbose object
-
- - figure num of zero is now allowed
-
-API CHANGES in matplotlib-0.72
-
- - Line2D, Text, and Patch copy_properties renamed update_from and
- moved into artist base class
-
- - LineCollecitons.color renamed to LineCollections.set_color for
- consistency with set/get introspection mechanism,
-
- - pylab figure now defaults to num=None, which creates a new figure
- with a guaranteed unique number
-
- - contour method syntax changed - now it is matlab compatible
-
- unchanged: contour(Z)
- old: contour(Z, x=Y, y=Y)
- new: contour(X, Y, Z)
-
- see http://matplotlib.sf.net/matplotlib.pylab.html#-contour
-
-
- - Increased the default resolution for save command.
-
- - Renamed the base attribute of the ticker classes to _base to avoid conflict
- with the base method. Sitt for subs
-
- - subs=none now does autosubbing in the tick locator.
-
- - New subplots that overlap old will delete the old axes. If you
- do not want this behavior, use fig.add_subplot or the axes
- command
-
-API CHANGES in matplotlib-0.71
-
- Significant numerix namespace changes, introduced to resolve
- namespace clashes between python built-ins and mlab names.
- Refactored numerix to maintain separate modules, rather than
- folding all these names into a single namespace. See the following
- mailing list threads for more information and background
-
- http://sourceforge.net/mailarchive/forum.php?thread_id=6398890&forum_id=36187
- http://sourceforge.net/mailarchive/forum.php?thread_id=6323208&forum_id=36187
-
-
- OLD usage
-
- from matplotlib.numerix import array, mean, fft
-
- NEW usage
-
- from matplotlib.numerix import array
- from matplotlib.numerix.mlab import mean
- from matplotlib.numerix.fft import fft
-
- numerix dir structure mirrors numarray (though it is an incomplete
- implementation)
-
- numerix
- numerix/mlab
- numerix/linear_algebra
- numerix/fft
- numerix/random_array
-
- but of course you can use 'numerix : Numeric' and still get the
- symbols.
-
- pylab still imports most of the symbols from Numerix, MLab, fft,
- etc, but is more cautious. For names that clash with python names
- (min, max, sum), pylab keeps the builtins and provides the numeric
- versions with an a* prefix, eg (amin, amax, asum)
-
-
-
-API CHANGES in matplotlib-0.70
-
- MplEvent factored into a base class Event and derived classes
- MouseEvent and KeyEvent
-
- Removed definct set_measurement in wx toolbar
-
-API CHANGES in matplotlib-0.65.1
-
- removed add_axes and add_subplot from backend_bases. Use
- figure.add_axes and add_subplot instead. The figure now manages the
- current axes with gca and sca for get and set current axe. If you
- have code you are porting which called, eg, figmanager.add_axes, you
- can now simply do figmanager.canvas.figure.add_axes.
-
-API CHANGES in matplotlib-0.65
-
- mpl_connect and mpl_disconnect in the matlab interface renamed to
- connect and disconnect
-
- Did away with the text methods for angle since they were ambiguous.
- fontangle could mean fontstyle (obligue, etc) or the rotation of the
- text. Use style and rotation instead.
-
-
-API CHANGES in matplotlib-0.63
-
- Dates are now represented internally as float days since 0001-01-01,
- UTC.
-
- All date tickers and formatters are now in matplotlib.dates, rather
- than matplotlib.tickers
-
- converters have been abolished from all functions and classes.
- num2date and date2num are now the converter functions for all date
- plots
-
- Most of the date tick locators have a different meaning in their
- constructors. In the prior implementation, the first argument was a
- base and multiples of the base were ticked. Eg
-
- HourLocator(5) # old: tick every 5 minutes
-
- In the new implementation, the explicit points you want to tick are
- provided as a number or sequence
-
- HourLocator(range(0,5,61)) # new: tick every 5 minutes
-
- This gives much greater flexibility. I have tried to make the
- default constructors (no args) behave similarly, where possible.
-
- Note that YearLocator still works under the base/multiple scheme.
- The difference between the YearLocator and the other locators is
- that years are not recurrent.
-
-
- Financial functions:
-
- matplotlib.finance.quotes_historical_yahoo(ticker, date1, date2)
-
- date1, date2 are now datetime instances. Return value is a list
- of quotes where the quote time is a float - days since gregorian
- start, as returned by date2num
-
- See examples/finance_demo.py for example usage of new API
-
-
-API CHANGES in matplotlib-0.61
-
- canvas.connect is now deprecated for event handling. use
- mpl_connect and mpl_disconnect instead. The callback signature is
- func(event) rather than func(widget, evet)
-
-API CHANGES in matplotlib-0.60
-
-ColormapJet and Grayscale are deprecated. For backwards
-compatibility, they can be obtained either by doing
-
- from matplotlib.cm import ColormapJet
-
-or
-
- from matplotlib.matlab import *
-
-They are replaced by cm.jet and cm.grey
-
-
-API CHANGES in matplotlib-0.54.3
-
-removed the set_default_font / get_default_font scheme from the
-font_manager to unify customization of font defaults with the rest of
-the rc scheme. See examples/font_properties_demo.py and help(rc) in
-matplotlib.matlab.
-
-
-API CHANGES in matplotlib-0.54
-
-matlab interface
-================
-
-dpi
----
-
-Several of the backends used a PIXELS_PER_INCH hack that I added to
-try and make images render consistently across backends. This just
-complicated matters. So you may find that some font sizes and line
-widths appear different than before. Apologies for the
-inconvenience. You should set the dpi to an accurate value for your
-screen to get true sizes.
-
-
-pcolor and scatter
-------------------
-
-There are two changes to the matlab interface API, both involving the
-patch drawing commands. For efficiency, pcolor and scatter have been
-rewritten to use polygon collections, which are a new set of objects
-from matplotlib.collections designed to enable efficient handling of
-large collections of objects. These new collections make it possible
-to build large scatter plots or pcolor plots with no loops at the
-python level, and are significantly faster than their predecessors.
-The original pcolor and scatter functions are retained as
-pcolor_classic and scatter_classic.
-
-The return value from pcolor is a PolyCollection. Most of the
-propertes that are available on rectangles or other patches are also
-available on PolyCollections, eg you can say
-
- c = scatter(blah, blah)
- c.set_linewidth(1.0)
- c.set_facecolor('r')
- c.set_alpha(0.5)
-
-or
-
- c = scatter(blah, blah)
- set(c, 'linewidth', 1.0, 'facecolor', 'r', 'alpha', 0.5)
-
-
-Because the collection is a single object, you no longer need to loop
-over the return value of scatter or pcolor to set properties for the
-entire list.
-
-If you want the different elements of a collection to vary on a
-property, eg to have different line widths, see matplotlib.collections
-for a discussion on how to set the properties as a sequence.
-
-For scatter, the size argument is now in points^2 (the area of the
-symbol in points) as in matlab and is not in data coords as before.
-Using sizes in data coords caused several problems. So you will need
-to adjust your size arguments accordingly or use scatter_classic.
-
-mathtext spacing
-----------------
-
-For reasons not clear to me (and which I'll eventually fix) spacing no
-longer works in font groups. However, I added three new spacing
-commands which compensate for this '\ ' (regular space), '\/' (small
-space) and '\hspace{frac}' where frac is a fraction of fontsize in
-points. You will need to quote spaces in font strings, is
-
- title(r'$\rm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
-
-
-
-Object interface - Application programmers
-==========================================
-
-Autoscaling
-------------
-
- The x and y axis instances no longer have autoscale view. These are
- handled by axes.autoscale_view
-
-Axes creation
---------------
-
- You should not instantiate your own Axes any more using the OO API.
- Rather, create a Figure as before and in place of
-
- f = Figure(figsize=(5,4), dpi=100)
- a = Subplot(f, 111)
- f.add_axis(a)
-
- use
-
- f = Figure(figsize=(5,4), dpi=100)
- a = f.add_subplot(111)
-
- That is, add_axis no longer exists and is replaced by
-
- add_axes(rect, axisbg=defaultcolor, frameon=True)
- add_subplot(num, axisbg=defaultcolor, frameon=True)
-
-Artist methods
----------------
-
- If you define your own Artists, you need to rename the _draw method
- to draw
-
-Bounding boxes
---------------
-
- matplotlib.transforms.Bound2D is replaced by
- matplotlib.transforms.Bbox. If you want to construct a bbox from
- left, bottom, width, height (the signature for Bound2D), use
- matplotlib.transforms.lbwh_to_bbox, as in
-
- bbox = clickBBox = lbwh_to_bbox(left, bottom, width, height)
-
- The Bbox has a different API than the Bound2D. Eg, if you want to
- get the width and height of the bbox
-
- OLD
- width = fig.bbox.x.interval()
- height = fig.bbox.y.interval()
-
- New
- width = fig.bbox.width()
- height = fig.bbox.height()
-
-
-
-
-Object constructors
--------------------
-
- You no longer pass the bbox, dpi, or transforms to the various
- Artist constructors. The old way or creating lines and rectangles
- was cumbersome because you had to pass so many attributes to the
- Line2D and Rectangle classes not related directly to the gemoetry
- and properties of the object. Now default values are added to the
- object when you call axes.add_line or axes.add_patch, so they are
- hidden from the user.
-
- If you want to define a custom transformation on these objects, call
- o.set_transform(trans) where trans is a Transformation instance.
-
- In prior versions of you wanted to add a custom line in data coords,
- you would have to do
-
- l = Line2D(dpi, bbox, x, y,
- color = color,
- transx = transx,
- transy = transy,
- )
-
- now all you need is
-
- l = Line2D(x, y, color=color)
-
- and the axes will set the transformation for you (unless you have
- set your own already, in which case it will eave it unchanged)
-
-Transformations
----------------
-
- The entire transformation architecture has been rewritten.
- Previously the x and y transformations where stored in the xaxis and
- yaxis insstances. The problem with this approach is it only allows
- for separable transforms (where the x and y transformations don't
- depend on one another). But for cases like polar, they do. Now
- transformations operate on x,y together. There is a new base class
- matplotlib.transforms.Transformation and two concrete
- implemetations, matplotlib.transforms.SeparableTransformation and
- matplotlib.transforms.Affine. The SeparableTransformation is
- constructed with the bounding box of the input (this determines the
- rectangular coordinate system of the input, ie the x and y view
- limits), the bounding box of the display, and possibily nonlinear
- transformations of x and y. The 2 most frequently used
- transformations, data cordinates -> display and axes coordinates ->
- display are available as ax.transData and ax.transAxes. See
- alignment_demo.py which uses axes coords.
-
- Also, the transformations should be much faster now, for two reasons
-
- * they are written entirely in extension code
-
- * because they operate on x and y together, they can do the entire
- transformation in one loop. Earlier I did something along the
- lines of
-
- xt = sx*func(x) + tx
- yt = sy*func(y) + ty
-
- Although this was done in numerix, it still involves 6 length(x)
- for-loops (the multiply, add, and function evaluation each for x
- and y). Now all of that is done in a single pass.
-
-
- If you are using transformations and bounding boxes to get the
- cursor position in data coordinates, the method calls are a little
- different now. See the updated examples/coords_demo.py which shows
- you how to do this.
-
- Likewise, if you are using the artist bounding boxes to pick items
- on the canvas with the GUI, the bbox methods are somewhat
- different. You will need to see the updated
- examples/object_picker.py.
-
- See unit/transforms_unit.py for many examples using the new
- transformations.
-
-
-
-API changes at 0.50
-
- * refactored Figure class so it is no longer backend dependent.
- FigureCanvasBackend takes over the backend specific duties of the
- Figure. matplotlib.backend_bases.FigureBase moved to
- matplotlib.figure.Figure.
-
- * backends must implement FigureCanvasBackend (the thing that
- controls the figure and handles the events if any) and
- FigureManagerBackend (wraps the canvas and the window for matlab
- interface). FigureCanvasBase implements a backend switching
- mechanism
-
- * Figure is now an Artist (like everything else in the figure) and
- is totally backend independent
-
- * GDFONTPATH renamed to TTFPATH
-
- * backend faceColor argument changed to rgbFace
-
- * colormap stuff moved to colors.py
-
- * arg_to_rgb in backend_bases moved to class ColorConverter in
- colors.py
-
- * GD users must upgrade to gd-2.0.22 and gdmodule-0.52 since new gd
- features (clipping, antialiased lines) are now used.
-
- * Renderer must implement points_to_pixels
-
-Migrating code:
-
- Matlab interface:
-
- The only API change for those using the matlab interface is in how
- you call figure redraws for dynamically updating figures. In the
- old API, you did
-
- fig.draw()
-
- In the new API, you do
-
- manager = get_current_fig_manager()
- manager.canvas.draw()
-
- See the examples system_monitor.py, dynamic_demo.py, and anim.py
-
- API
-
- There is one important API change for application developers.
- Figure instances used subclass GUI widgets that enabled them to be
- placed directly into figures. Eg, FigureGTK subclassed
- gtk.DrawingArea. Now the Figure class is independent of the
- backend, and FigureCanvas takes over the functionality formerly
- handled by Figure. In order to include figures into your apps,
- you now need to do, for example
-
- # gtk example
- fig = Figure(figsize=(5,4), dpi=100)
- canvas = FigureCanvasGTK(fig) # a gtk.DrawingArea
- canvas.show()
- vbox.pack_start(canvas)
-
- If you use the NavigationToolbar, this in now intialized with a
- FigureCanvas, not a Figure. The examples embedding_in_gtk.py,
- embedding_in_gtk2.py, and mpl_with_glade.py all reflect the new
- API so use these as a guide.
-
- All prior calls to
-
- figure.draw() and
- figure.print_figure(args)
-
- should now be
-
- canvas.draw() and
- canvas.print_figure(args)
-
- Apologies for the inconvenience. This refactorization brings
- significant more freedom in developing matplotlib and should bring
- better plotting capabilities, so I hope the inconvenience is worth
- it.
-
-
-
-API changes at 0.42
-
- * Refactoring AxisText to be backend independent. Text drawing and
- get_window_extent functionality will be moved to the Renderer.
-
- * backend_bases.AxisTextBase is now text.Text module
-
- * All the erase and reset functionality removed frmo AxisText - not
- needed with double buffered drawing. Ditto with state change.
- Text instances have a get_prop_tup method that returns a hashable
- tuple of text properties which you can use to see if text props
- have changed, eg by caching a font or layout instance in a dict
- with the prop tup as a key -- see RendererGTK.get_pango_layout in
- backend_gtk for an example.
-
- * Text._get_xy_display renamed Text.get_xy_display
-
- * Artist set_renderer and wash_brushes methods removed
-
- * Moved Legend class from matplotlib.axes into matplotlib.legend
-
- * Moved Tick, XTick, YTick, Axis, XAxis, YAxis from matplotlib.axes
- to matplotlib.axis
-
- * moved process_text_args to matplotlib.text
-
- * After getting Text handled in a backend independent fashion, the
- import process is much cleaner since there are no longer cyclic
- dependencies
-
- * matplotlib.matlab._get_current_fig_manager renamed to
- matplotlib.matlab.get_current_fig_manager to allow user access to
- the GUI window attribute, eg figManager.window for GTK and
- figManager.frame for wx
-
-
-
-
-
-API changes at 0.40
-
-- Artist
- * __init__ takes a DPI instance and a Bound2D instance which is
- the bounding box of the artist in display coords
- * get_window_extent returns a Bound2D instance
- * set_size is removed; replaced by bbox and dpi
- * the clip_gc method is removed. Artists now clip themselves with
- their box
- * added _clipOn boolean attribute. If True, gc clip to bbox.
-
-- AxisTextBase
- * Initialized with a transx, transy which are Transform instances
- * set_drawing_area removed
- * get_left_right and get_top_bottom are replaced by get_window_extent
-
-- Line2D Patches now take transx, transy
- * Initialized with a transx, transy which are Transform instances
-
-- Patches
- * Initialized with a transx, transy which are Transform instances
-
-- FigureBase attributes dpi is a DPI intance rather than scalar and
- new attribute bbox is a Bound2D in display coords, and I got rid of
- the left, width, height, etc... attributes. These are now
- accessible as, for example, bbox.x.min is left, bbox.x.interval() is
- width, bbox.y.max is top, etc...
-
-- GcfBase attribute pagesize renamed to figsize
-
-- Axes
- * removed figbg attribute
- * added fig instance to __init__
- * resizing is handled by figure call to resize.
-
-- Subplot
- * added fig instance to __init__
-
-- Renderer methods for patches now take gcEdge and gcFace instances.
- gcFace=None takes the place of filled=False
-
-- True and False symbols provided by cbook in a python2.3 compatible
- way
-
-- new module transforms supplies Bound1D, Bound2D and Transform
- instances and more
-
-- Changes to the matlab helpers API
-
- * _matlab_helpers.GcfBase is renamed by Gcf. Backends no longer
- need to derive from this class. Instead, they provide a factory
- function new_figure_manager(num, figsize, dpi). The destroy
- method of the GcfDerived from the backends is moved to the derived
- FigureManager.
-
- * FigureManagerBase moved to backend_bases
-
- * Gcf.get_all_figwins renamed to Gcf.get_all_fig_managers
-
-Jeremy:
-
- Make sure to self._reset = False in AxisTextWX._set_font. This was
- something missing in my backend code.
Added: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst (rev 0)
+++ trunk/matplotlib/doc/api/api_changes.rst 2008-11-19 14:45:44 UTC (rev 6415)
@@ -0,0 +1,1497 @@
+===========
+API Changes
+===========
+
+This chapter is a log of changes to matplotlib that affect the
+outward-facing API. If updating matplotlib breaks your scripts, this
+list may help describe what changes may be necessary in your code.
+
+Changes for 0.98.x
+==================
+
+* Font lookup now uses a nearest-neighbor approach rather than an
+ exact match. Some fonts may be different in plots, but should be
+ closer to what was requested.
+
+* :meth:`matplotlib.axes.Axes.set_xlim`,
+ :meth:`matplotlib.axes.Axes.set_ylim` now return a copy of the
+ :attr:`viewlim` array to avoid modify-in-place surprises.
+
+* :meth:`matplotlib.afm.AFM.get_fullname` and
+ :meth:`matplotlib.afm.AFM.get_familyname` no longer raise an
+ exception if the AFM file does not specify these optional
+ attributes, but returns a guess based on the required FontName
+ attribute.
+
+* Changed precision kwarg in :func:`matplotlib.pyplot.spy`; default is
+ 0, and the string value 'present' is used for sparse arrays only to
+ show filled locations.
+
+* :class:`matplotlib.collections.EllipseCollection` added.
+
+* Added ``angles`` kwarg to :func:`matplotlib.pyplot.quiver` for more
+ flexible specification of the arrow angles.
+
+* Deprecated (raise NotImplementedError) all the mlab2 functions from
+ :mod:`matplotlib.mlab` out of concern that some of them were not
+ clean room implementations.
+
+* Methods :meth:`matplotlib.collections.Collection.get_offsets` and
+ :meth:`matplotlib.collections.Collection.set_offsets` added to
+ :class:`~matplotlib.collections.Collection` base class.
+
+* :attr:`matplotlib.figure.Figure.figurePatch` renamed
+ :attr:`matplotlib.figure.Figure.patch`;
+ :attr:`matplotlib.axes.Axes.axesPatch` renamed
+ :attr:`matplotlib.axes.Axes.patch`;
+ :attr:`matplotlib.axes.Axes.axesFrame` renamed
+ :attr:`matplotlib.axes.Axes.frame`.
+ :meth:`matplotlib.axes.Axes.get_frame`, which returns
+ :attr:`matplotlib.axes.Axes.patch`, is deprecated.
+
+* Changes in the :class:`matplotlib.contour.ContourLabeler` attributes
+ (:func:`matplotlib.pyplot.clabel` function) so that they all have a
+ form like ``.labelAttribute``. The three attributes that are most
+ likely to be used by end users, ``.cl``, ``.cl_xy`` and
+ ``.cl_cvalues`` have been maintained for the moment (in addition to
+ their renamed versions), but they are deprecated and will eventually
+ be removed.
+
+* Moved several functions in :mod:`matplotlib.mlab` and
+ :mod:`matplotlib.cbook` into a separate module
+ :mod:`matplotlib.numerical_methods` because they were unrelated to
+ the initial purpose of mlab or cbook and appeared more coherent
+ elsewhere.
+
+Changes for 0.98.1
+==================
+
+* Removed broken :mod:`matplotlib.axes3d` support and replaced it with
+ a non-implemented error pointing to 0.91.x
+
+Changes for 0.98.0
+==================
+
+* :func:`matplotlib.image.imread` now no longer always returns RGBA data---if
+ the image is luminance or RGB, it will return a MxN or MxNx3 array
+ if possible. Also uint8 is no longer always forced to float.
+
+* Rewrote the :class:`matplotlib.cm.ScalarMappable` callback
+ infrastructure to use :class:`matplotlib.cbook.CallbackRegistry`
+ rather than custom callback handling. Any users of
+ :meth:`matplotlib.cm.ScalarMappable.add_observer` of the
+ :class:`~matplotlib.cm.ScalarMappable` should use the
+ :attr:`matplotlib.cm.ScalarMappable.callbacks`
+ :class:`~matplotlib.cbook.CallbackRegistry` instead.
+
+* New axes function and Axes method provide control over the plot
+ color cycle: :func:`matplotlib.axes.set_default_color_cycle` and
+ :meth:`matplotlib.axes.Axes.set_color_cycle`.
+
+* matplotlib now requires Python 2.4, so :mod:`matplotlib.cbook` will
+ no longer provide :class:`set`, :func:`enumerate`, :func:`reversed`
+ or :func:`izip` compatibility functions.
+
+* In Numpy 1.0, bins are specified by the left edges only. The axes
+ method :meth:`matplotlib.axes.Axes.hist` now uses future Numpy 1.3
+ semantics for histograms. Providing ``binedges``, the last value gives
+ the upper-right edge now, which was implicitly set to +infinity in
+ Numpy 1.0. This also means that the last bin doesn't contain upper
+ outliers any more by default.
+
+* New axes method and pyplot function,
+ :func:`~matplotlib.pyplot.hexbin`, is an alternative to
+ :func:`~matplotlib.pyplot.scatter` for large datasets. It makes
+ something like a :func:`~matplotlib.pyplot.pcolor` of a 2-D
+ histogram, but uses hexagonal bins.
+
+* New kwarg, ``symmetric``, in :class:`matplotlib.ticker.MaxNLocator`
+ allows one require an axis to be centered around zero.
+
+* Toolkits must now be imported from ``mpl_toolkits`` (not ``matplotlib.toolkits``)
+
+Notes about the transforms refactoring
+--------------------------------------
+
+A major new feature of the 0.98 series is a more flexible and
+extensible transformation infrastructure, written in Python/Numpy
+rather than a custom C extension.
+
+The primary goal of this refactoring was to make it easier to
+extend matplotlib to support new kinds of projections. This is
+mostly an internal improvement, and the possible user-visible
+changes it allows are yet to come.
+
+See :mod:`matplotlib.transforms` for a description of the design of
+the new transformation framework.
+
+For efficiency, many of these functions return views into Numpy
+arrays. This means that if you hold on to a reference to them,
+their contents may change. If you want to store a snapshot of
+their current values, use the Numpy array method copy().
+
+The view intervals are now stored only in one place -- in the
+:class:`matplotlib.axes.Axes` instance, not in the locator instances
+as well. This means locators must get their limits from their
+:class:`matplotlib.axis.Axis`, which in turn looks up its limits from
+the :class:`~matplotlib.axes.Axes`. If a locator is used temporarily
+and not assigned to an Axis or Axes, (e.g. in
+:mod:`matplotlib.contour`), a dummy axis must be created to store its
+bounds. Call :meth:`matplotlib.ticker.Locator.create_dummy_axis` to
+do so.
+
+The functionality of :class:`Pbox` has been merged with
+:class:`~matplotlib.transforms.Bbox`. Its methods now all return
+copies rather than modifying in place.
+
+The following lists many of the simple changes necessary to update
+code from the old transformation framework to the new one. In
+particular, methods that return a copy are named with a verb in the
+past tense, whereas methods that alter an object in place are named
+with a verb in the present tense.
+
+:mod:`matplotlib.transforms`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+============================================================ ============================================================
+Old method New method
+============================================================ ============================================================
+:meth:`Bbox.get_bounds` :attr:`transforms.Bbox.bounds`
+------------------------------------------------------------ ------------------------------------------------------------
+:meth:`Bbox.width` :attr:`transforms.Bbox.width`
+------------------------------------------------------------ ------------------------------------------------------------
+:meth:`Bbox.height` :attr:`transforms.Bbox.height`
+------------------------------------------------------------ ------------------------------------------------------------
+`Bbox.intervalx().get_bounds()` :attr:`transforms.Bbox.intervalx`
+`Bbox.intervalx().set_bounds()` [:attr:`Bbox.intervalx` is now a property.]
+------------------------------------------------------------ ------------------------------------------------------------
+`Bbox.intervaly().get_bounds()` :attr:`transforms.Bbox.intervaly`
+`Bbox.intervaly().set_bounds()` [:attr:`Bbox.intervaly` is now a property.]
+------------------------------------------------------------ ------------------------------------------------------------
+:meth:`Bbox.xmin` :attr:`transforms.Bbox.x0` or
+ :attr:`transforms.Bbox.xmin` [1]_
+------------------------------------------------------------ ------------------------------------------------------------
+:meth:`Bbox.ymin` :attr:`transforms.Bbox.y0` or
+ :attr:`transforms.Bbox.ymin` [1]_
+------------------------------------------------------------ ------------------------------------------------------------
+:meth:`Bbox.xmax` :attr:`transforms.Bbox.x1` or
+ :attr:`transforms.Bbox.xmax` [1]_
+------------------------------------------------------------ ------------------------------------------------------------
+:meth:`Bbox.ymax` :attr:`transforms.Bbox.y1` or
+ :attr:`transforms.Bbox.ymax` [1]_
+------------------------------------------------------------ ------------------------------------------------------------
+`Bbox.overlaps(bboxes)` `Bbox.count_overlaps(bboxes)`
+------------------------------------------------------------ ------------------------------------------------------------
+`bbox_all(bboxes)` `Bbox.union(bboxes)`
+ [:meth:`transforms.Bbox.union` is a staticmethod.]
+------------------------------------------------------------ ------------------------------------------------------------
+`lbwh_to_bbox(l, b, w, h)` `Bbox.from_bounds(x0, y0, w, h)`
+ [:meth:`transforms.Bb...
[truncated message content] |
|
From: <ef...@us...> - 2008-11-18 23:38:59
|
Revision: 6414
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6414&view=rev
Author: efiring
Date: 2008-11-18 23:38:53 +0000 (Tue, 18 Nov 2008)
Log Message:
-----------
New custom colormap example; and fix typo in Axes.autoscale_view
Modified Paths:
--------------
trunk/matplotlib/examples/tests/backend_driver.py
trunk/matplotlib/lib/matplotlib/axes.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/custom_cmap.py
Added: trunk/matplotlib/examples/pylab_examples/custom_cmap.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/custom_cmap.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/custom_cmap.py 2008-11-18 23:38:53 UTC (rev 6414)
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.colors import LinearSegmentedColormap
+
+"""
+
+Example: suppose you want red to increase from 0 to 1 over the bottom
+half, green to do the same over the middle half, and blue over the top
+half. Then you would use:
+
+cdict = {'red': ((0.0, 0.0, 0.0),
+ (0.5, 1.0, 1.0),
+ (1.0, 1.0, 1.0)),
+
+ 'green': ((0.0, 0.0, 0.0),
+ (0.25, 0.0, 0.0),
+ (0.75, 1.0, 1.0),
+ (1.0, 1.0, 1.0)),
+
+ 'blue': ((0.0, 0.0, 0.0),
+ (0.5, 0.0, 0.0),
+ (1.0, 1.0, 1.0))}
+
+If, as in this example, there are no discontinuities in the r, g, and b
+components, then it is quite simple: the second and third element of
+each tuple, above, is the same--call it "y". The first element ("x")
+defines interpolation intervals over the full range of 0 to 1, and it
+must span that whole range. In other words, the values of x divide the
+0-to-1 range into a set of segments, and y gives the end-point color
+values for each segment.
+
+Now consider the green. cdict['green'] is saying that for
+0 <= x <= 0.25, y is zero; no green.
+0.25 < x <= 0.75, y varies linearly from 0 to 1.
+x > 0.75, y remains at 1, full green.
+
+If there are discontinuities, then it is a little more complicated.
+Label the 3 elements in each row in the cdict entry for a given color as
+(x, y0, y1). Then for values of x between x[i] and x[i+1] the color
+value is interpolated between y1[i] and y0[i+1].
+
+Going back to the cookbook example, look at cdict['red']; because y0 !=
+y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1,
+but then it jumps down, so that for x from 0.5 to 1, red increases from
+0.7 to 1. Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps
+back to 0, and ramps back to 1 as x goes from 0.5 to 1.
+
+row i: x y0 y1
+ /
+ /
+row i+1: x y0 y1
+
+Above is an attempt to show that for x in the range x[i] to x[i+1], the
+interpolation is between y1[i] and y0[i+1]. So, y0[0] and y1[-1] are
+never used.
+
+"""
+
+
+
+cdict1 = {'red': ((0.0, 0.0, 0.0),
+ (0.5, 0.0, 0.1),
+ (1.0, 1.0, 1.0)),
+
+ 'green': ((0.0, 0.0, 0.0),
+ (1.0, 0.0, 0.0)),
+
+ 'blue': ((0.0, 0.0, 1.0),
+ (0.5, 0.1, 0.0),
+ (1.0, 0.0, 0.0))
+ }
+
+cdict2 = {'red': ((0.0, 0.0, 0.0),
+ (0.5, 0.0, 1.0),
+ (1.0, 0.1, 1.0)),
+
+ 'green': ((0.0, 0.0, 0.0),
+ (1.0, 0.0, 0.0)),
+
+ 'blue': ((0.0, 0.0, 0.1),
+ (0.5, 1.0, 0.0),
+ (1.0, 0.0, 0.0))
+ }
+
+cdict3 = {'red': ((0.0, 0.0, 0.0),
+ (0.25,0.0, 0.0),
+ (0.5, 0.8, 1.0),
+ (0.75,1.0, 1.0),
+ (1.0, 0.4, 1.0)),
+
+ 'green': ((0.0, 0.0, 0.0),
+ (0.25,0.0, 0.0),
+ (0.5, 0.9, 0.9),
+ (0.75,0.0, 0.0),
+ (1.0, 0.0, 0.0)),
+
+ 'blue': ((0.0, 0.0, 0.4),
+ (0.25,1.0, 1.0),
+ (0.5, 1.0, 0.8),
+ (0.75,0.0, 0.0),
+ (1.0, 0.0, 0.0))
+ }
+
+
+blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1)
+blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2)
+blue_red3 = LinearSegmentedColormap('BlueRed3', cdict3)
+
+x = np.arange(0, np.pi, 0.1)
+y = np.arange(0, 2*np.pi, 0.1)
+X, Y = np.meshgrid(x,y)
+Z = np.cos(X) * np.sin(Y)
+
+plt.figure(figsize=(10,4))
+plt.subplots_adjust(wspace=0.3)
+
+plt.subplot(1,3,1)
+plt.imshow(Z, interpolation='nearest', cmap=blue_red1)
+plt.colorbar()
+
+plt.subplot(1,3,2)
+plt.imshow(Z, interpolation='nearest', cmap=blue_red2)
+plt.colorbar()
+
+plt.subplot(1,3,3)
+plt.imshow(Z, interpolation='nearest', cmap=blue_red3)
+plt.colorbar()
+
+plt.suptitle('Custom Blue-Red colormaps')
+
+plt.show()
+
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py 2008-11-18 21:37:25 UTC (rev 6413)
+++ trunk/matplotlib/examples/tests/backend_driver.py 2008-11-18 23:38:53 UTC (rev 6414)
@@ -43,6 +43,7 @@
'contour_demo.py',
'contour_label_demo.py',
'contourf_demo.py',
+ 'custom_cmap.py',
'geo_demo.py',
'griddata_demo.py',
'csd_demo.py',
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-18 21:37:25 UTC (rev 6413)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-18 23:38:53 UTC (rev 6414)
@@ -1496,7 +1496,7 @@
if scalex:
self.set_xbound(x0, x1)
if scaley:
- self.set_ybound(y0, 11)
+ self.set_ybound(y0, y1)
return
if scalex:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2008-11-18 21:37:35
|
Revision: 6413
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6413&view=rev
Author: efiring
Date: 2008-11-18 21:37:25 +0000 (Tue, 18 Nov 2008)
Log Message:
-----------
Improved docstrings in colors.py
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py 2008-11-17 23:08:20 UTC (rev 6412)
+++ trunk/matplotlib/lib/matplotlib/colors.py 2008-11-18 21:37:25 UTC (rev 6413)
@@ -1,10 +1,25 @@
"""
-A class for converting color arguments to RGB or RGBA
+A module for converting numbers or color arguments to *RGB* or *RGBA*
-This class instantiates a single instance colorConverter that is used
-to convert matlab color strings to RGB. RGB is a tuple of float RGB
-values in the range 0-1.
+*RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the
+range 0-1.
+This module includes functions and classes for color specification
+conversions, and for mapping numbers to colors in a 1-D array of
+colors called a colormap. Colormapping typically involves two steps:
+a data array is first mapped onto the range 0-1 using an instance
+of :class:`Normalize` or of a subclass; then this number in the 0-1
+range is mapped to a color using an instance of a subclass of
+:class:`Colormap`. Two are provided here:
+:class:`LinearSegmentedColormap`, which is used to generate all
+the built-in colormap instances, but is also useful for making
+custom colormaps, and :class:`ListedColormap`, which is used for
+generating a custom colormap from a list of color specifications.
+
+The module also provides a single instance, *colorConverter*, of the
+:class:`ColorConverter` class providing methods for converting single
+color specifications or sequences of them to *RGB* or *RGBA*.
+
Commands which take color arguments can use several formats to specify
the colors. For the basic builtin colors, you can use a single letter
@@ -193,6 +208,7 @@
cnames[k] = v
def is_color_like(c):
+ 'Return *True* if *c* can be converted to *RGB*'
try:
colorConverter.to_rgb(c)
return True
@@ -218,6 +234,15 @@
return tuple([int(n, 16)/255.0 for n in (s[1:3], s[3:5], s[5:7])])
class ColorConverter:
+ """
+ Provides methods for converting color specifications to *RGB* or *RGBA*
+
+ Caching is used for more efficient conversion upon repeated calls
+ with the same argument.
+
+ Ordinarily only the single instance instantiated in this module,
+ *colorConverter*, is needed.
+ """
colors = {
'b' : (0.0, 0.0, 1.0),
'g' : (0.0, 0.5, 0.0),
@@ -526,18 +551,48 @@
class LinearSegmentedColormap(Colormap):
"""Colormap objects based on lookup tables using linear segments.
- The lookup transfer function is a simple linear function between
- defined intensities. There is no limit to the number of segments
- that may be defined. Though as the segment intervals start containing
- fewer and fewer array locations, there will be inevitable quantization
- errors
+ The lookup table is generated using linear interpolation for each
+ primary color, with the 0-1 domain divided into any number of
+ segments.
"""
def __init__(self, name, segmentdata, N=256):
"""Create color map from linear mapping segments
segmentdata argument is a dictionary with a red, green and blue
- entries. Each entry should be a list of x, y0, y1 tuples.
+ entries. Each entry should be a list of *x*, *y0*, *y1* tuples,
+ forming rows in a table.
+ Example: suppose you want red to increase from 0 to 1 over
+ the bottom half, green to do the same over the middle half,
+ and blue over the top half. Then you would use::
+
+ cdict = {'red': [(0.0, 0.0, 0.0),
+ (0.5, 1.0, 1.0),
+ (1.0, 1.0, 1.0)],
+
+ 'green': [(0.0, 0.0, 0.0),
+ (0.25, 0.0, 0.0),
+ (0.75, 1.0, 1.0),
+ (1.0, 1.0, 1.0)],
+
+ 'blue': [(0.0, 0.0, 0.0),
+ (0.5, 0.0, 0.0),
+ (1.0, 1.0, 1.0)]}
+
+ Each row in the table for a given color is a sequence of
+ *x*, *y0*, *y1* tuples. In each sequence, *x* must increase
+ monotonically from 0 to 1. For any input value *z* falling
+ between *x[i]* and *x[i+1]*, the output value of a given color
+ will be linearly interpolated between *y1[i]* and *y0[i+1]*::
+
+ row i: x y0 y1
+ /
+ /
+ row i+1: x y0 y1
+
+ Hence y0 in the first row and y1 in the last row are never used.
+
+
.. seealso::
:func:`makeMappingArray`
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|