o
    ¡:´a1  ã                   @   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   úK/usr/lib/python3/dist-packages/matplotlib/testing/jpl_units/StrConverter.pyÚaxisinfo   s   zStrConverter.axisinfoc           	         sT  | g krg S |j }||ju rd}nd}| ¡  | ¡ ‰| ¡ ‰ dd„ ˆ D ƒ‰ ˆ s,g ‰g ‰ t | ¡s4| g} g }| D ]}|ˆ vrG||vrG| |¡ q8ˆ  |¡ 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   )Zget_text)Ú.0Úlr   r   r   Ú
<listcomp>,   s    z(StrConverter.convert.<locals>.<listcomp>Ú g      à?r   éÿÿÿÿc                    s   g | ]	}ˆˆ   |¡ ‘qS r   )Úindex)r   Úv©ÚlabelsZticksr   r   r
   X   s    )ZaxesZxaxisZget_major_ticksZget_ticklocsZget_ticklabelsÚnpÚiterableÚappendÚextendÚlistÚrangeÚlenZ	set_ticksZset_ticklabelsZget_major_locatorZ
set_boundsZset_xlimZset_ylimZviewLimÚignore)	Úvaluer   r   ZaxZisXAxisZ	newValuesr   ÚlocÚresultr   r   r   Úconvert   sF   


€


zStrConverter.convertc                 C   s   dS )NZindexedr   )r   r   r   r   r   Údefault_units]   s   zStrConverter.default_unitsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr   r   r   r   r   r   r   r   
   s    


B)r!   Znumpyr   Zmatplotlib.unitsZunitsÚ__all__ZConversionInterfacer   r   r   r   r   Ú<module>   s
    