|
From: <ef...@us...> - 2008-11-11 08:04:30
|
Revision: 6388
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6388&view=rev
Author: efiring
Date: 2008-11-11 08:04:24 +0000 (Tue, 11 Nov 2008)
Log Message:
-----------
Fix autoscaling problem caused by axhline and axvline
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-11 06:52:52 UTC (rev 6387)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-11 08:04:24 UTC (rev 6388)
@@ -1312,7 +1312,8 @@
self._set_artist_props(line)
line.set_clip_path(self.patch)
- self._update_line_limits(line)
+ if line.get_transform() == self.transData:
+ self._update_line_limits(line)
if not line.get_label():
line.set_label('_line%d'%len(self.lines))
self.lines.append(line)
@@ -2774,7 +2775,11 @@
trans = mtransforms.blended_transform_factory(
self.transAxes, self.transData)
- l, = self.plot([xmin,xmax], [y,y], transform=trans, scalex=False, scaley=scaley, **kwargs)
+ l = mlines.Line2D([xmin,xmax], [y,y], transform=trans, **kwargs)
+ self.add_line(l)
+ self.dataLim.y0 = min(self.dataLim.y0, yy)
+ self.dataLim.y1 = max(self.dataLim.y1, yy)
+ self.autoscale_view(scalex=False, scaley=scaley)
return l
@@ -2830,7 +2835,11 @@
trans = mtransforms.blended_transform_factory(
self.transData, self.transAxes)
- l, = self.plot([x,x], [ymin,ymax] , transform=trans, scalex=scalex, scaley=False, **kwargs)
+ l = mlines.Line2D([x,x], [ymin,ymax] , transform=trans, **kwargs)
+ self.add_line(l)
+ self.dataLim.x0 = min(self.dataLim.x0, xx)
+ self.dataLim.x1 = max(self.dataLim.x1, xx)
+ self.autoscale_view(scalex=scalex, scaley=False)
return l
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-11-23 20:15:39
|
Revision: 6440
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6440&view=rev
Author: jdh2358
Date: 2008-11-23 20:15:36 +0000 (Sun, 23 Nov 2008)
Log Message:
-----------
fixed datalim update for fill_between
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-23 20:09:08 UTC (rev 6439)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-23 20:15:36 UTC (rev 6440)
@@ -5559,8 +5559,14 @@
collection = mcoll.PolyCollection(polys, **kwargs)
- self.update_datalim_numerix(x[where], y1[where])
- self.update_datalim_numerix(x[where], y2[where])
+ # now update the datalim and autoscale
+ XY1 = np.array([x[where], y1[where]]).T
+ XY2 = np.array([x[where], y2[where]]).T
+ self.dataLim.update_from_data_xy(XY1, self.ignore_existing_data_limits,
+ updatex=True, updatey=True)
+
+ self.dataLim.update_from_data_xy(XY2, self.ignore_existing_data_limits,
+ updatex=False, updatey=True)
self.add_collection(collection)
self.autoscale_view()
return collection
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2008-11-30 18:34:04
|
Revision: 6458
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6458&view=rev
Author: astraw
Date: 2008-11-30 18:33:55 +0000 (Sun, 30 Nov 2008)
Log Message:
-----------
axes.py: Shorten source code lines so all are less than 80 chars long.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-11-29 21:14:26 UTC (rev 6457)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-11-30 18:33:55 UTC (rev 6458)
@@ -266,7 +266,8 @@
ret = []
if is_string_like(tup2[1]):
- assert self.command == 'plot', 'fill needs at least 2 non-string arguments'
+ assert self.command == 'plot', ('fill needs at least 2 non-string '
+ 'arguments')
y, fmt = tup2
x, y, multicol = self._xy_from_y(y)
@@ -545,10 +546,12 @@
if len(kwargs): martist.setp(self, **kwargs)
if self.xaxis is not None:
- self._xcid = self.xaxis.callbacks.connect('units finalize', self.relim)
+ self._xcid = self.xaxis.callbacks.connect('units finalize',
+ self.relim)
if self.yaxis is not None:
- self._ycid = self.yaxis.callbacks.connect('units finalize', self.relim)
+ self._ycid = self.yaxis.callbacks.connect('units finalize',
+ self.relim)
def get_window_extent(self, *args, **kwargs):
'''
@@ -575,7 +578,8 @@
#these will be updated later as data is added
self.dataLim = mtransforms.Bbox.unit()
self.viewLim = mtransforms.Bbox.unit()
- self.transScale = mtransforms.TransformWrapper(mtransforms.IdentityTransform())
+ self.transScale = mtransforms.TransformWrapper(
+ mtransforms.IdentityTransform())
self._set_lim_and_transforms()
@@ -590,7 +594,8 @@
# Transforms the x and y axis separately by a scale factor
# It is assumed that this part will have non-linear components
- self.transScale = mtransforms.TransformWrapper(mtransforms.IdentityTransform())
+ self.transScale = mtransforms.TransformWrapper(
+ mtransforms.IdentityTransform())
# An affine transformation on the data, generally to limit the
# range of the axes
@@ -815,7 +820,8 @@
self.yaxis.cla()
self.ignore_existing_data_limits = True
- self.callbacks = cbook.CallbackRegistry(('xlim_changed', 'ylim_changed'))
+ self.callbacks = cbook.CallbackRegistry(('xlim_changed',
+ 'ylim_changed'))
if self._sharex is not None:
# major and minor are class instances with
@@ -1128,7 +1134,8 @@
changey = (self in self._shared_x_axes
and self not in self._shared_y_axes)
if changex and changey:
- warnings.warn("adjustable='datalim' cannot work with shared x and y axes")
+ warnings.warn("adjustable='datalim' cannot work with shared "
+ "x and y axes")
return
if changex:
adjust_y = False
@@ -1187,7 +1194,8 @@
self.set_aspect('equal', adjustable='box', anchor='C')
else:
- raise ValueError('Unrecognized string %s to axis; try on or off' % s)
+ raise ValueError('Unrecognized string %s to axis; '
+ 'try on or off' % s)
xmin, xmax = self.get_xlim()
ymin, ymax = self.get_ylim()
return xmin, xmax, ymin, ymax
@@ -1439,7 +1447,8 @@
if xunits!=self.xaxis.units:
#print '\tkw setting xunits', xunits
self.xaxis.set_units(xunits)
- # If the units being set imply a different converter, we need to update.
+ # If the units being set imply a different converter,
+ # we need to update.
if xdata is not None:
self.xaxis.update_units(xdata)
@@ -1447,7 +1456,8 @@
if yunits!=self.yaxis.units:
#print '\tkw setting yunits', yunits
self.yaxis.set_units(yunits)
- # If the units being set imply a different converter, we need to update.
+ # If the units being set imply a different converter,
+ # we need to update.
if ydata is not None:
self.yaxis.update_units(ydata)
@@ -1875,7 +1885,8 @@
for other in self._shared_x_axes.get_siblings(self):
if other is not self:
other.set_xlim(self.viewLim.intervalx, emit=False)
- if other.figure != self.figure and other.figure.canvas is not None:
+ if (other.figure != self.figure and
+ other.figure.canvas is not None):
other.figure.canvas.draw_idle()
return xmin, xmax
@@ -1920,15 +1931,18 @@
def get_xmajorticklabels(self):
'Get the xtick labels as a list of Text instances'
- return cbook.silent_list('Text xticklabel', self.xaxis.get_majorticklabels())
+ return cbook.silent_list('Text xticklabel',
+ self.xaxis.get_majorticklabels())
def get_xminorticklabels(self):
'Get the xtick labels as a list of Text instances'
- return cbook.silent_list('Text xticklabel', self.xaxis.get_minorticklabels())
+ return cbook.silent_list('Text xticklabel',
+ self.xaxis.get_minorticklabels())
def get_xticklabels(self, minor=False):
'Get the xtick labels as a list of Text instances'
- return cbook.silent_list('Text xticklabel', self.xaxis.get_ticklabels(minor=minor))
+ return cbook.silent_list('Text xticklabel',
+ self.xaxis.get_ticklabels(minor=minor))
def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
"""
@@ -1945,8 +1959,10 @@
ACCEPTS: sequence of strings
"""
- return self.xaxis.set_ticklabels(labels, fontdict, minor=minor, **kwargs)
- set_xticklabels.__doc__ = cbook.dedent(set_xticklabels.__doc__) % martist.kwdocd
+ return self.xaxis.set_ticklabels(labels, fontdict,
+ minor=minor, **kwargs)
+ set_xticklabels.__doc__ = cbook.dedent(
+ set_xticklabels.__doc__) % martist.kwdocd
def invert_yaxis(self):
"Invert the y-axis."
@@ -1959,7 +1975,7 @@
return right < left
def get_ybound(self):
- "Returns the y-axis numerical bounds in the form of lowerBound < upperBound"
+ "Return y-axis numerical bounds in the form of lowerBound < upperBound"
left, right = self.get_ylim()
if left < right:
return left, right
@@ -2044,7 +2060,8 @@
for other in self._shared_y_axes.get_siblings(self):
if other is not self:
other.set_ylim(self.viewLim.intervaly, emit=False)
- if other.figure != self.figure and other.figure.canvas is not None:
+ if (other.figure != self.figure and
+ other.figure.canvas is not None):
other.figure.canvas.draw_idle()
return ymin, ymax
@@ -2093,15 +2110,18 @@
def get_ymajorticklabels(self):
'Get the xtick labels as a list of Text instances'
- return cbook.silent_list('Text yticklabel', self.yaxis.get_majorticklabels())
+ return cbook.silent_list('Text yticklabel',
+ self.yaxis.get_majorticklabels())
def get_yminorticklabels(self):
'Get the xtick labels as a list of Text instances'
- return cbook.silent_list('Text yticklabel', self.yaxis.get_minorticklabels())
+ return cbook.silent_list('Text yticklabel',
+ self.yaxis.get_minorticklabels())
def get_yticklabels(self, minor=False):
'Get the xtick labels as a list of Text instances'
- return cbook.silent_list('Text yticklabel', self.yaxis.get_ticklabels(minor=minor))
+ return cbook.silent_list('Text yticklabel',
+ self.yaxis.get_ticklabels(minor=minor))
def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs):
"""
@@ -2118,8 +2138,10 @@
ACCEPTS: sequence of strings
"""
- return self.yaxis.set_ticklabels(labels, fontdict, minor=minor, **kwargs)
- set_yticklabels.__doc__ = cbook.dedent(set_yticklabels.__doc__) % martist.kwdocd
+ return self.yaxis.set_ticklabels(labels, fontdict,
+ minor=minor, **kwargs)
+ set_yticklabels.__doc__ = cbook.dedent(
+ set_yticklabels.__doc__) % martist.kwdocd
def xaxis_date(self, tz=None):
"""Sets up x-axis ticks and labels that treat the x data as dates.
@@ -2412,11 +2434,13 @@
disconnect to disconnect from the axes event
"""
- raise DeprecationWarning('use the callbacks CallbackRegistry instance instead')
+ raise DeprecationWarning('use the callbacks CallbackRegistry instance '
+ 'instead')
def disconnect(self, cid):
'disconnect from the Axes event.'
- raise DeprecationWarning('use the callbacks CallbackRegistry instance instead')
+ raise DeprecationWarning('use the callbacks CallbackRegistry instance '
+ 'instead')
def get_children(self):
'return a list of child artists'
@@ -2456,8 +2480,8 @@
the artist and the artist has picker set
"""
if len(args)>1:
- raise DeprecationWarning(
- 'New pick API implemented -- see API_CHANGES in the src distribution')
+ raise DeprecationWarning('New pick API implemented -- '
+ 'see API_CHANGES in the src distribution')
martist.Artist.pick(self,args[0])
def __pick(self, x, y, trans=None, among=None):
@@ -2773,7 +2797,8 @@
ymin, ymax = self.get_ybound()
- # We need to strip away the units for comparison with non-unitized bounds
+ # We need to strip away the units for comparison with
+ # non-unitized bounds
yy = self.convert_yunits( y )
scaley = (yy<ymin) or (yy>ymax)
@@ -2831,7 +2856,8 @@
xmin, xmax = self.get_xbound()
- # We need to strip away the units for comparison with non-unitized bounds
+ # We need to strip away the units for comparison with
+ # non-unitized bounds
xx = self.convert_xunits( x )
scalex = (xx<xmin) or (xx>xmax)
@@ -2993,8 +3019,9 @@
.. plot:: mpl_examples/pylab_examples/hline_demo.py
"""
if kwargs.get('fmt') is not None:
- raise DeprecationWarning(
- 'hlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES')
+ raise DeprecationWarning('hlines now uses a '
+ 'collections.LineCollection and not a '
+ 'list of Line2D to draw; see API_CHANGES')
# We do the conversion first since not all unitized data is uniform
y = self.convert_yunits( y )
@@ -3069,8 +3096,9 @@
"""
if kwargs.get('fmt') is not None:
- raise DeprecationWarning(
- 'vlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES')
+ raise DeprecationWarning('vlines now uses a '
+ 'collections.LineCollection and not a '
+ 'list of Line2D to draw; see API_CHANGES')
self._process_unit_info(xdata=x, ydata=ymin, kwargs=kwargs)
@@ -3128,10 +3156,10 @@
optional format string. For example, each of the following is
legal::
- plot(x, y) # plot x and y using the default line style and color
- plot(x, y, 'bo') # plot x and y using blue circle markers
- plot(y) # plot y using x as index array 0..N-1
- plot(y, 'r+') # ditto, but with red plusses
+ plot(x, y) # plot x and y using default line style and color
+ plot(x, y, 'bo') # plot x and y using blue circle markers
+ plot(y) # plot y using x as index array 0..N-1
+ plot(y, 'r+') # ditto, but with red plusses
If *x* and/or *y* is 2-dimensional, then the corresponding columns
will be plotted.
@@ -3247,8 +3275,8 @@
the *x* or *y* (or both) data is considered to be dates, and the
axis is labeled accordingly.
- *x* and/or *y* can be a sequence of dates represented as float days since
- 0001-01-01 UTC.
+ *x* and/or *y* can be a sequence of dates represented as float
+ days since 0001-01-01 UTC.
Keyword arguments:
@@ -3317,7 +3345,8 @@
:func:`~matplotlib.pyplot.loglog` supports all the keyword
arguments of :func:`~matplotlib.pyplot.plot` and
- :meth:`matplotlib.axes.Axes.set_xscale`/:meth:`matplotlib.axes.Axes.set_yscale`.
+ :meth:`matplotlib.axes.Axes.set_xscale` /
+ :meth:`matplotlib.axes.Axes.set_yscale`.
Notable keyword arguments:
@@ -3327,9 +3356,8 @@
*subsx*/*subsy*: [ None | sequence ]
the location of the minor *x*/*y* ticks; *None* defaults
to autosubs, which depend on the number of decades in the
- plot; see
- :meth:`matplotlib.axes.Axes.set_xscale`/:meth:`matplotlib.axes.Axes.set_yscale`
- for details
+ plot; see :meth:`matplotlib.axes.Axes.set_xscale` /
+ :meth:`matplotlib.axes.Axes.set_yscale` for details
The remaining valid kwargs are
:class:`~matplotlib.lines.Line2D` properties:
@@ -3497,8 +3525,9 @@
- *b* is the *x*-axis.
.. seealso::
- :meth:`~matplotlib.axes.Axes.plot` or :meth:`~matplotlib.axes.Axes.vlines`:
- For documentation on valid kwargs.
+ :meth:`~matplotlib.axes.Axes.plot` or
+ :meth:`~matplotlib.axes.Axes.vlines`: For documentation on
+ valid kwargs.
**Example:**
@@ -3512,8 +3541,8 @@
return self.xcorr(x, x, **kwargs)
acorr.__doc__ = cbook.dedent(acorr.__doc__) % martist.kwdocd
- def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none, usevlines=False,
- maxlags=None, **kwargs):
+ def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none,
+ usevlines=False, maxlags=None, **kwargs):
"""
call signature::
@@ -3581,7 +3610,8 @@
if maxlags is None: maxlags = Nx - 1
if maxlags >= Nx or maxlags < 1:
- raise ValueError('maglags must be None or strictly positive < %d'%Nx)
+ raise ValueError('maglags must be None or strictly '
+ 'positive < %d'%Nx)
lags = np.arange(-maxlags,maxlags+1)
c = c[Nx-1-maxlags:Nx+maxlags]
@@ -3723,11 +3753,13 @@
labels = []
for handle in get_handles():
label = handle.get_label()
- if label is not None and label != '' and not label.startswith('_'):
+ if (label is not None and
+ label != '' and not label.startswith('_')):
handles.append(handle)
labels.append(label)
if len(handles) == 0:
- warnings.warn("No labeled objects found. Use label='...' kwarg on individual plots.")
+ warnings.warn("No labeled objects found. "
+ "Use label='...' kwarg on individual plots.")
return None
elif len(args)==1:
@@ -3784,7 +3816,8 @@
where = kwargs.pop('where', 'pre')
if where not in ('pre', 'post', 'mid'):
- raise ValueError("'where' argument to step must be 'pre', 'post' or 'mid'")
+ raise ValueError("'where' argument to step must be "
+ "'pre', 'post' or 'mid'")
kwargs['linestyle'] = 'steps-' + where
return self.plot(x, y, *args, **kwargs)
@@ -3960,18 +3993,24 @@
# FIXME: convert the following to proper input validation
# raising ValueError; don't use assert for this.
assert len(left)==nbars, "argument 'left' must be %d or scalar" % nbars
- assert len(height)==nbars, "argument 'height' must be %d or scalar" % nbars
- assert len(width)==nbars, "argument 'width' must be %d or scalar" % nbars
- assert len(bottom)==nbars, "argument 'bottom' must be %d or scalar" % nbars
+ assert len(height)==nbars, ("argument 'height' must be %d or scalar" %
+ nbars)
+ assert len(width)==nbars, ("argument 'width' must be %d or scalar" %
+ nbars)
+ assert len(bottom)==nbars, ("argument 'bottom' must be %d or scalar" %
+ nbars)
if yerr is not None and len(yerr)!=nbars:
- raise ValueError("bar() argument 'yerr' must be len(%s) or scalar" % nbars)
+ raise ValueError(
+ "bar() argument 'yerr' must be len(%s) or scalar" % nbars)
if xerr is not None and len(xerr)!=nbars:
- raise ValueError("bar() argument 'xerr' must be len(%s) or scalar" % nbars)
+ raise ValueError(
+ "bar() argument 'xerr' must be len(%s) or scalar" % nbars)
patches = []
- # lets do some conversions now since some types cannot be subtracted uniformly
+ # lets do some conversions now since some types cannot be
+ # subtracted uniformly
if self.xaxis is not None:
xconv = self.xaxis.converter
if xconv is not None:
@@ -4189,12 +4228,13 @@
*baseline*).
.. seealso::
- `this document
- <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html>`_:
- for details
+ `this document`__ for details
:file:`examples/pylab_examples/stem_plot.py`:
for a demo
+
+ __ http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html
+
"""
remember_hold=self._hold
if not self._hold: self.cla()
@@ -4344,7 +4384,8 @@
elif callable(autopct):
s = autopct(100.*frac)
else:
- raise TypeError('autopct must be callable or a format string')
+ raise TypeError(
+ 'autopct must be callable or a format string')
t = self.text(xt, yt, s,
horizontalalignment='center',
@@ -4449,7 +4490,8 @@
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
if not self._hold: self.cla()
- # make sure all the args are iterable; use lists not arrays to preserve units
+ # make sure all the args are iterable; use lists not arrays to
+ # preserve units
if not iterable(x):
x = [x]
@@ -4521,14 +4563,19 @@
plot_kw['transform'] = kwargs['transform']
if xerr is not None:
- if iterable(xerr) and len(xerr)==2 and iterable(xerr[0]) and iterable(xerr[1]):
+ if (iterable(xerr) and len(xerr)==2 and
+ iterable(xerr[0]) and iterable(xerr[1])):
# using list comps rather than arrays to preserve units
- left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[0])]
- right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr[1])]
+ left = [thisx-thiserr for (thisx, thiserr)
+ in cbook.safezip(x,xerr[0])]
+ right = [thisx+thiserr for (thisx, thiserr)
+ in cbook.safezip(x,xerr[1])]
else:
# using list comps rather than arrays to preserve units
- left = [thisx-thiserr for (thisx, thiserr) in cbook.safezip(x,xerr)]
- right = [thisx+thiserr for (thisx, thiserr) in cbook.safezip(x,xerr)]
+ left = [thisx-thiserr for (thisx, thiserr)
+ in cbook.safezip(x,xerr)]
+ right = [thisx+thiserr for (thisx, thiserr)
+ in cbook.safezip(x,xerr)]
barcols.append( self.hlines(y, left, right, **lines_kw ) )
if capsize > 0:
@@ -4537,7 +4584,9 @@
# y are lists
leftlo, ylo = xywhere(left, y, xlolims)
- caplines.extend( self.plot(leftlo, ylo, ls='None', marker=mlines.CARETLEFT, **plot_kw) )
+ caplines.extend(
+ self.plot(leftlo, ylo, ls='None',
+ marker=mlines.CARETLEFT, **plot_kw) )
xlolims = ~xlolims
leftlo, ylo = xywhere(left, y, xlolims)
caplines.extend( self.plot(leftlo, ylo, 'k|', **plot_kw) )
@@ -4547,7 +4596,9 @@
if xuplims.any():
rightup, yup = xywhere(right, y, xuplims)
- caplines.extend( self.plot(rightup, yup, ls='None', marker=mlines.CARETRIGHT, **plot_kw) )
+ caplines.extend(
+ self.plot(rightup, yup, ls='None',
+ marker=mlines.CARETRIGHT, **plot_kw) )
xuplims = ~xuplims
rightup, yup = xywhere(right, y, xuplims)
caplines.extend( self.plot(rightup, yup, 'k|', **plot_kw) )
@@ -4555,21 +4606,28 @@
caplines.extend( self.plot(right, y, 'k|', **plot_kw) )
if yerr is not None:
- if iterable(yerr) and len(yerr)==2 and iterable(yerr[0]) and iterable(yerr[1]):
+ if (iterable(yerr) and len(yerr)==2 and
+ iterable(yerr[0]) and iterable(yerr[1])):
# using list comps rather than arrays to preserve units
- lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[0])]
- upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr[1])]
+ lower = [thisy-thiserr for (thisy, thiserr)
+ in cbook.safezip(y,yerr[0])]
+ upper = [thisy+thiserr for (thisy, thiserr)
+ in cbook.safezip(y,yerr[1])]
else:
# using list comps rather than arrays to preserve units
- lower = [thisy-thiserr for (thisy, thiserr) in cbook.safezip(y,yerr)]
- upper = [thisy+thiserr for (thisy, thiserr) in cbook.safezip(y,yerr)]
+ lower = [thisy-thiserr for (thisy, thiserr)
+ in cbook.safezip(y,yerr)]
+ upper = [thisy+thiserr for (thisy, thiserr)
+ in cbook.safezip(y,yerr)]
barcols.append( self.vlines(x, lower, upper, **lines_kw) )
if capsize > 0:
if lolims.any():
xlo, lowerlo = xywhere(x, lower, lolims)
- caplines.extend( self.plot(xlo, lowerlo, ls='None', marker=mlines.CARETDOWN, **plot_kw) )
+ caplines.extend(
+ self.plot(xlo, lowerlo, ls='None',
+ marker=mlines.CARETDOWN, **plot_kw) )
lolims = ~lolims
xlo, lowerlo = xywhere(x, lower, lolims)
caplines.extend( self.plot(xlo, lowerlo, 'k_', **plot_kw) )
@@ -4579,7 +4637,9 @@
if uplims.any():
xup, upperup = xywhere(x, upper, uplims)
- caplines.extend( self.plot(xup, upperup, ls='None', marker=mlines.CARETUP, **plot_kw) )
+ caplines.extend(
+ self.plot(xup, upperup, ls='None',
+ marker=mlines.CARETUP, **plot_kw) )
uplims = ~uplims
xup, upperup = xywhere(x, upper, uplims)
caplines.extend( self.plot(xup, upperup, 'k_', **plot_kw) )
@@ -4962,8 +5022,9 @@
edgecolors = None
else:
edgecolors = 'none'
- warnings.warn('''replace "faceted=False" with "edgecolors='none'"''',
- DeprecationWarning) #2008/04/18
+ warnings.warn(
+ '''replace "faceted=False" with "edgecolors='none'"''',
+ DeprecationWarning) #2008/04/18
sym = None
symstyle = 0
@@ -5302,7 +5363,8 @@
else:
lattice2[i,j] = np.nan
- accum = np.hstack(( lattice1.astype(float).ravel(), lattice2.astype(float).ravel() ))
+ accum = np.hstack((
+ lattice1.astype(float).ravel(), lattice2.astype(float).ravel()))
good_idxs = ~np.isnan(accum)
px = xmin + sx * np.array([ 0.5, 0.5, 0.0, -0.5, -0.5, 0.0])
@@ -5734,7 +5796,8 @@
Y = y.repeat(Nx, axis=1)
if X.shape != Y.shape:
raise TypeError(
- 'Incompatible X, Y inputs to %s; see help(%s)' % (funcname, funcname))
+ 'Incompatible X, Y inputs to %s; see help(%s)' % (
+ funcname, funcname))
return X, Y, C
def pcolor(self, *args, **kwargs):
@@ -6025,7 +6088,8 @@
Ny, Nx = X.shape
# convert to one dimensional arrays
- C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at lower left corner
+ C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at
+ # lower left corner
X = X.ravel()
Y = Y.ravel()
@@ -6039,7 +6103,8 @@
showedges = 0
collection = mcoll.QuadMesh(
- Nx - 1, Ny - 1, coords, showedges, antialiased=antialiased) # kwargs are not used
+ Nx - 1, Ny - 1, coords, showedges,
+ antialiased=antialiased) # kwargs are not used
collection.set_alpha(alpha)
collection.set_array(C)
if norm is not None: assert(isinstance(norm, mcolors.Normalize))
@@ -6184,7 +6249,8 @@
# convert to one dimensional arrays
# This should also be moved to the QuadMesh class
- C = ma.ravel(C) # data point in each cell is value at lower left corner
+ C = ma.ravel(C) # data point in each cell is value
+ # at lower left corner
X = x.ravel()
Y = y.ravel()
Nx = nc+1
@@ -6446,7 +6512,8 @@
if kwargs.get('width') is not None:
raise DeprecationWarning(
- 'hist now uses the rwidth to give relative width and not absolute width')
+ 'hist now uses the rwidth to give relative width '
+ 'and not absolute width')
try:
# make sure a copy is created: don't use asarray
@@ -6454,7 +6521,8 @@
if len(x.shape)==1:
x.shape = (1,x.shape[0])
elif len(x.shape)==2 and x.shape[1]<x.shape[0]:
- warnings.warn('2D hist should be nsamples x nvariables; this looks transposed')
+ warnings.warn('2D hist should be nsamples x nvariables; '
+ 'this looks transposed')
except ValueError:
# multiple hist with data of different length
if iterable(x[0]) and not is_string_like(x[0]):
@@ -6957,7 +7025,8 @@
mask = np.absolute(Z)>precision
if 'cmap' not in kwargs:
- kwargs['cmap'] = mcolors.ListedColormap(['w', 'k'], name='binary')
+ kwargs['cmap'] = mcolors.ListedColormap(['w', 'k'],
+ name='binary')
nr, nc = Z.shape
extent = [-0.5, nc-0.5, nr-0.5, -0.5]
ret = self.imshow(mask, interpolation='nearest', aspect=aspect,
@@ -7072,7 +7141,8 @@
total = rows*cols
- num -= 1 # convert from matlab to python indexing ie num in range(0,total)
+ num -= 1 # convert from matlab to python indexing
+ # ie num in range(0,total)
if num >= total:
raise ValueError( 'Subplot number exceeds total subplots')
self._rows = rows
@@ -7125,7 +7195,8 @@
figBottom = top - (rowNum+1)*figH - rowNum*sepH
figLeft = left + colNum*(figW + sepW)
- self.figbox = mtransforms.Bbox.from_bounds(figLeft, figBottom, figW, figH)
+ self.figbox = mtransforms.Bbox.from_bounds(figLeft, figBottom,
+ figW, figH)
self.rowNum = rowNum
self.colNum = colNum
self.numRows = rows
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-04 22:15:57
|
Revision: 6493
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6493&view=rev
Author: ryanmay
Date: 2008-12-04 22:13:57 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
Replace tabs in indentation with spaces.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-04 21:02:36 UTC (rev 6492)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-04 22:13:57 UTC (rev 6493)
@@ -5579,14 +5579,14 @@
"""
x = np.asarray(x)
- if not cbook.iterable(y1):
- y1 = np.ones_like(x)*y1
+ if not cbook.iterable(y1):
+ y1 = np.ones_like(x)*y1
- if not cbook.iterable(y2):
- y2 = np.ones_like(x)*y2
+ if not cbook.iterable(y2):
+ y2 = np.ones_like(x)*y2
- if where is None:
- where = np.ones(len(x), np.bool)
+ if where is None:
+ where = np.ones(len(x), np.bool)
y1 = np.asarray(y1)
y2 = np.asarray(y2)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mme...@us...> - 2008-12-05 14:48:51
|
Revision: 6496
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6496&view=rev
Author: mmetz_bn
Date: 2008-12-05 14:48:45 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
hist docstring updated & exception added
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-05 00:08:43 UTC (rev 6495)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-05 14:48:45 UTC (rev 6496)
@@ -6430,6 +6430,10 @@
are ignored. If not provided, *range* is (x.min(), x.max()).
Range has no effect if *bins* is a sequence.
+ If *bins* is a sequence or *range* is specified, autoscaling is
+ set off (*autoscale_on* is set to *False*) and the xaxis limits
+ are set to encompass the full specified bin range.
+
*normed*:
If *True*, the first element of the return tuple will
be the counts normalized to form a probability density, i.e.,
@@ -6533,6 +6537,8 @@
for i in xrange(len(x)):
tx.append( np.array(x[i]) )
x = tx
+ else:
+ raise ValueError, 'Can not use providet data to create a histogram'
# Check whether bins or range are given explicitly. In that
# case do not autoscale axes.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-05 15:56:33
|
Revision: 6497
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6497&view=rev
Author: ryanmay
Date: 2008-12-05 15:56:26 +0000 (Fri, 05 Dec 2008)
Log Message:
-----------
Add support for data with units to Axes.fill_between().
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-05 14:48:45 UTC (rev 6496)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-05 15:56:26 UTC (rev 6497)
@@ -5578,7 +5578,15 @@
%(PolyCollection)s
"""
- x = np.asarray(x)
+ # Handle united data, such as dates
+ self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs)
+ self._process_unit_info(ydata=y2)
+
+ # Convert the arrays so we can work with them
+ x = np.asarray(self.convert_xunits(x))
+ y1 = np.asarray(self.convert_yunits(y1))
+ y2 = np.asarray(self.convert_yunits(y2))
+
if not cbook.iterable(y1):
y1 = np.ones_like(x)*y1
@@ -5588,8 +5596,6 @@
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))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2008-12-07 20:52:17
|
Revision: 6504
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6504&view=rev
Author: leejjoon
Date: 2008-12-07 20:52:13 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
axes.py : a slight change in the numpy version checking code
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-07 20:40:12 UTC (rev 6503)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-07 20:52:13 UTC (rev 6504)
@@ -6551,8 +6551,7 @@
binsgiven = (cbook.iterable(bins) or range != None)
# check the version of the numpy
- np_version = float(".".join(np.__version__.split(".")[:2]))
- if np_version < 1.2: # version 1.1
+ if np.__version__ < "1.2": # version 1.1
hist_kwargs = dict(range=range,
normed=bool(normed), new=True)
else: # version 1.2 and later, drop new=True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-08 21:27:44
|
Revision: 6521
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6521&view=rev
Author: ryanmay
Date: 2008-12-08 21:27:40 +0000 (Mon, 08 Dec 2008)
Log Message:
-----------
Remove trailing whitespace.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-08 21:23:04 UTC (rev 6520)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-08 21:27:40 UTC (rev 6521)
@@ -6521,7 +6521,7 @@
if not self._hold: self.cla()
# NOTE: the range keyword overwrites the built-in func range !!!
- # needs to be fixed in with numpy !!!
+ # needs to be fixed in with numpy !!!
if kwargs.get('width') is not None:
raise DeprecationWarning(
@@ -6551,7 +6551,7 @@
binsgiven = (cbook.iterable(bins) or range != None)
# check the version of the numpy
- if np.__version__ < "1.2": # version 1.1
+ if np.__version__ < "1.2": # version 1.1
hist_kwargs = dict(range=range,
normed=bool(normed), new=True)
else: # version 1.2 and later, drop new=True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-09 04:12:37
|
Revision: 6532
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6532&view=rev
Author: ryanmay
Date: 2008-12-09 04:12:34 +0000 (Tue, 09 Dec 2008)
Log Message:
-----------
Fix typo in docstring.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-09 03:51:35 UTC (rev 6531)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-09 04:12:34 UTC (rev 6532)
@@ -5548,7 +5548,7 @@
fill_between(x, y1, y2=0, where=None, **kwargs)
- Create a :class:`~matplotlib.collectionsPolyCollection`
+ Create a :class:`~matplotlib.collections.PolyCollection`
filling the regions between *y1* and *y2* where
``where==True``
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mme...@us...> - 2008-12-09 10:23:57
|
Revision: 6534
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6534&view=rev
Author: mmetz_bn
Date: 2008-12-09 10:23:53 +0000 (Tue, 09 Dec 2008)
Log Message:
-----------
typo in subplot docs
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-09 04:39:50 UTC (rev 6533)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-09 10:23:53 UTC (rev 6534)
@@ -7163,7 +7163,7 @@
*args* is the tuple (*numRows*, *numCols*, *plotNum*), where
the array of subplots in the figure has dimensions *numRows*,
*numCols*, and where *plotNum* is the number of the subplot
- being created. *plotNum* starts at 1 in the upper right
+ being created. *plotNum* starts at 1 in the upper left
corner and increases to the right.
If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-10 15:02:17
|
Revision: 6548
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6548&view=rev
Author: jdh2358
Date: 2008-12-10 15:02:14 +0000 (Wed, 10 Dec 2008)
Log Message:
-----------
updated plot docstring
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-10 14:55:05 UTC (rev 6547)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-10 15:02:14 UTC (rev 6548)
@@ -3171,46 +3171,55 @@
Return value is a list of lines that were added.
- The following line styles are supported::
+ The following format string characters are accepted to control
+ the line style or marker
- - # solid line
- -- # dashed line
- -. # dash-dot line
- : # dotted line
- . # points
- , # pixels
- o # circle symbols
- ^ # triangle up symbols
- v # triangle down symbols
- < # triangle left symbols
- > # triangle right symbols
- s # square symbols
- + # plus symbols
- * # star symbols
- x # cross symbols
- D # diamond symbols
- d # thin diamond symbols
- 1 # tripod down symbols
- 2 # tripod up symbols
- 3 # tripod left symbols
- 4 # tripod right symbols
- h # hexagon symbols
- H # rotated hexagon symbols
- p # pentagon symbols
- | # vertical line symbols
- _ # horizontal line symbols
- steps # use gnuplot style 'steps' # kwarg only
+ ================ ===============================
+ character description
+ ================ ===============================
+ '-' solid line style
+ '--' dashed line style
+ '-.' dash-dot line style
+ ':' dotted line style
+ '.' point marker
+ ',' pixel marker
+ 'o' circle marker
+ 'v' triangle_down marker
+ '^' triangle_up marker
+ '<' triangle_left marker
+ '>' triangle_right marker
+ '1' tri_down marker
+ '2' tri_up marker
+ '3' tri_left marker
+ '4' tri_right marker
+ 's' square marker
+ 'p' pentagon marker
+ '*' star marker
+ 'h' hexagon1 marker
+ 'H' hexagon2 marker
+ '+' plus marker
+ 'x' x marker
+ 'D' diamond marker
+ 'd' thin_diamond marker
+ '|' vline marker
+ '_' hline marker
+ ================ ===============================
+
The following color abbreviations are supported::
- b # blue
- g # green
- r # red
- c # cyan
- m # magenta
- y # yellow
- k # black
- w # white
+ ========== ========
+ character color
+ ========== ========
+ 'b' blue
+ 'g' green
+ 'r' red
+ 'c' cyan
+ 'm' magenta
+ 'y' yellow
+ 'k' black
+ 'w' white
+ ========== ========
In addition, you can specify colors in many weird and
wonderful ways, including full names (``'green'``), hex
@@ -3239,6 +3248,15 @@
Neither line will be antialiased.
+ You do not need to use format strings, which are just
+ abbreviations. All of the line properties can be controlled
+ by keyword arguments. For example, you can set the color,
+ marker, linestyle, and markercolor with::
+
+ plot(x, y, color='green', linestyle='dashed', marker='o',
+ markerfacecolor='blue', markersize=12). See
+ :class:`~matplotlib.lines.Line2D` for details.
+
The kwargs are :class:`~matplotlib.lines.Line2D` properties:
%(Line2D)s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-23 19:54:22
|
Revision: 6700
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6700&view=rev
Author: jdh2358
Date: 2008-12-23 19:54:17 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
added support for mincnt to hexbin
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:49:08 UTC (rev 6699)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:54:17 UTC (rev 6700)
@@ -5270,7 +5270,7 @@
Use a linear or log10 scale on the vertical axis.
*mincnt*: None | a positive integer
- If not None, only display cells with at least *mincnt*
+ If not None, only display cells with more than *mincnt*
number of points in the cell
Other keyword arguments controlling color mapping and normalization
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-23 23:17:26
|
Revision: 6701
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6701&view=rev
Author: jdh2358
Date: 2008-12-23 21:55:45 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
fixed a mincnt problem with hexbin
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 19:54:17 UTC (rev 6700)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2008-12-23 21:55:45 UTC (rev 6701)
@@ -5417,7 +5417,7 @@
for i in xrange(nx2):
for j in xrange(ny2):
vals = lattice2[i,j]
- if len(vals):
+ if len(vals)>mincnt:
lattice2[i,j] = reduce_C_function( vals )
else:
lattice2[i,j] = np.nan
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-01-12 12:22:16
|
Revision: 6779
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6779&view=rev
Author: jdh2358
Date: 2009-01-12 12:22:11 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
Added TJ's hexbin mincnt patch; made marginals False by default
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-01-12 09:04:57 UTC (rev 6778)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-01-12 12:22:11 UTC (rev 6779)
@@ -5219,7 +5219,7 @@
xscale = 'linear', yscale = 'linear',
cmap=None, norm=None, vmin=None, vmax=None,
alpha=1.0, linewidths=None, edgecolors='none',
- reduce_C_function = np.mean, mincnt=None, marginals=True,
+ reduce_C_function = np.mean, mincnt=None, marginals=False,
**kwargs):
"""
call signature::
@@ -5395,9 +5395,6 @@
d1 = (x-ix1)**2 + 3.0 * (y-iy1)**2
d2 = (x-ix2-0.5)**2 + 3.0 * (y-iy2-0.5)**2
bdist = (d1<d2)
- if mincnt is None:
- mincnt = 0
-
if C is None:
accum = np.zeros(n)
# Create appropriate views into "accum" array.
@@ -5411,7 +5408,25 @@
lattice1[ix1[i], iy1[i]]+=1
else:
lattice2[ix2[i], iy2[i]]+=1
+
+ # threshold
+ if mincnt is not None:
+ for i in xrange(nx1):
+ for j in xrange(ny1):
+ if lattice1[i,j]<mincnt:
+ lattice1[i,j] = np.nan
+ for i in xrange(nx2):
+ for j in xrange(ny2):
+ if lattice2[i,j]<mincnt:
+ lattice2[i,j] = np.nan
+ accum = np.hstack((
+ lattice1.astype(float).ravel(), lattice2.astype(float).ravel()))
+ good_idxs = ~np.isnan(accum)
+
else:
+ if mincnt is None:
+ mincnt = 0
+
# create accumulation arrays
lattice1 = np.empty((nx1,ny1),dtype=object)
for i in xrange(nx1):
@@ -5457,10 +5472,9 @@
polygons[:,nx1*ny1:,0] = np.repeat(np.arange(nx2) + 0.5, ny2)
polygons[:,nx1*ny1:,1] = np.tile(np.arange(ny2), nx2) + 0.5
- if C is not None:
- # remove accumulation bins with no data
- polygons = polygons[:,good_idxs,:]
- accum = accum[good_idxs]
+ # remove accumulation bins with no data
+ polygons = polygons[:,good_idxs,:]
+ accum = accum[good_idxs]
polygons = np.transpose(polygons, axes=[1,0,2])
polygons[:,:,0] *= sx
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-01-15 19:41:57
|
Revision: 6784
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6784&view=rev
Author: mdboom
Date: 2009-01-15 19:41:52 +0000 (Thu, 15 Jan 2009)
Log Message:
-----------
[ 2502384 ] Typo in Documentation
Linestyle strings are literal-quoted to prevent Sphinx from converting the characters within them.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-01-14 17:54:36 UTC (rev 6783)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-01-15 19:41:52 UTC (rev 6784)
@@ -3216,32 +3216,32 @@
================ ===============================
character description
================ ===============================
- '-' solid line style
- '--' dashed line style
- '-.' dash-dot line style
- ':' dotted line style
- '.' point marker
- ',' pixel marker
- 'o' circle marker
- 'v' triangle_down marker
- '^' triangle_up marker
- '<' triangle_left marker
- '>' triangle_right marker
- '1' tri_down marker
- '2' tri_up marker
- '3' tri_left marker
- '4' tri_right marker
- 's' square marker
- 'p' pentagon marker
- '*' star marker
- 'h' hexagon1 marker
- 'H' hexagon2 marker
- '+' plus marker
- 'x' x marker
- 'D' diamond marker
- 'd' thin_diamond marker
- '|' vline marker
- '_' hline marker
+ ``'-'`` solid line style
+ ``'--'`` dashed line style
+ ``'-.'`` dash-dot line style
+ ``':'`` dotted line style
+ ``'.'`` point marker
+ ``','`` pixel marker
+ ``'o'`` circle marker
+ ``'v'`` triangle_down marker
+ ``'^'`` triangle_up marker
+ ``'<'`` triangle_left marker
+ ``'>'`` triangle_right marker
+ ``'1'`` tri_down marker
+ ``'2'`` tri_up marker
+ ``'3'`` tri_left marker
+ ``'4'`` tri_right marker
+ ``'s'`` square marker
+ ``'p'`` pentagon marker
+ ``'*'`` star marker
+ ``'h'`` hexagon1 marker
+ ``'H'`` hexagon2 marker
+ ``'+'`` plus marker
+ ``'x'`` x marker
+ ``'D'`` diamond marker
+ ``'d'`` thin_diamond marker
+ ``'|'`` vline marker
+ ``'_'`` hline marker
================ ===============================
@@ -5348,10 +5348,10 @@
self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs)
-
+
x, y, C = cbook.delete_masked_points(x, y, C)
-
+
# Set the size of the hexagon grid
if iterable(gridsize):
nx, ny = gridsize
@@ -5561,7 +5561,7 @@
else:
thismax = thismin + np.diff(coarse)[-1]
- if not valid[i]: continue
+ if not valid[i]: continue
verts.append([(thismin, 0), (thismin, 0.05), (thismax, 0.05), (thismax, 0)])
values.append(val)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jr...@us...> - 2009-01-29 21:01:50
|
Revision: 6853
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6853&view=rev
Author: jrevans
Date: 2009-01-29 21:01:45 +0000 (Thu, 29 Jan 2009)
Log Message:
-----------
Added ability to turn on/off the autoscale for the X & Y axes independantly.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-01-29 19:59:22 UTC (rev 6852)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-01-29 21:01:45 UTC (rev 6853)
@@ -862,7 +862,8 @@
else:
self.yaxis.set_scale('linear')
- self._autoscaleon = True
+ self._autoscaleXon = True
+ self._autoscaleYon = True
self._update_transScale() # needed?
self._get_lines = _process_plot_var_args(self)
@@ -1489,18 +1490,47 @@
def get_autoscale_on(self):
"""
- Get whether autoscaling is applied on plot commands
+ Get whether autoscaling is applied for both axes on plot commands
"""
- return self._autoscaleon
+ return self._autoscaleXon and self._autoscaleYon
+ def get_autoscalex_on(self):
+ """
+ Get whether autoscaling for the x-axis is applied on plot commands
+ """
+ return self._autoscaleXon
+
+ def get_autoscaley_on(self):
+ """
+ Get whether autoscaling for the y-axis is applied on plot commands
+ """
+ return self._autoscaleYon
+
def set_autoscale_on(self, b):
"""
Set whether autoscaling is applied on plot commands
accepts: [ *True* | *False* ]
"""
- self._autoscaleon = b
+ self._autoscaleXon = b
+ self._autoscaleYon = b
+ def set_autoscalex_on(self, b):
+ """
+ Set whether autoscaling for the x-axis is applied on plot commands
+
+ accepts: [ *True* | *False* ]
+ """
+ self._autoscaleXon = b
+
+ def set_autoscaley_on(self, b):
+ """
+ Set whether autoscaling for the y-axis is applied on plot commands
+
+ accepts: [ *True* | *False* ]
+ """
+ self._autoscaleYon = b
+
def autoscale_view(self, tight=False, scalex=True, scaley=True):
"""
autoscale the view limits using the data limits. You can
@@ -1509,13 +1539,12 @@
axis direction reversal that has already been done.
"""
# if image data only just use the datalim
- if not self._autoscaleon: return
- if scalex:
+ if scalex and self._autoscaleXon:
xshared = self._shared_x_axes.get_siblings(self)
dl = [ax.dataLim for ax in xshared]
bb = mtransforms.BboxBase.union(dl)
x0, x1 = bb.intervalx
- if scaley:
+ if scaley and self._autoscaleYon:
yshared = self._shared_y_axes.get_siblings(self)
dl = [ax.dataLim for ax in yshared]
bb = mtransforms.BboxBase.union(dl)
@@ -1523,16 +1552,16 @@
if (tight or (len(self.images)>0 and
len(self.lines)==0 and
len(self.patches)==0)):
- if scalex:
+ if scalex and self._autoscaleXon:
self.set_xbound(x0, x1)
- if scaley:
+ if scaley and self._autoscaleYon:
self.set_ybound(y0, y1)
return
- if scalex:
+ if scalex and self._autoscaleXon:
XL = self.xaxis.get_major_locator().view_limits(x0, x1)
self.set_xbound(XL)
- if scaley:
+ if scaley and self._autoscaleYon:
YL = self.yaxis.get_major_locator().view_limits(y0, y1)
self.set_ybound(YL)
@@ -5953,8 +5982,9 @@
corners = (xmin, ymin), (xmax, ymax)
self.update_datalim(corners)
- if self._autoscaleon:
+ if self._autoscaleXon:
self.set_xlim((xmin, xmax))
+ if self._autoscaleYon:
self.set_ylim((ymin, ymax))
self.images.append(im)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-09 18:49:51
|
Revision: 6895
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6895&view=rev
Author: mdboom
Date: 2009-02-09 18:49:49 +0000 (Mon, 09 Feb 2009)
Log Message:
-----------
Very minor indentation fix.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-09 18:23:56 UTC (rev 6894)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-09 18:49:49 UTC (rev 6895)
@@ -140,7 +140,8 @@
self.colors = _process_plot_var_args.defaultColors[:]
# if the default line color is a color format string, move it up
# in the que
- try: ind = self.colors.index(rcParams['lines.color'])
+ try:
+ ind = self.colors.index(rcParams['lines.color'])
except ValueError:
self.firstColor = rcParams['lines.color']
else:
@@ -7415,7 +7416,7 @@
return the tight bounding box of the axes.
The dimension of the Bbox in canvas coordinate.
"""
-
+
artists = []
bb = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jr...@us...> - 2009-02-09 23:05:27
|
Revision: 6898
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6898&view=rev
Author: jrevans
Date: 2009-02-09 23:05:22 +0000 (Mon, 09 Feb 2009)
Log Message:
-----------
Fixed the bar plot code to use the proper unit conversion interface code.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-09 20:06:49 UTC (rev 6897)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-09 23:05:22 UTC (rev 6898)
@@ -4094,18 +4094,12 @@
# lets do some conversions now since some types cannot be
# subtracted uniformly
if self.xaxis is not None:
- xconv = self.xaxis.converter
- if xconv is not None:
- units = self.xaxis.get_units()
- left = xconv.convert( left, units )
- width = xconv.convert( width, units )
+ left = self.convert_xunits( left )
+ width = self.convert_xunits( width )
if self.yaxis is not None:
- yconv = self.yaxis.converter
- if yconv is not None :
- units = self.yaxis.get_units()
- bottom = yconv.convert( bottom, units )
- height = yconv.convert( height, units )
+ bottom = self.convert_yunits( bottom )
+ height = self.convert_yunits( height )
if align == 'edge':
pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-02-10 04:47:38
|
Revision: 6900
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6900&view=rev
Author: astraw
Date: 2009-02-10 04:47:29 +0000 (Tue, 10 Feb 2009)
Log Message:
-----------
doc bug: update axvline docstring
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-10 04:43:23 UTC (rev 6899)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-10 04:47:29 UTC (rev 6900)
@@ -2880,8 +2880,8 @@
Draw a vertical line at *x* from *ymin* to *ymax*. With the
default values of *ymin* = 0 and *ymax* = 1, this line will
always span the vertical extent of the axes, regardless of the
- xlim settings, even if you change them, eg. with the
- :meth:`set_xlim` command. That is, the vertical extent is in
+ ylim settings, even if you change them, eg. with the
+ :meth:`set_ylim` command. That is, the vertical extent is in
axes coords: 0=bottom, 0.5=middle, 1.0=top but the *x* location
is in data coordinates.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-02-10 04:47:46
|
Revision: 6901
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6901&view=rev
Author: astraw
Date: 2009-02-10 04:47:43 +0000 (Tue, 10 Feb 2009)
Log Message:
-----------
axes.py: eliminate redundant attribute lookup
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-10 04:47:29 UTC (rev 6900)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-10 04:47:43 UTC (rev 6901)
@@ -613,9 +613,9 @@
self.transData = self.transScale + (self.transLimits + self.transAxes)
self._xaxis_transform = mtransforms.blended_transform_factory(
- self.axes.transData, self.axes.transAxes)
+ self.transData, self.transAxes)
self._yaxis_transform = mtransforms.blended_transform_factory(
- self.axes.transAxes, self.axes.transData)
+ self.transAxes, self.transData)
def get_xaxis_transform(self):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-02-10 04:48:05
|
Revision: 6902
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6902&view=rev
Author: astraw
Date: 2009-02-10 04:47:57 +0000 (Tue, 10 Feb 2009)
Log Message:
-----------
axes.py: add comment describing separation of XY plots and polar plots
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-10 04:47:43 UTC (rev 6901)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-10 04:47:57 UTC (rev 6902)
@@ -594,11 +594,20 @@
:class:`~matplotlib.transforms.Bbox` attributes and the
*transScale*, *transData*, *transLimits* and *transAxes*
transformations.
+
+ .. note::
+ This method is primarily used by rectilinear projections
+ of the :class:`~matplotlib.axes.Axes` class, and is meant
+ to be overridden by new kinds of projection axes that need
+ different transformations and limits. (See
+ :class:`~matplotlib.projections.polar.PolarAxes` for an
+ example.
"""
self.transAxes = mtransforms.BboxTransformTo(self.bbox)
- # Transforms the x and y axis separately by a scale factor
+ # Transforms the x and y axis separately by a scale factor.
# It is assumed that this part will have non-linear components
+ # (e.g. for a log scale).
self.transScale = mtransforms.TransformWrapper(
mtransforms.IdentityTransform())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-02-28 20:13:48
|
Revision: 6945
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6945&view=rev
Author: efiring
Date: 2009-02-28 20:13:38 +0000 (Sat, 28 Feb 2009)
Log Message:
-----------
Better solution for twinx, twiny, thanks to Jae-Joon Lee
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-28 18:51:37 UTC (rev 6944)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-28 20:13:38 UTC (rev 6945)
@@ -532,11 +532,6 @@
self._frameon = frameon
self._axisbelow = rcParams['axes.axisbelow']
- # Attributes for controlling whether axis objects are drawn.
- # They are helpers for twinx and twiny.
- self._xaxison = True
- self._yaxison = True
-
self._hold = rcParams['axes.hold']
self._connected = {} # a dict from events to (id, func)
self.cla()
@@ -1652,10 +1647,7 @@
else:
self.xaxis.set_zorder(2.5)
self.yaxis.set_zorder(2.5)
- if self._xaxison:
- artists.append(self.xaxis)
- if self._yaxison:
- artists.append(self.yaxis)
+ artists.extend([self.xaxis, self.yaxis])
if not inframe: artists.append(self.title)
artists.extend(self.tables)
if self.legend_ is not None:
@@ -6610,7 +6602,7 @@
ax2.yaxis.tick_right()
ax2.yaxis.set_label_position('right')
self.yaxis.tick_left()
- ax2._xaxison = False
+ ax2.xaxis.set_visible(False)
return ax2
def twiny(self):
@@ -6630,7 +6622,7 @@
ax2.xaxis.tick_top()
ax2.xaxis.set_label_position('top')
self.xaxis.tick_bottom()
- ax2._yaxison = False
+ ax2.yaxis.set_visible(False)
return ax2
def get_shared_x_axes(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-04-27 23:30:23
|
Revision: 7067
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7067&view=rev
Author: astraw
Date: 2009-04-27 23:30:20 +0000 (Mon, 27 Apr 2009)
Log Message:
-----------
Don't raise error in boxplot() when a location has no observations.
Fixes "IndexError: index out of range for array".
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-04-26 10:29:30 UTC (rev 7066)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-04-27 23:30:20 UTC (rev 7067)
@@ -4856,6 +4856,9 @@
for i,pos in enumerate(positions):
d = np.ravel(x[i])
row = len(d)
+ if row==0:
+ # no data, skip this position
+ continue
# get median and quartiles
q1, med, q3 = mlab.prctile(d,[25,50,75])
# get high extreme
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-12 19:35:36
|
Revision: 7099
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7099&view=rev
Author: leejjoon
Date: 2009-05-12 19:35:25 +0000 (Tue, 12 May 2009)
Log Message:
-----------
fixed a few bugs introduced in r7098(aspect for log-log plot).
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-12 04:12:07 UTC (rev 7098)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-12 19:35:25 UTC (rev 7099)
@@ -524,6 +524,8 @@
self.set_label(label)
self.set_figure(fig)
+ self.set_axes_locator(kwargs.get("axes_locator", None))
+
# this call may differ for non-sep axes, eg polar
self._init_axis()
@@ -548,7 +550,6 @@
self.set_navigate(True)
self.set_navigate_mode(None)
- self._axes_locator = None
if xscale:
self.set_xscale(xscale)
@@ -1085,7 +1086,7 @@
raise ValueError('argument must be among %s' %
', '.join(mtransforms.BBox.coefs.keys()))
- def get_data_ratio(self, mode="linear"):
+ def get_data_ratio(self):
"""
Returns the aspect ratio of the raw data.
@@ -1095,16 +1096,26 @@
xmin,xmax = self.get_xbound()
ymin,ymax = self.get_ybound()
- if mode == "log":
- xsize = max(math.fabs(math.log10(xmax)-math.log10(xmin)), 1e-30)
- ysize = max(math.fabs(math.log10(ymax)-math.log10(ymin)), 1e-30)
- else:
- xsize = max(math.fabs(xmax-xmin), 1e-30)
- ysize = max(math.fabs(ymax-ymin), 1e-30)
+ xsize = max(math.fabs(xmax-xmin), 1e-30)
+ ysize = max(math.fabs(ymax-ymin), 1e-30)
return ysize/xsize
+ def get_data_ratio_log(self):
+ """
+ Returns the aspect ratio of the raw data in log scale.
+ Will be used when both axis scales are in log.
+ """
+ xmin,xmax = self.get_xbound()
+ ymin,ymax = self.get_ybound()
+
+ xsize = max(math.fabs(math.log10(xmax)-math.log10(xmin)), 1e-30)
+ ysize = max(math.fabs(math.log10(ymax)-math.log10(ymin)), 1e-30)
+
+ return ysize/xsize
+
+
def apply_aspect(self, position=None):
'''
Use :meth:`_aspect` and :meth:`_adjustable` to modify the
@@ -1121,11 +1132,14 @@
aspect_scale_mode = "linear"
elif xscale == "log" and yscale == "log":
aspect_scale_mode = "log"
- else:
+ elif (xscale == "linear" and yscale == "log") or \
+ (xscale == "log" and yscale == "linear"):
warnings.warn(
'aspect is not supported for Axes with xscale=%s, yscale=%s' \
% (xscale, yscale))
aspect = "auto"
+ else: # some custom projections have their own scales.
+ pass
if aspect == 'auto':
self.set_position( position , which='active')
@@ -1147,7 +1161,10 @@
figW,figH = self.get_figure().get_size_inches()
fig_aspect = figH/figW
if self._adjustable == 'box':
- box_aspect = A * self.get_data_ratio(mode=aspect_scale_mode)
+ if aspect_scale_mode == "log":
+ box_aspect = A * self.get_data_ratio_log()
+ else:
+ box_aspect = A * self.get_data_ratio()
pb = position.frozen()
pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
self.set_position(pb1.anchored(self.get_anchor(), pb), 'active')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-16 12:47:40
|
Revision: 7105
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7105&view=rev
Author: jdh2358
Date: 2009-05-16 12:47:27 +0000 (Sat, 16 May 2009)
Log Message:
-----------
fixed plot_date docstring
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-16 02:22:57 UTC (rev 7104)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-16 12:47:27 UTC (rev 7105)
@@ -3512,13 +3512,13 @@
may be necessary to set the formatters/locators after the call
to :meth:`plot_date` since :meth:`plot_date` will set the
default tick locator to
- :class:`matplotlib.ticker.AutoDateLocator` (if the tick
+ :class:`matplotlib.dates.AutoDateLocator` (if the tick
locator is not already set to a
- :class:`matplotlib.ticker.DateLocator` instance) and the
+ :class:`matplotlib.dates.DateLocator` instance) and the
default tick formatter to
- :class:`matplotlib.ticker.AutoDateFormatter` (if the tick
+ :class:`matplotlib.dates.AutoDateFormatter` (if the tick
formatter is not already set to a
- :class:`matplotlib.ticker.DateFormatter` instance).
+ :class:`matplotlib.dates.DateFormatter` instance).
Valid kwargs are :class:`~matplotlib.lines.Line2D` properties:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|