
    gC                        d dl Zd dlmZ d dlZd dlZd dlmZ d dl	m
Z
mZ  e
dgdd      d	        Z e
d
gddd      d        Z e
dg      d        Zd Z e       d        Z e       d        Z e       d        Z e
dgd      d        Z e
dgd      d        Z e
dgd      d        Z e
dgd      d        Z e
dgd      d        Z e
d gd      d!        Z e
d"gd      d#        Z e
d$gd      d%        Z ed&g'      d(        Z ed&g'      d)        Zd* Zd+ Zd, Zd- Z d. Z!d/ Z" ed&g'      d0        Z# ed&g'      d1        Z$d2 Z%d3 Z&d4 Z'd5 Z( ed&g'      d6        Z)d7 Z*d8 Z+d9 Z,d: Z- e
d;gd      d<        Z.d= Z/ej`                  jc                  d>d?d@g       e
dAgdd&gdBC      dD               Z2y)E    N)assert_allclose)pyplot)image_comparisoncheck_figures_equal
polar_axesdefaultg~jt?)styletolc            
         t        j                  ddd      } dt         j                  z  | z  }t        j                         }|j                  d      }|j                  || dd	      \  }|j                  d
ddd	      \  }d}| |   ||   }}|j                  |g|gd       |j                  d||fddt        dd      dd       |j                  dddd       y )N              ?MbP?      @Tpolarz#ee8d18   )colorlwr   r   r      z#0000ffr      oza polar annotation)皙?r   zfigure fractionblackr   	facecolorshrinkleftbaseline)xyxytext
textcoords
arrowpropshorizontalalignmentverticalalignmentxout)axistick1Ontick2On	direction)
nparangepipltfigureadd_subplotplotannotatedicttick_params)rthetafigaxlineindthisr	thisthetas           X/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/matplotlib/tests/test_polar.pytest_polar_annotationsr@   
   s     			#sE"A!E
**,C	t	$BGGE1I!G4EDGGFF)G:ED
CvuSz9EGGYK%#&KK$u%#,'$?$*",   NNT45NI    polar_coordsTgy&1?)r	   remove_textr
   c                     t         j                  j                  ddddd      } t        j                         }|j                  d      }|j                  |        | j                  |j                         |j                  d	t        j                  d
z  dft        j                  dz  dfddt        dd      ddd	       |j                  dd       |j                  dd       y )Nr   
      r7         ?)r   alphaequal)aspectzthe top       @      $@r   g      4@r   r   r   r   r   r    T)r!   r"   xycoordsr#   r$   r%   r&   clip_oni)mplpatchesEllipser0   r1   r2   
add_artistset_clip_boxbboxr4   r-   r/   r5   set_xlimset_ylim)elr9   r:   s      r?   test_polar_coord_annotationsrX   ,   s     
		VRs#		FB
**,C		(BMM"OOBGGKK	EE"Hc?a~ "'$?$*",  	 KKRKKRrA   zpolar_alignment.pngc                  |   t        j                  ddd      } g d}t        j                         }g d}|j	                  |dd      }|j                  |        |j	                  |dd	      }|j                  j                  d
       t        d      D ]'  }|j                  |   j                  || |   dd       ) y )Nr   ih  Z   )r   皙?皙?g333333?皙?r   皙?r_   r]   r]   T
horizontal)r   labelverticalF   r   top)angler%   r&   )r-   r.   r0   r1   add_axesset_thetagridspatchset_visiblerangeaxes
set_rgrids)anglesgrid_valuesr9   rectr`   rb   is          r?   test_polar_alignmentrq   I   s     YYq#r"F,K
**,CDd$lCJf%||DJ|?HNNu%1X Avay &% 	 	AArA   c                      t        j                         } t        j                  ddgddg       t        j                  ddgddg       t        | j                        dk(  sJ d	       y )
Nr   rc   r_   r[   r      g333333?r\   z!More than one polar Axes created.)r0   r1   r   lenrk   )r9   s    r?   test_polar_twiceru   ^   sU    
**,CIIq!fr2hIIq!fr2hsxx=ABBBrA   c                    | j                  d      }|j                  t        j                  ddg      ddg       |j                  t        j                  ddg      ddg       |j                  d      }|j                  t        j                  dd	g      ddg       |j                  t        j                  dd
g      ddg       y )Nr   
projection   iMr[   r_   rc      if  )r2   r3   r-   deg2radfig_testfig_refr:   s      r?   test_polar_wrapr   e   s    					1BGGBJJT{#c3Z0GGBJJ2w#s,					0BGGBJJSz"S#J/GGBJJ3x 3*-rA   c                    dd l mc m} |j                          g d}g d}t	        j
                  | j                         t	        j                  |D cg c]  }||j                  z   c}|       |j                  d      }|j                  t        j                  |      |       |j                  d       y c c}w )Nr   g      >@g     F@g      N@     V@r   rK         @r   r   rw   deg)xlabel)matplotlib.testing.jpl_unitstesting	jpl_unitsregisterr0   r1   numberr   r   r2   r3   r-   r|   set)r~   r   unitsxsysr'   r:   s          r?   test_polar_units_1r   o   s    00	NN	!B	BJJxIIb)q599})2.					0BGGBJJrNBFF%F	 *s   B<c                    dd l mc m} |j                          g d}|D cg c]  }||j                  z   }}g d}|D cg c]  }||j
                  z   }}t        j                  | j                         t        j                  ||dd       t        t        j                         j                  j                         |j                        sJ |j                  d      }	|	j!                  t#        j$                  |      |       |	j                  j'                  t(        j*                  j-                  d	j.                               |	j1                  dd
       y c c}w c c}w )Nr   r   r   radkm)
