+L iP $dZddlZddlZddlZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZd>dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d d!d"d#d d!d$Z"d%d&d'd(d)d*d+d,d-d.d/ Z#d"d0d1d2d3d4d5d6d7d8d8d9 Z$d:d;dy0hy1TF)all)old_barnew_bartests new_width old_width new_height old_heights b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/plotly/matplotlylib/mpltools.pycheck_bar_matchrs E gm$ (>> @@E gk"gk&:: <D x~rct|tr"t}|D]}|t|gz }|S|tvr t|Sy)z=Convert mpl marker symbol to plotly symbol and return symbol.circle) isinstancelistconvert_symbol SYMBOL_MAP) mpl_symbolsymbolss rr@r@^sO*d# *A ~a() )F * z !*%%rc jdttfdtddzDS)z Change a hex color to an rgb tuple :param (str|unicode) value: The hex string we want to convert. :return: (int, int, int) The red, green, blue int-tuple. Example: '#FFFFFF' --> (255, 255, 255) #c3HK|]}t||dzzdyw)rN)int).0ilvvalues r zhex_to_rgb..ys'PQU1q27{+R0Ps"rr)lstripr,r7range)rMrLs`@r hex_to_rgbrQks: LL E UB P%2rQw:OP PPrcr|yt|}|dj|S||fz}dj|S)a Merge hex color with an alpha (opacity) to get an rgba tuple. :param (str|unicode) color: A hex color string. :param (float|int) opacity: A value [0, 1] for the 'a' in 'rgba'. :return: (int, int, int, float) The rgba color and alpha tuple. Nzrgb {}zrgba {})rQformat)coloropacityrgb_tuprgba_tups rmerge_color_and_opacityrX|sG }Gw'''#H   H %%rc&|tvr t|Sy)aConvert mpl vertical alignment word to equivalent HTML word. Text alignment specifiers from mpl differ very slightly from those used in HTML. See the VA_MAP for more details. Positional arguments: mpl_va -- vertical mpl text alignment spec. N)VA_MAP)mpl_vas r convert_var\sf~rcx|d|d|dzg}|d|dz }|d|dz |z }|d|dz |z }||gS)aHMap x dimension of current plot to plotly's domain space. The bbox used to locate an axes object in mpl differs from the method used to locate axes in plotly. The mpl version locates each axes in the figure so that axes in a single-plot figure might have the bounds, [0.125, 0.125, 0.775, 0.775] (x0, y0, width, height), in mpl's figure coordinates. However, the axes all share one space in plotly such that the domain will always be [0, 0, 1, 1] (x0, y0, x1, y1). To convert between the two, the mpl figure bounds need to be mapped to a [0, 1] domain for x and y. The margins set upon opening a new figure will appropriately match the mpl margins. Optionally, setting margins=0 and simply copying the domains from mpl to plotly would place axes appropriately. However, this would throw off axis and title labeling. Positional arguments: mpl_plot_bounds -- the (x0, y0, width, height) params for current ax ** mpl_max_x_bounds -- overall (x0, x1) bounds for all axes ** ** these are all specified in mpl figure coordinates rr#r)mpl_plot_boundsmpl_max_x_bounds mpl_x_domplotting_widthrrs rconvert_x_domainrcsr0!#_Q%7/!:L%LMI%a(+;A+>>N A,)!, , >B A,)!, , >B 8Orcx|d|d|dzg}|d|dz }|d|dz |z }|d|dz |z }||gS)aHMap y dimension of current plot to plotly's domain space. The bbox used to locate an axes object in mpl differs from the method used to locate axes in plotly. The mpl version locates each axes in the figure so that axes in a single-plot figure might have the bounds, [0.125, 0.125, 0.775, 0.775] (x0, y0, width, height), in mpl's figure coordinates. However, the axes all share one space in plotly such that the domain will always be [0, 0, 1, 1] (x0, y0, x1, y1). To convert between the two, the mpl figure bounds need to be mapped to a [0, 1] domain for x and y. The margins set upon opening a new figure will appropriately match the mpl margins. Optionally, setting margins=0 and simply copying the domains from mpl to plotly would place axes appropriately. However, this would throw off axis and title labeling. Positional arguments: mpl_plot_bounds -- the (x0, y0, width, height) params for current ax ** mpl_max_y_bounds -- overall (y0, y1) bounds for all axes ** ** these are all specified in mpl figure coordinates rrrr^)r_mpl_max_y_bounds mpl_y_domplotting_heightr r s rconvert_y_domainrhsr0!#_Q%7/!:L%LMI&q),E5> ))rc"|r|ry|r|sy|s|ryy)NticksFr^) main_spine mirror_spines rget_axis_mirrorr sl L Lrc  t|t|k(rlt|dkDr]|dd}|dd}t||Dcgc] \}}||z  }}}|d}t|D cgc]} t|| z |kc} } | r|Syyycc}}wcc} w)Nrr)r,zipr abs) bar_startsbar_endstolsides1sides2s2s1gapsgap0gapuniforms r get_bar_gaprs :#h-'C Oa,?AB#2&)&&&9:FBR::Aw=s4#:,=> K  -@';=s BB c "t}|D]E}|tt|ddzt|ddzt|ddz|dgz }Gt}|D]}|djdi|gz }t |dk(r|dS|S) Nrrr#r)rmgrnazrgba({r},{g},{b},{a})r^)r?dictrIrSr,) color_listclean_color_listc plotly_colorsrgbas rconvert_rgba_arrayr"sv   3qtcz?c!A$*oQqTCZAaD Q   FM B8188@4@AA B =QQrclt}|D]}|t|gz }t|dk(r|dS|SNrr)r?r;r,) path_arraysymbolsr9s rconvert_path_arrayr1sEfG(L&''( 7|qqzrc,t|dk(r|dS|Sr)r,) width_arrays rconvert_linewidth_arrayr;s ;11~rcz|Dcgc]}tj|}}t|dk(r|dS|Scc}wr)r-sqrtr,) size_arrayrDsizes rconvert_size_arrayrBs;", -QDIIaL -D - 4yA~Aw .s8c tdt|ddt|dt|ddt |dj t|dd}|S)Nstylesrpaths linewidthmplobj edgecolor)alpharmarker edgewidth markersizer)rrrrr get_sizes)props markerstyles rget_markerstyle_from_collectionrJsk$U8_[%AB!%.1)%/+*FG%eHo&?&?&AB$U8_[%ABK rcNt|dd|dd|dd|ddS)z.Find minimum x value from four (x,y) vertices.rrr#rr}datas r get_rect_xminrW3 tAwqz471:tAwqz471: >>rcNt|dd|dd|dd|ddS)z.Find maximum x value from four (x,y) vertices.rrr#rr~rs r get_rect_xmaxr\rrcNt|dd|dd|dd|ddS)z.Find minimum y value from four (x,y) vertices.rrr#rrrs r get_rect_yminrarrcNt|dd|dd|dd|ddS)z.Find maximum y value from four (x,y) vertices.rrr#rrrs r get_rect_ymaxrfrrc(|j|}|j}|jxsd}t|tr|dk(rd}n|dk(rd}|\}}|dk(r|dk(rd}nd }|j sy |j d sy |s|ry |r|ry|s|syy ) z8Return some spine parameters for the spine, `spine_key`.)outwardr%center)axesg?zero)rrrrTFr)spines get_frame_on _positionr>str get_visible _edgecolor)ax spine_keyspine ax_frame_onposition position_typeamountspine_frame_likes rget_spine_visiblerks IIi E//#K2"2H(C x $H  "H$M6 !fk        b ! - ) !1rc $|D] }|d|vs yy)zCA test to decide whether a path is a bar from a vertical bar chart.rTFr^)bar_containersr containers ris_barrs'$ ?i ' rc |dt|dt|dt|dt|d|dd|dd|dd|dd|dd|dd d S) aMake an intermediate bar dictionary. This creates a bar dictionary which aids in the comparison of new bars to old bars from other bar chart (patch) collections. This is not the dictionary that needs to get passed to plotly as a data dictionary. That happens in PlotlyRenderer in that class's draw_bar method. In other words, this dictionary describes a SINGLE bar, whereas, plotly will require a set of bars to be passed in a data dictionary. rrstylerrrr dasharrayzorder) barrr rr rrrrrr)rrrr)rs rmake_barrsXE&M*E&M*E&M*E&M*w(7^K07^K07^K07^K0.*  rc t}|dk(r|j}n |dk(r|j}n tS|d|d}|dk(r |d|d}|d}tdt |dz D cgc]} t || || dz z d } } t tdt | dz D cgc]} | | | | dz k(c} r |d|dz } n*tjd j|t ||d <| |d <d |d<n|dk(r |d|dd|d <|d|dd|d|ddz |d <d |d<|jj} | dk(r~|dk(r:tj|ddtj|ddg|d<n{|dk(rvtj|ddtj|ddg|d<nr>r>r>r>r>r>Z) r=Lr@r@r@r@r@r@r@r@r?) r=r@r@r@r@r@r@r@r?)r=r@r@r@r@r@r?)r=r@r@r@r@r?)r=r@r=r@r=r@)r=r@r@r@r?)r=r@r=r@)r=r@r@r?)r=r@z triangle-downz triangle-upz triangle-leftztriangle-rightsquarecrossr3stardiamond) r6rr;<>rDr)r3r7Ddmiddlebottomtop)rbaselinerK)g|=)&__doc__r-rmatplotlib.datesr+rr r5r;r@rQrXr\rcrhrwrrrrrrrrrrrrrrrrr#r r*r8rArZr^rrrOs$ 6 < Q"&(  >>(**2  ? ? ? ? :4Vr,H      9<=@36),$'$'"             (5 Ar