)Uc@ sdZddlmZddlZddlZddlZddlmZddlm Z ddlm Z ddEdYZ d e fd YZ d e fd YZd e fdYZde fdYZde fdYZde fdYZde fdYZde fdYZde fdYZdefdYZdefdYZde fd YZd!e fd"YZd#efd$YZd%efd&YZd'efd(YZd)efd*YZd+Zd,dFd-YZd.efd/YZ d0d1d2Z!d3efd4YZ"d5d6Z#d5d7Z$d8Z%d5d9Z&d:Z'd;efd<YZ(d=efd>YZ)d?e"fd@YZ*dAefdBYZ+dCefdDYZ,dGZ-dS(Hs Tick locating and formatting ============================ This module contains classes to support completely configurable tick locating and formatting. Although the locators know nothing about major or minor ticks, they are used by the Axis class to support major and minor tick locating and formatting. Generic tick locators and formatters are provided, as well as domain specific custom ones.. Tick locating ------------- The Locator class is the base class for all tick locators. The locators handle autoscaling of the view limits based on the data limits, and the choosing of tick locations. A useful semi-automatic tick locator is MultipleLocator. You initialize this with a base, eg 10, and it picks axis limits and ticks that are multiples of your base. The Locator subclasses defined here are :class:`NullLocator` No ticks :class:`FixedLocator` Tick locations are fixed :class:`IndexLocator` locator for index plots (eg. where x = range(len(y))) :class:`LinearLocator` evenly spaced ticks from min to max :class:`LogLocator` logarithmically ticks from min to max :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 :class:`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. There are a number of locators specialized for date locations - see the dates module You can define your own locator by deriving from Locator. You must override the __call__ method, which returns a sequence of locations, and you will probably want to override the autoscale method to set the view limits from the data limits. If you want to override the default locator, use one of the above or a custom locator and pass it to the x or y axis instance. The relevant methods are:: ax.xaxis.set_major_locator( xmajorLocator ) ax.xaxis.set_minor_locator( xminorLocator ) ax.yaxis.set_major_locator( ymajorLocator ) ax.yaxis.set_minor_locator( yminorLocator ) The default minor locator is the NullLocator, eg no minor ticks on by default. Tick formatting --------------- Tick formatting is controlled by classes derived from Formatter. The formatter operates on a single tick value and returns a string to the axis. :class:`NullFormatter` no labels on the ticks :class:`IndexFormatter` set the strings from a list of labels :class:`FixedFormatter` set the strings manually for the labels :class:`FuncFormatter` user defined function sets the labels :class:`FormatStrFormatter` use a sprintf format string :class:`ScalarFormatter` default formatter for scalars; autopick the fmt string :class:`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 to the axis view and data limits. To control the major and minor tick label formats, use one of the following methods:: ax.xaxis.set_major_formatter( xmajorFormatter ) ax.xaxis.set_minor_formatter( xminorFormatter ) ax.yaxis.set_major_formatter( ymajorFormatter ) ax.yaxis.set_minor_formatter( yminorFormatter ) See :ref:`pylab_examples-major_minor_demo1` for an example of setting major an minor ticks. See the :mod:`matplotlib.dates` module for more information and examples of using date locators and formatters. i(tdivisionN(trcParams(tcbook(t transformst TickHelpercB sNeZdZdddYZdZdZdZdZdZ RS( t DummyAxiscB s5eZdZdZdZdZdZRS(cC s(tjj|_tjj|_dS(N(t mtransformstBboxtunittdataLimtviewLim(tself((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt__init__scC s |jjS(N(R t intervalx(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytget_view_intervalscC s||f|j_dS(N(R R (R tvmintvmax((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_view_intervalscC s |jjS(N(R R (R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytget_data_intervalscC s||f|j_dS(N(R R (R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_data_intervals(t__name__t __module__R RRRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs     cC s ||_dS(N(taxis(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_axisscC s%|jdkr!|j|_ndS(N(RtNoneR(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytcreate_dummy_axisscC s|jj||dS(N(RR(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC s|jj||dS(N(RR(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC s$|j|||j||dS(N(RR(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt set_boundssN(( RRRRRRRRRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs    t FormattercB sMeZdZgZddZdZdZdZdZ dZ RS(s/ Convert the tick location to a string cC stddS(sPReturn the format for tick val x at position pos; pos=None indicated unspecifiedsDerived must overideN(tNotImplementedError(R txtpos((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt__call__scC s |j|S(N(R(R tvalue((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt format_datascC s |j|S(sreturn a short string version(R!(R R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytformat_data_shortscC sdS(Nt((R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt get_offsetscC s ||_dS(N(tlocs(R R%((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_locsscC s|S(s some classes may want to replace a hyphen for minus with the proper unicode symbol as described `here `_. The default is to do nothing 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 ((R ts((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt fix_minussN( RRt__doc__R%RRR!R"R$R&R((((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs     tIndexFormattercB s#eZdZdZddZRS(sL format the position x to the nearest i-th label where i=int(x+0.5) cC s||_t||_dS(N(tlabelstlentn(R R+((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s cC sBt|d}|dkr dS||jkr3dS|j|SdS(sPReturn the format for tick val x at position pos; pos=None indicated unspecifiedg?iR#N(tintR-R+(R RRti((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs  N(RRR)R RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR*s t NullFormattercB seZdZddZRS(sAlways return the empty stringcC sdS(s4Return the format for tick val *x* at position *pos*R#((R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsN(RRR)RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR0stFixedFormattercB s5eZdZdZddZdZdZRS(s$Return fixed strings for tick labelscC s||_d|_dS(s *seq* is a sequence of strings. For positions ``i < len(seq)`` return *seq[i]* regardless of *x*. Otherwise return '' R#N(tseqt offset_string(R R2((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s cC s4|dks!|t|jkr%dS|j|SdS(s4Return the format for tick val *x* at position *pos*R#N(RR,R2(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs!cC s|jS(N(R3(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR$scC s ||_dS(N(R3(R tofs((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_offset_stringsN(RRR)R RRR$R5(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR1s    t FuncFormattercB s#eZdZdZddZRS(s. User defined function for formatting cC s ||_dS(N(tfunc(R R7((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR scC s|j||S(s4Return the format for tick val *x* at position *pos*(R7(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsN(RRR)R RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR6s tFormatStrFormattercB s#eZdZdZddZRS(s0 Use a format string to format the tick cC s ||_dS(N(tfmt(R R9((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR scC s |j|S(s4Return the format for tick val *x* at position *pos*(R9(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsN(RRR)R RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR8 s tOldScalarFormattercB s#eZdZddZdZRS(s. Tick location is a plain old number. cC s5|jj\}}t||}|j||S(s4Return the format for tick val *x* at position *pos*(RRtabst pprint_val(R RRtxmintxmaxtd((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsc C sEt|dkr,|t|kr,d|S|dkrAd}nZ|dkrVd}nE|dkrkd}n0|d krd }n|d krd }nd}||}|jd }t|dkr)|djdjd}|d djdd}|d d jd}d|||f}n|jdjd}|S(Ng@s%dg{Gz?s%1.3eg?s%1.3fgj@s%1.1ei s%1.1fis%1.2fteiit0t.t+R#s%se%s%s(R;R.tsplitR,trstriptreplacetlstrip( R RR?R9R'ttuptmantissatsigntexponent((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR<$s,$      N(RRR)RRR<(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR:s tScalarFormattercB seZdZeedZdZdZededeZ dZ ddZ dZ d Zd Zd Zd Zd ZdZdZdZdZdZRS(s Tick location is a plain old number. If useOffset==True and the data range is much smaller than the data average, then an offset will be determined such that the tick labels are meaningful. Scientific notation is used for data < 10^-n or data >= 10^m, where n and m are the power limits set using set_powerlimits((n,m)). The defaults for these are controlled by the axes.formatter.limits rc parameter. cC sO|j|td|_||_d|_d|_t|_td|_dS(Ns text.usetexiR#saxes.formatter.limits( t set_useOffsetRt_usetext _useMathTexttorderOfMagnitudetformattTruet _scientifict _powerlimits(R t useOffsett useMathText((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR Gs      cC s|jS(N(t _useOffset(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt get_useOffsetSscC s=|ttgkr'd|_||_nt|_||_dS(Ni(RRtFalsetoffsetRW(R tval((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRMVs    tfgettfsetcC s-tdstd r|S|jddSdS(s&use a unicode minus rather than hyphens text.usetexsaxes.unicode_minust-u−N(RRF(R R'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR(`scC s9t|jdkrdS|j|}|j|SdS(s4Return the format for tick val *x* at position *pos*iR#N(R,R%R<R((R RRR'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRescC st||_dS(seTrue or False to turn scientific notation on or off see also :meth:`set_powerlimits` N(tboolRS(R tb((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_scientificmscC s+t|dkstd||_dS(s Sets size thresholds for scientific notation. e.g. ``formatter.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`. is'argument must be a sequence of length 2N(R,tAssertionErrorRT(R tlims((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytset_powerlimitsss cC sd|S(s:return a short formatted string representation of a numbers%-12g((R R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR"scC s |jd|}|j|S(s4return a formatted string representation of a numbers%1.10e(t_formatSciNotationR((R R R'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR!scC sct|jdkrdSd}|js1|jrVd}d}|jrw|j|j}|jdkrwd|}qwn|jr|js|jr|jd|j}qd|j}n|jr|dkrd|}ndjd|d|d f}qV|jr>|dkr d |}ndjd||df}qVdj||f}n|j|S( s'Return scientific notation, plus offsetiR#RCi s1e%ds\times\mathdefault{%s}t$s \mathdefault{s}$s\times%s( R,R%RPRZR!RNROtjoinR((R R't offsetStrt sciNotStr((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR$s0     !   cC sz||_t|jdkrv|jj\}}t||}|jr\|j|n|j||jndS(sset the locations of the ticksiN( R%R,RRR;RWt _set_offsett_set_orderOfMagnitudet _set_format(R R%RRR?((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR&s   cC s#|j}|dks.t| s.|dkr;d|_dStj|}|rtjtjtjtj |}tjtj|}tj ||dkr|dkrtj tj |d|d||_qtjtj |d|d||_qd|_ndS(Niii ( R%RR,RZtnptmeantmathtfloortlog10tabsolutetceiltmaxtmin(R trangeR%tave_loctave_oomt range_oom((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRjs % * ..cC s|jsd|_dStj|j}|jrLtjtj|}nX|d|dkrm|d}n |d}|dkrd}ntjtj|}||j dkr||_n(||j dkr||_n d|_dS(Niii( RSRPRmRrR%RZRoRpRqRT(R RvR%toomR[((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRks"        cC stj|j|jd|jd}g|D]2}ttd|jddjd^q/}|j dt|dd |_ |j rd |j |_ n|j rd |j |_ ndS( Ni gV瞯i(RZRPRmRrRQ(R Rtxp((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR<s cC s|jd}y|djdjd}|ddjdd}|ddjd}|jsq|jr|dkrd}n|rd ||f}n|r|rd ||fSd ||fSn d |||fjd}|SWntk r}|SXdS( NR@iRARBiRCR#t1s 10^{%s%s}s %s{\times}%ss%s%ss%se%s%s(RDRERFRGRORNt IndexError(R R'RHt significandRJRKtmsg((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRes"   N(RRR)RRRYR RXRMtpropertyRUR(RRRaRdR"R!R$R&RjRkRlR<Re(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRL<s$             t LogFormattercB sVeZdZdedZdZdZd dZdZ dZ dZ RS( sp Format values for log axis; if attribute *decadeOnly* is True, only the decades will be labelled. g$@cC s#|d|_||_t|_dS(s *base* is used to locate the decade tick, which will be the only one to be labeled if *labelOnlyBase* is ``False`` gN(t_baset labelOnlyBaseRRt decadeOnly(R tbaseR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s  cC s ||_dS(scchange the *base* for labeling - warning: should always match the base used for :class:`LogLocator`N(R(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC s ||_dS(s"switch on/off minor ticks labelingN(R(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt label_minorsc C s|jj\}}t||}|j}|dkr>dStj|}tjt|tj|}t|} | r|j rd} nD|dkrd|} n+|dkrd|} n|j ||} |dkrd| } n|j | S( s4Return the format for tick val *x* at position *pos*gRAR#i's%1.0eiis-%s( RRR;RRmRJRotlogt is_decadeRR<R(( R RRRRR?R`RJtfxtisDecadeR'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs$  "      cC s7|j}t|_tj|j|}||_|S(N(RRYRt strip_mathR(R R R`((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR!/s    cC sd|S(s:return a short formatted string representation of a numbers%-12g((R R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR"6sc C sEt|dkr,|t|kr,d|S|dkrAd}nZ|dkrVd}nE|dkrkd}n0|d krd }n|d krd }nd}||}|jd }t|dkr)|djdjd}|d djdd}|d d jd}d|||f}n|jdjd}|S(Ng@s%dg{Gz?s%1.3eg?s%1.3fgj@s%1.1ei s%1.1fis%1.2fR@iiRARBRCR#s%se%s%s(R;R.RDR,RERFRG( R RR?R9R'RHRIRJRK((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR<:s,$      N( RRR)RRR RRRRR!R"R<(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs     tLogFormatterExponentcB seZdZddZRS(sJ Format values for log axis; using ``exponent = log_base(value)`` c C s|jj\}}tj||dd\}}t||}|j}|dkr\dStj|}tj t|tj |}t |} | r|j rd} nD|dkrd|} n+|dkrd|} n|j ||} |d krd | } n|j | S( s4Return the format for tick val *x* at position *pos*texpanderg?iRAR#i's%1.0eiis-%s(RRRt nonsingularR;RRmRJRoRtis_close_to_intRR<R(( R RRRRR?R`RJRRR'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRVs&  "      N(RRR)RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRQstLogFormatterMathtextcB seZdZddZRS(sJ Format values for log axis; using ``exponent = log_base(value)`` c C s|j}td}|dkr0|r)dSdSntj|}tjt|tj|}t|}|dkrd}nd}| r|jrd} ns|s|rd|||f} qd |||f} n;|rd ||t |f} nd ||t |f} | S( s4Return the format for tick val *x* at position *pos*s text.usetexis$0$s$\mathdefault{0}$iR^R#s $%s%d^{%.2f}$s$\mathdefault{%s%d^{%.2f}}$s $%s%d^{%d}$s$\mathdefault{%s%d^{%d}}$( RRRmRJRoRR;RRt nearest_long( R RRR`tusetexRJRRt sign_stringR'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRvs.   "     N(RRR)RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRqst EngFormattercB seZdZidd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6Zdd&d#Zd&d$Zd%ZRS('s Formats axis values using engineering prefixes to represent powers of 1000, plus a specified unit, eg. 10 MHz instead of 1e7. tyitzitaiR{itpiR-iuμitmiR#itkitMitGi tTi tPitEitZitYicC s||_||_dS(N(Rtplaces(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s cC s)d|j||jf}|j|S(Ns%s%s(t format_engRR((R RRR'((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsc C sKtjt|}d}|dkr7d}| }n|dkrrtjttj|jdd}ntjd}|jt|j j }|jt|j j }|j t|}||d|}|j d krd}n7|j dkrd}n|j dkr1d|j }n|||f}|j S( sY Formats a number in engineering notation, appending a letter representing the power of 1000 of the original number. Some examples: >>> format_eng(0) for self.places = 0 '0' >>> format_eng(1000000) for self.places = 1 '1.0 M' >>> format_eng("-1e-6") for self.places = 2 u'-1.00 \u03bc' @param num: the value to represent @type num: either a numeric value or a string that can be converted to a numeric value (as per decimal.Decimal constructor) @return: engineering formatted string iiiii u%g %su%i %su %%.%if %%sN(tdecimaltDecimalR}R.RoRpRqRuRtt ENG_PREFIXEStkeysRRtstrip( R tnumtdnumRJtpow10tprefixtmantt format_strt formatted((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs(   /  N(RRR)RRR RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs,  tLocatorcB sSeZdZdZdZdZdZdZdZdZ dZ RS( s Determine the tick locations; 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 icC stddS(s!Return the locations of the tickssDerived must overrideN(R(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC sCt||jkr?tdt||d|dfn|S(sJraise a RuntimeError if Locator attempts to create more than MAXTICKS locssOLocator attempting to generate %d ticks from %s to %s: exceeds Locator.MAXTICKSii(R,tMAXTICKSt RuntimeError(R R%((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytraise_if_exceedss*cC stj||S(sk select a scale for the range from vmin to vmax Normally This will be overridden. (RR(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt view_limits scC s|j|jjS(sautoscale the view limits(RRR(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt autoscalescC s|}t|}|jj\}}tj||dd\}}|dkrs|t|d|d}nt||}||d}||7}||7}|jj||dtdS( s*Pan numticks (can be positive or negative)Rg?iiig@tignoreN(R,RRRRR;RRR(R tnumstepsttickstnumticksRRtstepR?((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytpans     cC sv|jj\}}tj||dd\}}t||}d||}|jj||||dtdS(s>Zoom in/out on axis; if direction is >0 zoom in, else zoom outRg?g?RN(RRRRR;RRR(R t directionRRtintervalR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytzoom(s cC sdS(s1refresh internal information based on current limN((R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytrefresh1s( RRR)RRRRRRRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs      t IndexLocatorcB s eZdZdZdZRS(s Place a tick on every multiple of some base number of points plotted, eg on every 5th point. It is assumed that you are doing index plotting; ie the axis is 0, len(data). This is mainly useful for x ticks. cC s||_||_dS(s<place ticks on the i-th data points where (i-offset)%base==0N(RRZ(R RRZ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR =s cC s?|jj\}}|jtj||j|d|jS(s!Return the locations of the ticksi(RRRRmtarangeRZR(R tdmintdmax((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRBs(RRR)R R(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR6s t FixedLocatorcB s#eZdZddZdZRS(sn Tick locations are fixed. If nbins is not None, the array of possible positions will be subsampled to keep the number of ticks <= nbins +1. The subsampling will be done so as to include the smallest absolute value; for example, if zero is included in the array of possibilities, then it is guaranteed to be one of the chosen ticks. cC sFtj||_||_|jdk rBt|jd|_ndS(Ni(RmR|R%tnbinsRRt(R R%R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR Ts cC s|jdkr|jSttdt|jt|jd}|jdd|}x`td|D]O}|j|d|}tj |j tj |j krk|}qkqkW|j |S(s!Return the locations of the ticksgGz?iN( RRR%RtR.R,tfloatRvRmRrRuR(R RRR/tticks1((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRZs/* N(RRR)RR R(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRIs  t NullLocatorcB seZdZdZRS(s No ticks cC sgS(s!Return the locations of the ticks((R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRns(RRR)R(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRist LinearLocatorcB s8eZdZdddZdZdZdZRS(s Determine the tick locations The first time this function is called it will try to set the number of ticks to make a nice tick partitioning. Thereafter the number of ticks will be fixed so that interactive navigation will be nice cC s.||_|dkr!i|_n ||_dS(sX Use presets to set locs based on lom. A dict mapping vmin, vmax->locs N(RRtpresets(R RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR }s   cC s|jj\}}tj||dd\}}||krO||}}n||f|jkru|j||fS|jdkr|jn|jdkrgStj |||j}|j |S(s!Return the locations of the ticksRg?iN( RRRRRRRt _set_numticksRmtlinspaceR(R RRtticklocs((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs  cC s d|_dS(Ni (R(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC s||kr||}}n||kr?|d8}|d7}nttj||d\}}|dkrz|d8}nd| }tj|||}tj|||}tj||S(s+Try to choose the view limits intelligentlyig?i (tdivmodRoRqRpRsRR(R RRRKt remaindertscale((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs    "   N(RRR)RR RRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRrs   cC s"t||dkrtStSdS(Ng|=(R;RRRY(RR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytclosetostBasecB sDeZdZdZdZdZdZdZdZRS(sEthis solution has some hacks to deal with floating point inaccuraciescC s|dkst||_dS(Ni(RbR(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR scC sXt||j\}}t|drMt||jd rM|d|jS||jS(s'return the largest multiple of base < xii(RRR(R RR?R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytlts&cC sHt||j\}}t||jdr=|d|jS||jS(s(return the largest multiple of base <= xi(RRR(R RR?R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytlescC sLt||j\}}t||jdr=|d|jS|d|jS(s(return the smallest multiple of base > xii(RRR(R RR?R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytgtscC sXt||j\}}t|drIt||jd rI||jS|d|jS(s)return the smallest multiple of base >= xii(RRR(R RR?R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytges& cC s|jS(N(R(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytget_bases( RRR)R RRRRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs     tMultipleLocatorcB s,eZdZddZdZdZRS(sW Set a tick on every integer that is multiple of base in the view interval g?cC st||_dS(N(RR(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR scC s|jj\}}||kr1||}}n|jj|}|jj}||d||}|tj|d|}|j|S(s!Return the locations of the ticksgMbP?i(RRRRRRmRR(R RRRR-R%((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs cC sW|jj|}|jj|}||krG|d8}|d7}ntj||S(sd Set the view limits to the nearest multiples of base that contain the data i(RRRRR(R RRRR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs    (RRR)R RR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs  iidc C s t||}tt|t|}|dksG||dkrKdSd||}t|||krxd}n]|dkrttj|dd}d|}n(ttj| dd}d| }ttj||dd}d|} | |fS( Nig-q=g?gg?ii (g?g(R;RtRRoRq( RRR-t thresholdtdvtmaxabsvtmeanvRZtexR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt scale_ranges      t MaxNLocatorc B sheZdZedddd dedededd ZdZd Z d Z d Z d Z RS(s< Select no more than N intervals at nice locations. Ri tstepsttrimtintegert symmetrictprunecO sY|r8|d|d|d|_nd|krZ|d|_nd|krv|d|_nd|kr|d}|dk r|dkrtd n||_nd |krI|d }|dkr d d d dddddddg |_qIt|ddkr=t |}|j dn||_nd|kre|d|_n|jrg|jD]%}t |d d dkrx|^qx|_ndS(NRRRRRtuppertlowertboths/prune must be 'upper', 'lower', 'both', or NoneRig?ig@iiiiii igMbP?(supperslowerR( R.t_nbinst_trimt_integert _symmetricRRt_prunet_stepstlisttappendR(R RRRR-((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRGs4           *    c C s)|j}t|||\}}|jr<td|}n||8}||8}|||}||}|}|} xb|jD]W} | |krq~n| |9} | t|| d} | | |}||kr~Pq~q~W|jr tt||| d} || 8}ntj |d| | |S(Nii( RRRRtRRRR.RmR( R RRRRRZtraw_steptscaled_raw_stept best_vmaxt best_vminRt extra_bins((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytbin_boundariesds,          cC s|jj\}}tj||dd\}}|j||}|j}|dkrg|d}n5|dkr|d }n|dkr|dd!}n|j|S(NRg?RiRiR(RRRRRRR(R RRR%R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR~s      cC st|jr4tt|t|}| }|}ntj||dd\}}tj|j||ddgS(NRg?ii(RRtR;RRRmttakeR(R RRtmaxabs((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs   N( RRR)tdictRRRRYRR RRRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs   (   i cC s>|dkr| Stjtj|tj|}||S(s#floor x to the nearest lower decadeg(RoRpR(RRtlx((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt decade_downs %cC s=|dkr|Stjtj|tj|}||S(s#ceil x to the nearest higher decadeg(RoRsR(RRR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyt decade_ups %cC s<|dkrdS|dkr*t|dSt|dSdS(Nilg?(tlong(R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs   cC sOtj|stS|dkr#tStjt|tj|}t|S(Ng(RmtisfiniteRYRRRoRR;R(RRR((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs  "cC s-tj|stSt|t|dkS(Ng|=(RmRRYR;R(R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRst LogLocatorcB sPeZdZddgddZdZdZdZdZd ZRS( s3 Determine the tick locations for log axes g$@g?icC s0|j||j|d|_||_dS(s> place ticks on the location= base**i*subs[j] iN(RtsubsRtnumdecs(R RR R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s   cC s|d|_dS(sW set the base of the log scaling (major tick every base**i, i integer) gN(R(R R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC s2|dkrd|_ntj|d|_dS(sK set the minor ticks the log scaling every base**i*subs[j] gN(Rt_subsRmR|(R R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s  cC s d|_dS(Ni(R(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsc C s|j}|jj\}}t|jdr|jjjdkrtjtj|tj|}t j ||j |}||}|S|dkr|jj }|dkst j | rtdqntj|tj|}tj|tj|}||kr.||}}ntj|tj|}|jd kr|dkrzt jdg}q|dkrt j d|d}qt j d|}n |j}d }x%||d |jkr|d 7}qWt j tj|tj|||}t|d ksIt|d krx|d dkrxg}x0||D]} |j|| qZWn ||}|jt j|S( s!Return the locations of the tickstaxestpolargsAData has no positive values, and therefore can not be log-scaled.i g?ig@iiN(RRRthasattrR tnameRoRsRRmRR t get_minposRRRpR RtarrayRR,textendR( R R`RRtdecadesRtnumdecR tstridet decadeStart((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsF '%      4 cC s`|j}||kr%||}}n|jjjdkrztjtj|tj|}|||j}||fS|jj}|dkst j | rt dn||kr|}nt ||jst ||j}nt ||jst||j}n||krJt ||j}t||j}ntj||}|S(s+Try to choose the view limits intelligentlyRisAData has no positive values, and therefore can not be log-scaled.(RRR RRoRsRR RRmRRRRRRR(R RRR`tminpostresult((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs,  %     ( RRR)R RR RRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR s   2tSymmetricalLogLocatorcB s8eZdZdgdZdZdZdZRS(s3 Determine the tick locations for log axes g?cC s||_||_d|_dS(s> place ticks on the location= base**i*subs[j] iN(t _transformR R(R t transformR ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR *s  cC s d|_dS(Ni(R(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR2sc C s|jj}|jj\}}|jj||f\}}||kr[||}}ntj|tj|}|jdkr|dkrt j dg}q|dkrt j d|d}qt j d|}nt j |j}d}x%||d|jkr|d7}qWt j tj|tj|||}t|dksm|ddkrg}x\|D]1} |j|t j| |t j| qzWn t j||t j|}|jt j |S(s!Return the locations of the ticksi g?ig@iiN(RRRRRRoRpRsR RRmRRR|RR,RRJR;R( R R`RRRR RRRtdecade((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR5s.    +" 2 cC s*|jj}||kr(||}}ntt||so|dkr]t| | }qot||}ntt||s|dkrt| | }qt||}n||kr|dkrt| | }t| | }qt||}t||}ntj||}|S(s+Try to choose the view limits intelligentlyi(RRRR;RRRR(R RRR`R((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRTs&      (RRR)R RRR(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR%s   t AutoLocatorcB seZdZRS(c C s)tj|dddddddgdS(NRi Riiii (RR (R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR ps(RRR (((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRostAutoMinorLocatorcB seZdZdZRS(s Dynamically find minor tick positions based on the positions of major ticks. Assumes the scale is linear and major ticks are evenly spaced. c C so|jj}y|d|d}Wntk rDtdnXtd|jdd}|ddkr|d}n |d }|d|}|d |}tj|||}|jj\}} || kr| |}} n|||k|| k@}d t |d|d} g|D]+} tj | || kj r(| ^q(}|j tj |S( s!Return the locations of the ticksiis:Need at least two major ticks to find minor tick locationss%eR@ig|=g@g@ig?( Rtget_majorticklocsRRRRDRmRRR;tallRR( R t majorlocst majorstepttempt minorstepttminttmaxR%RRtdifftl((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRys&    8(RRR)R(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRsstOldAutoLocatorcB s;eZdZdZdZdZdZdZRS(so On autoscale this class picks the best MultipleLocator to set the view limits and the tick locs. cC st|_dS(N(Rt_locator(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR scC s|j|j|jS(s!Return the locations of the ticks(RRR+(R ((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRs cC sY|jj\}}tj||dd\}}t||}|j||_dS(s1refresh internal information based on current limRg?N(RRRRR;t get_locatorR+(R RRR?((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC s5t||}|j||_|jj||S(s+Try to choose the view limits intelligently(R;R,R+R(R RRR?((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyRscC st|}|dkr'td}nytj|}Wntk rYtdnXtj|}d|}|d|kr|}n'|d|kr|d}n |d}t|}|S( s)pick the best locator based on a distanceig?s'AutoLocator illegal data interval rangei iig@g@(R;RRoRqt OverflowErrorRRp(R R?tlocatortldtfldRtticksize((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR,s         (RRR)R RRRR,(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pyR*s     (((RRR1R0R6R8RLRRRRRRRRR RRR(.R)t __future__RRRotnumpyRmt matplotlibRRRRRRR*R0R1R6R8R:RLRRRRRRRRRRRRRRRRRRRR RRRR*t__all__(((sD/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/ticker.pytus^   &*  $O (VG  C '!     pJ%8