thetaunitsrunitsr   rw   z{:.12})r   ylabel)r   r   r   r   r   r   r0   r1   r   r   
isinstancegcaxaxisget_major_formatterUnitDblFormatterr2   r3   r-   r|   set_major_formatterrO   tickerFuncFormatterformatr   )
r~   r   r   r   r'   xs_degr   yys_kmr:   s
             r?   test_polar_units_2r   ~   s   00	NN	!B%'(a%))m(F(	B#%&aQ\&E&JJxIIfed;cggioo99;,,. . . 
				0BGGBJJrNBHH  !9!9(//!JKFF%F% )&s   E!E&
polar_rmin)r	   c                     t        j                  ddd      } dt         j                  z  | z  }t        j                         }|j                  g dd      }|j                  ||        |j                  d       |j                  d	       y )
Nr   r   {Gz?rc   r^   Tr   rK   rG   	r-   r.   r/   r0   r1   rf   r3   set_rmaxset_rminr7   r8   r9   r:   s       r?   test_polar_rminr      si    
		!S$AbeeGAIE
**,C	*$	7BGGE1KKKKrA   polar_negative_rminc                     t        j                  ddd      } dt         j                  z  | z  }t        j                         }|j                  g dd      }|j                  ||        |j                  d       |j                  d       y )Ng      r   r   rc   r^   Tr   r   r   s       r?   test_polar_negative_rminr      si    
		$T"AbeeGAIE
**,C	*$	7BGGE1KKKKrA   polar_roriginc                  :   t        j                  ddd      } dt         j                  z  | z  }t        j                         }|j                  g dd      }|j                  ||        |j                  d       |j                  d	       |j                  d
       y )Nr   r   r   rc   r^   Tr   rK   rG   r   )
r-   r.   r/   r0   r1   rf   r3   r   r   set_roriginr   s       r?   test_polar_roriginr      su    
		!S$AbeeGAIE
