o
    g                     @   s4   d Z ddlZddlmZ dgZG dd dejZdS )z2StrConverter module containing class StrConverter.    NStrConverterc                   @   s4   e Zd ZdZedd Zedd Zedd ZdS )	r   al  
    A Matplotlib converter class for string data values.

    Valid units for string are:
    - 'indexed' : Values are indexed as they are specified for plotting.
    - 'sorted'  : Values are sorted alphanumerically.
    - 'inverted' : Values are inverted so that the first value is on top.
    - 'sorted-inverted' :  A combination of 'sorted' and 'inverted'
    c                 C   s   d S )N )unitaxisr   r   g/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/matplotlib/testing/jpl_units/StrConverter.pyaxisinfo   s   zStrConverter.axisinfoc           	         sd  t j| r| S | g krg S |j}||ju rd}nd}|  | |  dd  D   s4g g  t	| s<| g} g }| D ]}| vrO||vrO|
| q@ | dg  dg  ttt dd< d d d< | |  | }|d d  |r|d d  n
|d d   fd	d| D }|jd |S )
NTFc                 S   s   g | ]
}|  r|  qS r   )get_text).0lr   r   r   
<listcomp>/   s    z(StrConverter.convert.<locals>.<listcomp> g      ?r   c                    s   g | ]	}  | qS r   )index)r	   vlabelsticksr   r   r   [   s    )unitsConversionInterface
is_numlikeaxesxaxisget_major_ticksget_ticklocsget_ticklabelsnpiterableappendextendlistrangelen	set_ticksset_ticklabelsget_major_locator
set_boundsset_xlimset_ylimviewLimignore)	valuer   r   axisXAxis	newValuesr   locresultr   r   r   convert   sJ   





zStrConverter.convertc                 C   s   dS )Nindexedr   )r*   r   r   r   r   default_units`   s   zStrConverter.default_unitsN)__name__
__module____qualname____doc__staticmethodr   r0   r2   r   r   r   r   r   
   s    


E)r6   numpyr   matplotlib.unitsr   __all__r   r   r   r   r   r   <module>   s
    