o
    îÇh1  ã                   @   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   ú}/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-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   )Ú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   X   s    )Ú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   sF   


€


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   r-   r/   r   r   r   r   r   
   s    


B)r3   Únumpyr   Úmatplotlib.unitsÚunitsÚ__all__ÚConversionInterfacer   r   r   r   r   Ú<module>   s
    