**,C	*$	7BGGE1KKKKNN3rA   zpolar_invertedylim.pngc                  z    t        j                         } | j                  g dd      }|j                  dd       y )Nr^   Tr   rc   r   )r0   r1   rf   rV   r9   r:   s     r?   test_polar_invertedylimr      s.    
**,C	*$	7BKK1rA   zpolar_invertedylim_rorigin.pngc                      t        j                         } | j                  g dd      }|j                  j	                  d       |j                  ddgddgd       |j                  d       |j                  d       y )	Nr^   Tr   r   rc   none)cr   )r0   r1   rf   yaxisset_invertedr3   marginsr   r   s     r?   test_polar_invertedylim_roriginr      se    
**,C	*$	7BHH$ GGQFQFfG%JJqMNN1rA   polar_theta_positionc                     t        j                  ddd      } dt         j                  z  | z  }t        j                         }|j                  g dd      }|j                  ||        |j                  dd	       |j                  d
       y )Nr   r   r   rc   r^   Tr   NW   	clockwise)	r-   r.   r/   r0   r1   rf   r3   set_theta_zero_locationset_theta_directionr   s       r?   test_polar_theta_positionr      so    
		!S$AbeeGAIE
**,C	*$	7BGGE1tR(;'rA   polar_rlabel_positionc                      t        j                         } | j                  d      }|j                  d       |j	                  d       y )Nr   rw   i;  auto)rotation)r0   r1   r2   set_rlabel_positionr6   r   s     r?   test_polar_rlabel_positionr      s9    
**,C	G	,B3NNFN#rA   polar_theta_wedgec                  D   t        j                  ddd      } dt         j                  z  | z  }t        j                  ddd      }t        j                  ddd      }d	}t        j                  t        |      t        |      d
did      \  }}t        |      D ]  \  }}t        |      D ]  \  }	}
|||	f   }|j                  ||        ||
k  r#|j                  |       |j                  |
       n3|j                  |
       |j                  |       |j                  d       |j                  dd||t        |      z     d       |j                  j                  dd       |j                  j                         j                   j#                  g d         y )Nr   r   r   rc   g      .@g     v@r   g      I@)r(   ininoutr   T)      )
subplot_kwfigsizer   r   )r*   r+   r,   r   )label2Onr   )r   rc   g      @   rE   )steps)r-   r.   r/   r0   subplotsrt   	enumerater3   set_thetaminset_thetamaxr   r6   r   set_tick_paramsr   get_major_locatorbase
set_params)r7   r8   
theta_mins
theta_maxs
DIRECTIONSr9   axsrp   startjendr:   s               r?   test_polar_theta_limitsr      su   
		!S$AbeeGAIE4-J4-J'J||C
OS_(/$*,HC j) *5
+ 	*FAsQTBGGE1s{&$ $&&&{3NN4%/C
O0C%D$*  , HH$$dV$DHH&&(--88( 9 *	**rA   png)
extensionsc                     | j                  ddi      }|j                  d       |j                  d       |j                  ddi      }|j                  d       |j                  d       y )	Nr   Tr   rE   )rd   rG   bottomrL   r   set_rlimr   r   r}   s      r?   test_polar_rlimr      sc    			wo		6BKKBKKKrK			gt_		5BKKKKOrA   c                     | j                  ddi      }|j                  ddg       |j                  ddi      }|j                  d       |j                  d       y )Nr   Tr   rG   rE   r   rL   r   r}   s      r?   test_polar_rlim_bottomr     sY    			wo		6BKKBxK 			gt_		5BKKKKOrA   c                      t        j                         j                  d      } | j                  t	        j
                  d      t	        j
                  d      dz          | j                         d   dk(  sJ y )Nr   rw   rE   r   r   )r0   r1   r2   r3   r-   r.   get_ylimr:   s    r?   test_polar_rlim_zeror     sW    		!	!W	!	5BGGBIIbM299R=3./;;=q   rA   c                  r   t        j                  d       t        j                         } | j                         dk(  r| j	                         dk(  sJ t        j
                  d       t        j                          t        j                         } | j                         dk(  r| j	                         dk(  sJ y )Nr   rw   r   r   all)r0   subplotr   get_rminget_rmaxcloser   r   s    r?   test_polar_no_datar     s~    KK7#	B;;=A"++-1"444IIeIIK	B;;=A"++-1"444"4rA   c                      t        j                  d       t        j                         } | j                  d       | j	                         dkD  sJ y )Nr   rw   logr   )r0   r   r   
set_rscaler   r   s    r?   test_polar_default_log_limsr   &  s9    KK7#	BMM%;;=1rA   c                      t        j                         j                  d      } t        j                  t
              5  | j                  d       d d d        y # 1 sw Y   y xY w)Nr   rw   datalim)r0   r1   r2   pytestraises
ValueErrorset_adjustabler   s    r?   !test_polar_not_datalim_adjustabler  -  sJ    		!	!W	!	5B	z	" %
)$% % %s   AA"c                     t        j                         } | j                  d      }|j                  d       t        j                  |j
                  j                         d       | j                  j                          |j                  j                  d   j                  j                         dk(  sJ |j
                  j                  d   j                  j                         dk(  sJ y )NTr   r[   )rH   F)visibler   )r0   r1   r2   gridsetpr   get_ticklabelscanvasdrawr   
