From: <jd...@us...> - 2008-10-22 18:45:31
|
Revision: 6297 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6297&view=rev Author: jdh2358 Date: 2008-10-22 18:45:10 +0000 (Wed, 22 Oct 2008) Log Message: ----------- added ticker api docs Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/api/index.rst trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/ticker.py Added Paths: ----------- trunk/matplotlib/doc/api/ticker_api.rst trunk/matplotlib/doc/utils/ trunk/matplotlib/doc/utils/pylab_names.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2008-10-22 17:51:36 UTC (rev 6296) +++ trunk/matplotlib/API_CHANGES 2008-10-22 18:45:10 UTC (rev 6297) @@ -1,8 +1,8 @@ Changes for 0.98.x ================== -* Restored 0.91 behavior of get_xlim/ylim returning a tuple - rather than array - JDH +* 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, Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-10-22 17:51:36 UTC (rev 6296) +++ trunk/matplotlib/CHANGELOG 2008-10-22 18:45:10 UTC (rev 6297) @@ -1,5 +1,5 @@ -2008-10-21 Restored 0.91 behavior of get_xlim/ylim returning a tuple - rather than array - JDH +2008-10-21 set_xlim, ylim now return a copy of the viewlim array to + avoid modify inplace surprises 2008-10-20 Added image thumbnail generating function matplotlib.image.thumbnail. See Modified: trunk/matplotlib/doc/api/index.rst =================================================================== --- trunk/matplotlib/doc/api/index.rst 2008-10-22 17:51:36 UTC (rev 6296) +++ trunk/matplotlib/doc/api/index.rst 2008-10-22 18:45:10 UTC (rev 6297) @@ -26,4 +26,5 @@ mlab_api.rst path_api.rst pyplot_api.rst + ticker_api.rst index_backend_api.rst Added: trunk/matplotlib/doc/api/ticker_api.rst =================================================================== --- trunk/matplotlib/doc/api/ticker_api.rst (rev 0) +++ trunk/matplotlib/doc/api/ticker_api.rst 2008-10-22 18:45:10 UTC (rev 6297) @@ -0,0 +1,12 @@ +******************* +matplotlib ticker +******************* + + +:mod:`matplotlib.ticker` +========================== + +.. automodule:: matplotlib.ticker + :members: + :undoc-members: + :show-inheritance: Added: trunk/matplotlib/doc/utils/pylab_names.py =================================================================== --- trunk/matplotlib/doc/utils/pylab_names.py (rev 0) +++ trunk/matplotlib/doc/utils/pylab_names.py 2008-10-22 18:45:10 UTC (rev 6297) @@ -0,0 +1,60 @@ +""" +autogenerate some tables for pylab namespace +""" +from pylab import * +d = locals() +keys = d.keys() +keys.sort() + +modd = dict() +for k in keys: + o = d[k] + if not callable(o): + continue + doc = getattr(o, '__doc__', None) + if doc is not None: + doc = ' - '.join([line for line in doc.split('\n') if line.strip()][:2]) + + mod = getattr(o, '__module__', None) + if mod is None: + mod = 'unknown' + + if mod is not None: + if mod.startswith('matplotlib'): + if k[0].isupper(): + k = ':class:`~%s.%s`'%(mod, k) + else: + k = ':func:`~%s.%s`'%(mod, k) + mod = ':mod:`%s`'%mod + elif mod.startswith('numpy'): + #k = '`%s <%s>`_'%(k, 'http://scipy.org/Numpy_Example_List_With_Doc#%s'%k) + k = '`%s <%s>`_'%(k, 'http://sd-2116.dedibox.fr/pydocweb/doc/%s.%s'%(mod, k)) + + + if doc is None: doc = 'TODO' + + mod, k, doc = mod.strip(), k.strip(), doc.strip()[:80] + modd.setdefault(mod, []).append((k, doc)) + +mods = modd.keys() +mods.sort() +for mod in mods: + border = '*'*len(mod) + print mod + print border + + print + funcs, docs = zip(*modd[mod]) + maxfunc = max([len(f) for f in funcs]) + maxdoc = max(40, max([len(d) for d in docs]) ) + border = ' '.join(['='*maxfunc, '='*maxdoc]) + print border + print ' '.join(['symbol'.ljust(maxfunc), 'description'.ljust(maxdoc)]) + print border + for func, doc in modd[mod]: + row = ' '.join([func.ljust(maxfunc), doc.ljust(maxfunc)]) + print row + + print border + print + #break Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-10-22 17:51:36 UTC (rev 6296) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-10-22 18:45:10 UTC (rev 6297) @@ -1769,9 +1769,10 @@ def get_xlim(self): """ - Get the x-axis range [*xmin*, *xmax*] + Get the x-axis range as a length 2 attay [*xmin*, *xmax*] """ - return tuple(self.viewLim.intervalx) + # # copy of the viewlim array to avoid modify inplace surprises + return self.viewLim.intervalx.copy() def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs): """ @@ -1781,7 +1782,7 @@ Set the limits for the xaxis - Returns the current xlimits as a length 2 tuple: [*xmin*, *xmax*] + Returns the current xlimits as a length 2 tuple: (*xmin*, *xmax*) Examples:: @@ -1942,9 +1943,10 @@ def get_ylim(self): """ - Get the y-axis range [*ymin*, *ymax*] + Get the y-axis range as a length two array [*ymin*, *ymax*] """ - return tuple(self.viewLim.intervaly) + # copy of the viewlim array to avoid modify inplace surprises + return self.viewLim.intervaly.copy() def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs): """ Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2008-10-22 17:51:36 UTC (rev 6296) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-10-22 18:45:10 UTC (rev 6297) @@ -21,28 +21,35 @@ The Locator subclasses defined here are - * NullLocator - No ticks +:class:`NullLocator` + No ticks - * FixedLocator - Tick locations are fixed +:class:`FixedLocator` + Tick locations are fixed - * IndexLocator - locator for index plots (eg. where x = range(len(y))) +:class:`IndexLocator` + locator for index plots (eg. where x = range(len(y))) - * LinearLocator - evenly spaced ticks from min to max +:class:`LinearLocator` + evenly spaced ticks from min to max - * LogLocator - logarithmically ticks from min to max +:class:`LogLocator` + logarithmically ticks from min to max - * MultipleLocator - ticks and range are a multiple of base; - either integer or float +:class:`MultipleLocator` + ticks and range are a multiple of base; + either integer or float +:class:`OldAutoLocator` + choose a MultipleLocator and dyamically reassign it for + intelligent ticking during navigation - * OldAutoLocator - choose a MultipleLocator and dyamically reassign - it for intelligent ticking during navigation +:class:`MaxNLocator` + finds up to a max number of ticks at nice locations - * MaxNLocator - finds up to a max number of ticks at nice - locations +:class:`AutoLocator` + :class:`MaxNLocator` with simple defaults. This is the default + tick locator for most plotting. - * AutoLocator - MaxNLocator with simple defaults. This is the - default tick locator for most plotting. - There are a number of locators specialized for date locations - see the dates module @@ -70,21 +77,27 @@ formatter operates on a single tick value and returns a string to the axis. - * NullFormatter - no labels on the ticks +:clss:`NullFormatter` + no labels on the ticks - * FixedFormatter - set the strings manually for the labels +:clss:`FixedFormatter` + set the strings manually for the labels - * FuncFormatter - user defined function sets the labels +:clss:`FuncFormatter` + user defined function sets the labels - * FormatStrFormatter - use a sprintf format string +:clss:`FormatStrFormatter` + use a sprintf format string - * ScalarFormatter - default formatter for scalars; autopick the fmt string +:clss:`ScalarFormatter` + default formatter for scalars; autopick the fmt string - * LogFormatter - formatter for log axes +:clss:`LogFormatter` + formatter for log axes You can derive your own formatter from the Formatter base class by -simply overriding the __call__ method. The formatter class has access +simply overriding the ``__call__`` method. The formatter class has access to the axis view and data limits. To control the major and minor tick label formats, use one of the @@ -95,7 +108,7 @@ ax.yaxis.set_major_formatter( ymajorFormatter ) ax.yaxis.set_minor_formatter( yminorFormatter ) -See :file:`examples/major_minor_demo1.py` for an example of setting +See :ref:`pylab_examples-major_minor_demo1` for an example of setting major an minor ticks. See the :module:`matplotlib.dates` module for more information and examples of using date locators and formatters. """ @@ -176,38 +189,38 @@ def fix_minus(self, s): """ some classes may want to replace a hyphen for minus with the - proper unicode symbol as described here - - http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720. + proper unicode symbol as described `here + <http://sourceforge.net/tracker/index.php?func=detail&aid=1962574&group_id=80706&atid=560720>`_. The default is to do nothing - Note, if you use this method, eg in format_data or call, you - probably don't want to use it for format_data_short since the - toolbar uses this for interative coord reporting and I doubt - we can expect GUIs across platforms will handle the unicode - correctly. So for now the classes that override fix_minus - should have an explicit format_data_short method + Note, if you use this method, eg in :meth`format_data` or + call, you probably don't want to use it for + :meth:`format_data_short` since the toolbar uses this for + interative coord reporting and I doubt we can expect GUIs + across platforms will handle the unicode correctly. So for + now the classes that override :meth:`fix_minus` should have an + explicit :meth:`format_data_short` method """ return s class NullFormatter(Formatter): 'Always return the empty string' def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' return '' class FixedFormatter(Formatter): 'Return fixed strings for tick labels' def __init__(self, seq): """ - seq is a sequence of strings. For positions i<len(seq) return - seq[i] regardless of x. Otherwise return '' + seq is a sequence of strings. For positions ``i<len(seq)` return + *seq[i]* regardless of *x*. Otherwise return '' """ self.seq = seq self.offset_string = '' def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' if pos is None or pos>=len(self.seq): return '' else: return self.seq[pos] @@ -225,7 +238,7 @@ self.func = func def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' return self.func(x, pos) @@ -237,7 +250,7 @@ self.fmt = fmt def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' return self.fmt % x class OldScalarFormatter(Formatter): @@ -246,7 +259,7 @@ """ def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' xmin, xmax = self.axis.get_view_interval() d = abs(xmax - xmin) @@ -304,7 +317,7 @@ else: return s.replace('-', u'\u2212') def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' if len(self.locs)==0: return '' else: @@ -313,7 +326,7 @@ def set_scientific(self, b): '''True or False to turn scientific notation on or off - see also set_powerlimits() + see also :meth:`set_powerlimits` ''' self._scientific = bool(b) @@ -321,7 +334,7 @@ ''' Sets size thresholds for scientific notation. - e.g. xaxis.set_powerlimits((-3, 4)) sets the pre-2007 default in + e.g. ``xaxis.set_powerlimits((-3, 4))`` sets the pre-2007 default in which scientific notation is used for numbers less than 1e-3 or greater than 1e4. See also :meth:`set_scientific`. @@ -463,20 +476,20 @@ """ Format values for log axis; - if attribute decadeOnly is True, only the decades will be labelled. + if attribute *decadeOnly* is True, only the decades will be labelled. """ def __init__(self, base=10.0, labelOnlyBase = True): """ - base is used to locate the decade tick, - which will be the only one to be labeled if labelOnlyBase - is False + *base* is used to locate the decade tick, + which will be the only one to be labeled if *labelOnlyBase* + is ``False`` """ self._base = base+0.0 self.labelOnlyBase=labelOnlyBase self.decadeOnly = True def base(self,base): - 'change the base for labeling - warning: should always match the base used for LogLocator' + 'change the *base* for labeling - warning: should always match the base used for :class:`LogLocator`' self._base=base def label_minor(self,labelOnlyBase): @@ -485,7 +498,7 @@ def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' vmin, vmax = self.axis.get_view_interval() d = abs(vmax - vmin) b=self._base @@ -548,11 +561,11 @@ class LogFormatterExponent(LogFormatter): """ - Format values for log axis; using exponent = log_base(value) + Format values for log axis; using ``exponent = log_base(value)`` """ def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' vmin, vmax = self.axis.get_view_interval() @@ -580,11 +593,11 @@ class LogFormatterMathtext(LogFormatter): """ - Format values for log axis; using exponent = log_base(value) + Format values for log axis; using ``exponent = log_base(value)`` """ def __call__(self, x, pos=None): - 'Return the format for tick val x at position pos' + 'Return the format for tick val *x* at position *pos*' b = self._base # only label the decades if x == 0: @@ -619,7 +632,7 @@ """ Determine the tick locations; - Note, you should not use the same locator between different Axis + Note, you should not use the same locator between different :class:`~matplotlib.axis.Axis` because the locator stores references to the Axis data and view limits """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |