o
    Uh                     @  s   d dl mZ d dlmZ d dlZd dlZd dlm	Z	m
Z
mZmZmZmZmZmZmZmZ d dlmZ erFd dlmZ d dlmZ d dlmZ G d	d
 d
e	ZeeG dd deZeeG dd deZdS )    )annotations)	dataclassN)
MarkMappableMappableBoolMappableFloatMappableStringMappableColorMappableStyleresolve_propertiesresolve_colordocument_properties)TYPE_CHECKING)Any)Artist)Scalec                   @  s.   e Zd Zdd Zdd Zdd ZdddZdS )DotBasec                 C  s^   g }i }|d }dd }t |tjjr||S |D ]}||vr%||||< |||  q|S )Nmarkerc                 S  s   |   |  S )N)get_pathtransformedget_transform)m r   F/var/www/vscode/kcb/lib/python3.10/site-packages/seaborn/_marks/dot.pyget_transformed_path#   s   z4DotBase._resolve_paths.<locals>.get_transformed_path)
isinstancemplmarkersMarkerStyleappend)selfdatapaths
path_cacher   r   r   r   r   r   _resolve_paths   s   zDotBase._resolve_pathsc                 C  sh   t | ||}| ||d< |d d |d< t|tr!|d  }n	dd |d D }|d | |d< |S )	Npath	pointsize   sizer   c                 S  s   g | ]}|  qS r   )	is_filled).0r   r   r   r   
<listcomp>8   s    z/DotBase._resolve_properties.<locals>.<listcomp>fill)r   r$   r   dictr)   )r    r!   scalesresolvedfilled_markerr   r   r   _resolve_properties/   s   
zDotBase._resolve_propertiesc           	      C  s   | D ]?\}}}t |d |d g}| ||}tjjd
||d |d |d |d |d |d |jtj d		| j	}|
| qd S )Nxyr%   r(   	facecolor	edgecolor	linewidth	edgestyle)	offsetsr"   sizes
facecolors
edgecolors
linewidths
linestylestransOffset	transformr   )npcolumn_stackr1   r   collectionsPathCollection	transData
transformsIdentityTransform
artist_kwsadd_collection)	r    	split_genr.   orient_r!   axr8   pointsr   r   r   _plot>   s$   
zDotBase._plot	variables	list[str]valuer   r.   dict[str, Scale]returnr   c              
     sl    fdd|D }|  ||}tjjd
|d g|d g|d g|d g|d g|d gtj d	| jS )Nc                   s   i | ]}| qS r   r   )r*   vrQ   r   r   
<dictcomp>[   s    z*DotBase._legend_artist.<locals>.<dictcomp>r%   r(   r4   r5   r6   r7   )r"   r9   r:   r;   r<   r=   r?   r   )r1   r   rB   rC   rE   rF   rG   )r    rO   rQ   r.   keyresr   rU   r   _legend_artistW   s   zDotBase._legend_artistN)rO   rP   rQ   r   r.   rR   rS   r   )__name__
__module____qualname__r$   r1   rN   rY   r   r   r   r   r      s
    r   c                      s   e Zd ZU dZedddZded< edddZded	< ed
ddZded< edddZ	ded< edddZ
ded< edddZded< edddZded< edddZded< edddZded< edddZded<  fddZ  ZS )Dotz
    A mark suitable for dot plots or less-dense scatterplots.

    See also
    --------
    Dots : A dot mark defined by strokes to better handle overplotting.

    Examples
    --------
    .. include:: ../docstrings/objects.Dot.rst

    oFgroupingr   r      r   r&         ?strokeC0r	   color   alphaTr   r,   dependr`   r5   	edgealphag      ?	edgewidth-r
   r7   c           	        s   t  ||}|d }|d }|d }t||||d< t| |d|}t| |d|}t|s7|d d d f }t||||d< t|}t|tr[tg |d d |d | }ntj	|d d d df |d d df | f }||d	< |S )
Nr,   rc   rk   r6    edger5      r4   )
superr1   r@   wherer   isscalarsqueezer   tuplec_)	r    r!   r.   r/   filledmain_strokeedge_stroke
main_color
edge_color	__class__r   r   r1      s    


".zDot._resolve_properties)rZ   r[   r\   __doc__r   r   __annotations__r&   rc   re   rg   r,   r5   rj   rk   r7   r1   __classcell__r   r   r{   r   r]   j   s   
 r]   c                      s   e Zd ZU dZedddZded< edddZd	ed
< edddZd	ed< edddZ	ded< edddZ
d	ed< edddZded< edddZded< edddZd	ed<  fddZ  ZS )Dotsz
    A dot mark defined by strokes to better handle overplotting.

    See also
    --------
    Dot : A mark suitable for dot plots or less-dense scatterplots.

    Examples
    --------
    .. include:: ../docstrings/objects.Dots.rst

    zscatter.markerF)rcr`   r   r      r_   r   r&   rb   rc   rd   r	   re   rf   rg   Tr   r,   rh   	fillcolorg?	fillalphac                   s   t  ||}|d|d< t| |d||d< t| |d||d< |dd |d }t|trE|d	 |d
 |d |d |d  f|d< |S |d d df |d  |d d df< ||d< |S )Nrc   r6   r,   r4   rm   r5   r7   )r   Nr   rf   r'   ro   )rp   r1   popr   
setdefaultr   rt   )r    r!   r.   r/   fcr{   r   r   r1      s   
($zDots._resolve_properties)rZ   r[   r\   r}   r   r   r~   r&   rc   re   rg   r,   r   r   r1   r   r   r   r{   r   r      s   
 r   )
__future__r   dataclassesr   numpyr@   
matplotlibr   seaborn._marks.baser   r   r   r   r   r	   r
   r   r   r   typingr   r   matplotlib.artistr   seaborn._core.scalesr   r   r]   r   r   r   r   r   <module>   s"    0O4