majorTicksgridline	get_alphar   s     r?   test_polar_gridlinesr  3  s    
**,C	t	$BGG#GHHRXX$$&6JJOO88q!**446"<<<88q!**446"<<<rA   c                      t        j                  ddi      \  } }| j                  j                          |j	                  | j                  j                               }t        |j                  g dd       y )Nrx   r   r   )gyZ@g,ԚG=@g_)Gހ@gR!+|@r   )rtol)r0   r   r  r  get_tightbboxget_rendererr   extents)r9   r:   bbs      r?   test_get_tightbbox_polarr  ?  sY    ll|W&=>GCJJOO			#**113	4B


<5JrA   c                    | j                  dd      j                  dgdgdt        j                  z  dd	      }| j                  d
d      j                  dgdgdt        j                  z  dd	      }|j                  dd      j                  dgdgdt        j                  z  dd	      }|j                  d
d      j                  dgdgdt        j                  z  dd	      }y )Ny   r   rw   r   r   r   r   F)	edgecolorantialiasedz   rc   rz   )r2   barr-   r/   )r~   r   p1p2p3p4s         r?   )test_polar_interpolation_steps_constant_rr%  G  s     

sw

73sQC255F3F 


sw

73sQCBEEV3G 


cg

63sQC255F3F 


cg

63sQCBEEV3G rA   c                 Z   | j                  d      j                  dt        j                  dz  gddg      \  }d|j	                         _        |j                  d      j                  t        j                  dt        j                  dz  d      t        j                  ddd             y )Nr   rw   r   rc   r   d   e   )r2   r3   r-   r/   get_path_interpolation_stepslinspace)r~   r   ls      r?   )test_polar_interpolation_steps_variable_rr-  U  s    					1	6	62557|aV	LBA(+AJJL%7+00
AruuQw$bkk!Q&<>rA   c                     t        j                  d      } | j                  ddt        j                  z         | j                  dd       t        j                  t        d	      5  | j                  dd
t        j                  z         d d d        t        j                  t        d	      5  | j                  dd       d d d        y # 1 sw Y   AxY w# 1 sw Y   y xY w)Nr   rw   r   rc   r   i  )thetaminthetamaxz+angle range must be less than a full circle)matchr   i  )r0   r   set_thetalimr-   r/   r  r  r  r   s    r?   test_thetalim_valid_invalidr3  ]  s    		(BOOAq255y!OOS3O/	zJ
L &
1ruu9%& 
zJ
L 4
s34 4& &4 4s   ($C/CCC!c                  z   t        j                  d      } | j                  dd       t        t	        j
                  | j                         | j                         f            dk(  sJ | j                  d       t        t	        j
                  | j                         | j                         f            dk(  sJ y )Nr   rw   r   r   r   )rc   r   )r0   r   r2  tupler-   radiansget_thetaminget_thetamaxr   s    r?   test_thetalim_argsr9  i  s    		(BOOAqR__.0ABCDNNNOOFR__.0ABCDNNNrA   c                     t        j                  dddi      \  } }|j                         D ]"  }|j                  dt        j
                         $ |j                         D ]o  }t	        j                  |j                  j                               j                         }t        j                  d      |v sJ t        j                  d      |vroJ  y )NzAAAABB.rx   r   r   r   rZ   r'  )r0   subplot_mosaicvaluesr2  r-   r/   degreesr   get_majorticklocstolistr  approx)r9   r   r:   ticklocss       r?   test_default_thetalocatorrB  q  s     !!|W57HCjjl "
