+
    ,i                        R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RI	H
t
HtHtHt ]P                  ! ]4      t ! R R]P"                  4      t ! R R]P&                  4      t ! R R	]P*                  4      t ! R
 R4      t]! 4       ;]P0                  ]&   ;]P0                  ]P4                  &   ;]P0                  ]&   ]P0                  ]P8                  &   R# )a  
Plotting of string "category" data: ``plot(['d', 'f', 'a'], [1, 2, 3])`` will
plot three points with x-axis values of 'd', 'f', 'a'.

See :doc:`/gallery/lines_bars_and_markers/categorical_variables` for an
example.

The module uses Matplotlib's `matplotlib.units` mechanism to convert from
strings to integers and provides a tick locator, a tick formatter, and the
`.UnitData` class that creates and stores the string-to-integer mapping.
)OrderedDictN)_apicbooktickerunitsc                   `   a  ] tR t^t o ]R 4       t]R 4       t]R 4       t]R 4       tRt	V t
R# )StrCategoryConverterc                   Vf   \        R4      h\        P                  V4       \        P                  ! \        P
                  ! V \        R7      4      pVP                  V4       \        P                  ! VP                  P                  \        .R7      ! V4      p\        P                  ! V 4      '       g   V# V^ ,          # )a  
Convert strings in *value* to floats using mapping information stored
in the *unit* object.

Parameters
----------
value : str or iterable
    Value or list of values to be converted.
unit : `.UnitData`
    An object mapping strings to integers.
axis : `~matplotlib.axis.Axis`
    The axis on which the converted value is plotted.

    .. note:: *axis* is unused.

Returns
-------
float or `~numpy.ndarray` of float
zMissing category information for StrCategoryConverter; this might be caused by unintendedly mixing categorical and numeric datadtype)otypes)
ValueErrorr   _validate_unitnp
atleast_1darrayobjectupdate	vectorize_mapping__getitem__floatr   is_scalar_or_string)valueunitaxisvaluesss   &&&  5/usr/lib/python3/dist-packages/matplotlib/category.pyconvertStrCategoryConverter.convert   s    * <    	++D1rxxV<=FLL22E7CFK11%88qBadB    c                    \         P                  V 4       \        V P                  4      p\	        V P                  4      p\
        P                  ! W#R7      # )aL  
Set the default axis ticks and labels.

Parameters
----------
unit : `.UnitData`
    object string unit information for value
axis : `~matplotlib.axis.Axis`
    axis for which information is being set

    .. note:: *axis* is not used

Returns
-------
`~matplotlib.units.AxisInfo`
    Information to support default tick labeling

)majlocmajfmt)r   r   StrCategoryLocatorr   StrCategoryFormatterr   AxisInfo)r   r   r#   r$   s   &&  r   axisinfoStrCategoryConverter.axisinfo=   s?    ( 	++D1 $DMM2%dmm4~~V;;r!   c                    VP                   f'   VP                  \        V 4      4       VP                   # VP                   P                  V 4       VP                   # )z
Set and update the `~matplotlib.axis.Axis` units.

Parameters
----------
data : str or iterable of str
axis : `~matplotlib.axis.Axis`
    axis on which the data is plotted

Returns
-------
`.UnitData`
    object storing string to integer mapping
)r   	set_unitsUnitDatar   )datar   s   &&r   default_units"StrCategoryConverter.default_unitsX   sH    " ::NN8D>* zz JJd#zzr!   c                H    \        V R 4      '       g   \        RV  R24      hR# )r   zProvided unit "zU" is not valid for a categorical converter, as it does not have a _mapping attribute.N)hasattrr   )r   s   &r   r   #StrCategoryConverter._validate_unito   s6    tZ((!$ (G GH H )r!    N)__name__
__module____qualname____firstlineno__staticmethodr   r(   r.   r   __static_attributes____classdictcell____classdict__s   @r   r   r      sX     C CB < <4  , H Hr!   r   c                   6   a  ] tR t^wt o RtR tR tR tRtV t	R# )r%   z1Tick at every integer mapping of the string data.c                    Wn         R# zb
Parameters
----------
units_mapping : dict
    Mapping of category names (str) to indices (int).
N_unitsselfunits_mappings   &&r   __init__StrCategoryLocator.__init__y   	     $r!   c                H    \        V P                  P                  4       4      # N)listrA   r   )rC   s   &r   __call__StrCategoryLocator.__call__   s    DKK&&())r!   c                    V ! 4       # rI   r3   )rC   vminvmaxs   &&&r   tick_valuesStrCategoryLocator.tick_values   s	    vr!   r@   N)
r4   r5   r6   r7   __doc__rE   rK   rP   r9   r:   r;   s   @r   r%   r%   w   s     ;$* r!   r%   c                   J   a  ] tR t^t o RtR tRR ltR t]R 4       t	Rt
V tR# )	r&   z0String representation of the data at every tick.c                    Wn         R# r?   r@   rB   s   &&r   rE   StrCategoryFormatter.__init__   rG   r!   Nc                4    V P                  V.4      ^ ,          # )    )format_ticks)rC   xposs   &&&r   rK   StrCategoryFormatter.__call__   s      !%a((r!   c                    V P                   P                  4        UUu/ uF  w  r#W0P                  V4      bK  	  pppV Uu. uF  qTP                  \	        V4      R 4      NK  	  up# u uppi u upi ) )rA   items_textgetround)rC   r   kv	r_mappingvals   &&    r   rX   !StrCategoryFormatter.format_ticks   s]    26++2C2C2EF2E$!Q

1%2E	F9?@#eCj"-@@ G@s   A'#A-c                    \        V \        4      '       d   V P                  RR7      p V # \        V \        4      '       g   \        V 4      p V # )z0Convert text values into utf-8 or ascii strings.zutf-8)encoding)
isinstancebytesdecodestrr   s   &r   r_   StrCategoryFormatter._text   sE     eU##LL'L2E  E3''JEr!   r@   rI   )r4   r5   r6   r7   rR   rE   rK   rX   r8   r_   r9   r:   r;   s   @r   r&   r&      s,     :$)A
  r!   r&   c                   @   a  ] tR t^t o RR lt]R 4       tR tRtV t	R# )r,   Nc                    \        4       V n        \        P                  ! 4       V n        Ve   V P                  V4       R# R# )z
Create mapping between unique categorical values and integer ids.

Parameters
----------
data : iterable
    sequence of string values
N)r   r   	itertoolscount_counterr   )rC   r-   s   &&r   rE   UnitData.__init__   s2     $!)KK r!   c                     \        V 4       R#   \         d>     \        P                  P	                  T 4        R#   \        \
        3 d      R# i ; ii ; i)zI
Helper method to check whether a string can be parsed as float or date.
FT)r   r   dateutilparserparse	TypeError)re   s   &r   _str_is_convertibleUnitData._str_is_convertible   sY    
	#J   	%%c*  	* 	s$    A=AAAAc                   \         P                  ! \         P                  ! V\        R7      4      pRp\        P
                  ! V4       Fr  p\        P                  ! \        \        3VR7       V'       d   V P                  V4      pW0P                  9  g   KP  \        V P                  4      V P                  V&   Kt  	  VP                  '       d"   V'       d   \        P!                  R4       R# R# R# )z
Map new values to integer identifiers.

Parameters
----------
data : iterable of str or bytes

Raises
------
TypeError
    If elements in *data* are neither str nor bytes.
r
   Trm   zUsing categorical units to plot a list of strings that are all parsable as floats or dates. If these strings should be plotted as numbers, cast to the appropriate data type before plotting.N)r   r   r   r   r   fromkeysr   check_isinstancerl   rj   rz   r   nextrs   size_loginfo)rC   r-   convertiblere   s   &&  r   r   UnitData.update   s     }}RXXd&9:''-C!!3,c:"66s;--'%)$--%8c" . 999II ? @ %9r!   )rs   r   rI   )
r4   r5   r6   r7   rE   r8   rz   r   r9   r:   r;   s   @r   r,   r,      s*       @ @r!   r,   )rR   collectionsr   dateutil.parserrv   rq   loggingnumpyr   
matplotlibr   r   r   r   	getLoggerr4   r   ConversionInterfacer   Locatorr%   	Formatterr&   r,   registryrl   str_rj   bytes_r3   r!   r   <module>r      s   
 $     1 1 "ZH544 ZHz (6++ <:@ :@D !5 67s  7	NN2777	NN5	NN299r!   