255!"jjl 2::bhh88:;BBD}}R H,,,}}S!1112rA   c                      t        j                  d      } | j                  dt        j                  dz        }|j                         j                  dkD  sJ y )Nr   rw   r   rs   r   )r0   r   axvspanr-   r/   r)  r*  )r:   spans     r?   test_axvspanrF    sB    		(B::aq!D==?//!333rA   c                     | j                  dddddi      }dD ]  }|j                  |   j                          ! |j                  dddddi      }dD ]  }|j                  |   j                          ! y )Nrc   Trx   r   )sharexr   )r   r   r   )shareyr   )r   flatremove)r   r~   r   rp   s       r?   test_remove_shared_polarrL    s    
 

	1T|W&=  ?C 


	1T|W&=  ?C rA   c                  F   t        j                  ddddidd      \  } }| j                  j                          |d   j                  j
                  d   j                         sJ |d   j                  j
                  d   j                         sJ t        j                  dddidd      \  } }| j                  j                          |d	   j                  j
                  d   j                         sJ |d	   j                  j
                  d   j                         sJ y )
Nrc   rx   r   T)r   rH  rI  r   r   zab
cdb)	r0   r   r  r  r   r  get_visibler   r;  )r9   r   s     r?   "test_shared_polar_keeps_ticklabelsrP    s    ||	1,0dLHCJJOOt9??%%a(44666t9??%%a(44666!!lG4T$PHCJJOOs8>>$$Q'33555s8>>$$Q'33555rA   c                      t        j                  d      } | j                  dd       | j                  d       | j	                  ddg       | j                         dk(  sJ y )	Nr   rw   r   r   rG   r_   r[   )r   r[   )r0   r   rD  axvliner3   r   r   s    r?   (test_axvline_axvspan_do_not_modify_rlimsrS    sM    		(BJJq!JJrNGGRH;;=G###rA   c                     t        j                  d      } | j                  dd      dk(  sJ | j                  dd      dk(  sJ | j                  dd      d	k(  sJ | j                  dd      d
k(  sJ | j                  dd      dk(  sJ | j                  dd      dk(  sJ | j                  dd      dk(  sJ | j                  dd      dk(  sJ | j                  dd      dk(  sJ y )Nr   rw   r   {Gzt?u   θ=0.0π (0°), r=0.005r_   u   θ=0.00π (0°), r=0.100r   u   θ=0.000π (0.0°), r=1.000u   θ=0.3π (57°), r=0.005u   θ=0.32π (57°), r=0.100u   θ=0.318π (57.3°), r=1.000rc   u   θ=0.6π (115°), r=0.005u   θ=0.64π (115°), r=0.100u   θ=0.637π (114.6°), r=1.000)r0   r   format_coordr   s    r?   test_cursor_precisionrW    s    		(B??1e$(AAAA??1b!%??????1a $AAAA??1e$(BBBB??1b!%@@@@??1a $BBBB??1e$(CCCC??1b!%AAAA??1a $CCCCrA   c                  (   t        j                  d      } d }d | _        || _        | j	                  dd      dk(  sJ | j	                  dd      d	k(  sJ | j	                  d
d      dk(  sJ || _        d | _        | j	                  dd      dk(  sJ | j	                  dd      dk(  sJ | j	                  dd      dk(  sJ || _        || _        | j	                  dd      dk(  sJ | j	                  dd      dk(  sJ | j	                  dd      dk(  sJ y )Nr   rw   c                     d| dz  z  S )Nz$%1.1fMgư> )r'   s    r?   millionsz&test_custom_fmt_data.<locals>.millions  s    AdF##rA      g    sAu,   θ=3.8197186342π (687.54935416°), r=$20.0Mi  g    >Au-   θ=392.794399551π (70702.9919191°), r=$2.0Mr   r'  u!   θ=0.95493π (171.887°), r=$0.0Mg     jAr   u   θ=$0.2M, r=1.000r_   u   θ=$0.0M, r=0.100g    .ArU  u   θ=$1.0M, r=0.005g   ZAu   θ=$2.0M, r=$6000.0Mg NgmCl   {  u!   θ=$1000000000000.0M, r=$12891.3Ml   1;Ti 	Bu   θ=$3938980.6M, r=$1107.9M)r0   r   	fmt_xdata	fmt_ydatarV  )r:   r[  s     r?   test_custom_fmt_datar_    s/   		(B$ BLBL??2s#'UUUU??4%)XXXX??1c"&IIII BLBL??3"&9999??1b!%8888??3&*==== BLBL??3(,BBBB??4-1TTTT??5,/3OOOOrA   zpolar_log.pngc                  4   t        j                         } | j                  d      }|j                  d       |j	                  dd       d}|j                  t        j                  ddt        j                  z  |      t        j                  dd|             y )	NTr   r   r   i  r'  r   rc   )
r0   r1   r2   r   r   r3   r-   r+  r/   logspace)r9   r:   ns      r?   test_polar_logrc    sl    
**,C	t	$BMM%KK4AGGBKK1ruu9a("++aA*>?rA   c                  4   t        j                         } | j                  d      }|j                  t        j
                   t        j
                         |j                  j                         D cg c]  }|j                          }}|g dk(  sJ y c c}w )Nr   rw   )u   -180°u   -135°u   -90°u   -45°u   0°u   45°u   90°u   135°)	r0   r1   r2   r2  r-   r/   r   r  get_text)r9   r:   r,  labelss       r?   test_polar_neg_theta_limsrg    so    
**,C	G	,BOORUUFBEE"$&HH$;$;$=>qajjl>F>[[[[ ?s   2Borderbeforeafterpolar_errorbarmpl20)baseline_imagesrC   r   r	   c           	         t        j                  ddt         j                  z  t         j                  dz        }|t         j                  z  dz  dz   }t        j                  d      }|j                  d      }| d	k(  r;|j                  d
       |j                  d       |j                  ||ddddd       y |j                  ||ddddd       |j                  d
       |j                  d       y )Nr   rc   r   rG   )r   r   )r   r   rw   ri  Nr_      r   seagreen)xerryerrcapsizefmtr   )	r-   r.   r/   r0   r1   r2   r   r   errorbar)rh  r8   r7   r9   r:   s        r?   test_polar_errorbarrx    s     IIaRUUBEEAI.ECA
**V
$C	G	,B
""3'
r"
E13S!
S
E13S!
S
""3'
r"rA   )3numpyr-   numpy.testingr   r  
matplotlibrO   r   r0   matplotlib.testing.decoratorsr   r   r@   rX   rq   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r%  r-  r3  r9  rB  rF  rL  rP  rS  rW  r_  rc  rg  markparametrizerx  rZ  rA   r?   <module>r     s    )   $ O <.	u=J >JB >")6 ()*A +A(C . .   & &( <.	2 3 (); < ?#95	 6	 +,I> ? 34IF G )*)<( =( *+9=$ >$ &'y9* :*@ ( ) ( )!5%	=J (
I )
I (> )>	4O24 ( )
6$DP6 ?#95@ 6@\ 8W"56#3"4$#WG5#5 7#rA   