rL ihdZddlmZddlZddlZddlZddlZddlZddl Z ddl m Z m Z m Z mZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z"ddl#m$Z%ddl&m'Z'ddl(m)Z)m*Z*ddl#m+Z+ddl,m-Z-d d l.m/Z/d d l.m0Z0d d l.m1Z1e jde jfd gdgdgdGdde'Z4ddZ5GddZ6y)aR axes3d.py, original mplot3d version by John Porter Created: 23 Sep 2005 Parts fixed by Reinier Heeres Minor additions by Ben Axelrod Significant updates and revisions by Ben Root Module containing Axes3D, an object which can plot 3D objects on a 2D matplotlib figure. ) defaultdictN)_apicbook _docstring_preprocess_data)Axes)_axis_method_wrapper_process_plot_format)Bbox) Triangulation)art3d)proj3d)axis3dxlim3dylim3dzlim3d)xlimylimzlimc eZdZdZdZdZejejd<ejejd< dddd ddd ddd d fd Z dZ dZ dZ dZdZdZeddZeddZdZdfd ZdZdddZddZej4fdZd Zd!Zedd"Zedd#Zd$Z d%Z!dddd d&d'Z"dd(Z#dd)Z$ dd*Z%d+Z& dd,Z'dd-Z(dd.Z)dd/Z*dd ddddd0d1Z+dd ddddd2d3Z,dd ddddd4d5Z-dd ddddd6d7Z.e,Z/e-Z0e.Z1d8Z2d9Z3d:Z4edd;Z5edd=Z7edd=Z8e9d?jtgd\e6_e7_e8_edd@Z;eddAZ<eddBZ=eddCZ>eddDZ?eddEdFdGiHZ@eddIZAeAjr%eAxjeBjdJz c_dKZD ddLZEddMZF ddNdOdPeGdQeHjfdRZJdSZKddTZLdUZMdVZNdWZOdXZPdYZQfdZZRd[ZSd\ZTd]ZUd^ZVd_ZWdd`ZXdaZYdbZZdcZ[dddZ\dee]dfe]dQeHjfdgZ^dhZ_diZ`djZa ddkZbdlZcdmZddnZeddoZfdpZgdZhdZiddqZjdfdr ZkdsZleddtZmduZndddvfdw ZoeoZpejZqdddxfdy ZrerZsddzdddd{d|Ztdddddd}d~ZuddvdZvddddddddZwddZx ddZydddvdZzddZ{e|ddddddfd Z}e}Z~e|ddddddfd ZdZe|ddddfd ZeZe|ddddfd Zdddvfd Ze|gd dddvfd ZeZe|dddvfd Ze| dddvdZdfd Ze|dddddddZeZddd ddddZe|gd ddZdd dddfd Ze|dddd dddddZeZxZS)Axes3Da 3D Axes object. .. note:: As a user, you do not instantiate Axes directly, but use Axes creation methods instead; e.g. from `.pyplot` or `.Figure`: `~.pyplot.subplots`, `~.pyplot.subplot_mosaic` or `.Figure.add_axes`. 3dxyzrviewNirperspT) elevazimroll shareviewsharez proj_type focal_length box_aspectcomputed_zorderc |gd}||_||_||_|j|| | |_t j |_t j |_d}t ||gd|z d|z gg|_ t j |_ |j|j|j|j||_ |&|jdj||d|_||_||jdj||| j#dd r t%d t'|P||g| d | d | t&|U|j-d|_d|_d |_|j5d|_|j9|j;d }|j<j>jAd|jB|j<j>jAd|jD|j<j>jAd|jF|jI|jJjMd|jNjQjSddg}|d|dz \|_*|_+|jXddj[d y)a Parameters ---------- fig : Figure The parent figure. rect : tuple (left, bottom, width, height), default: None. The ``(left, bottom, width, height)`` Axes position. elev : float, default: 30 The elevation angle in degrees rotates the camera above and below the x-y plane, with a positive angle corresponding to a location above the plane. azim : float, default: -60 The azimuthal angle in degrees rotates the camera about the z axis, with a positive angle corresponding to a right-handed rotation. In other words, a positive azimuth rotates the camera about the origin from its location along the +x axis towards the +y axis. roll : float, default: 0 The roll angle in degrees rotates the camera about the viewing axis. A positive angle spins the camera clockwise, causing the scene to rotate counter-clockwise. shareview : Axes3D, optional Other Axes to share view angles with. Note that it is not possible to unshare axes. sharez : Axes3D, optional Other Axes to share z-limits with. Note that it is not possible to unshare axes. proj_type : {'persp', 'ortho'} The projection type, default 'persp'. focal_length : float, default: None For a projection type of 'persp', the focal length of the virtual camera. Must be > 0. If None, defaults to 1. For a projection type of 'ortho', must be set to either None or infinity (numpy.inf). If None, defaults to infinity. The focal length can be computed from a desired Field Of View via the equation: focal_length = 1/tan(FOV/2) box_aspect : 3-tuple of floats, default: None Changes the physical dimensions of the Axes3D, such that the ratio of the axis lengths in display units is x:y:z. If None, defaults to 4:4:3 computed_zorder : bool, default: True If True, the draw order is computed based on the average position of the `.Artist`\s along the view direction. Set to False if you want to manually control the order in which Artists are drawn on top of each other using their *zorder* attribute. This can be used for fine-tuning if the automatic order does not produce the desired result. Note however, that a manual zorder will only be correct for a limited view angle. If the figure is rotated by the user, it will look wrong from certain angles. **kwargs Other optional keyword arguments: %(Axes3D:kwdoc)s N)r+?r,F]tE?r rdatalimrauto_add_to_figureFzSauto_add_to_figure is no longer supported for Axes3D. Use fig.add_axes(ax) instead.T)frameonr(UUUUUU?rootmotion_notify_eventbutton_press_eventbutton_release_eventrrr)r r ). initial_azim initial_elev initial_roll set_proj_typer)r unit xy_viewLim zz_viewLim xy_dataLim zz_dataLim view_init_sharez _shared_axesjoin _adjustable _shareviewpopAttributeErrorsuper__init__ set_axis_off set_axis_onMinvM _view_marginautoscale_view fmt_zdata mouse_init get_figurecanvas callbacks_connect_picklable_on_move _button_press_button_release set_top_viewpatch set_linewidth transLimitsinverted transform _pseudo_w _pseudo_hspines set_visible)selffigrectr!r"r#r$r%r&r'r(r)argskwargsxymargin pseudo_bbox __class__s a/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mpl_toolkits/mplot3d/axes3d.pyrJzAxes3D.__init__<s~ <'D    9l3.))+))+8 4!"Xq8| < >?))+ t(($*;*;T=N=NO     c " ' 'f 5(D #    f % * *4 ; ::*E 2 0    =A #  EK       oo4o( // !4== 2 // $"4"4 6 // "D$8$8 :    #&&//1;;VVrr )r check_in_listrI set_aspect_aspect_equal_aspect_axis_indicesnparrayrget_view_intervalrrvptprEmeanmax _box_aspect enumerate set_xlim3d set_ylim3d set_zlim3d differencerGlinalgnormset_box_aspect)rdrrrr ax_indicesview_intervalsrrscaledeltasiset_limr(remaining_ax_indices remainingold_diagnew_diagrks rlrzAxes3D.set_aspects` M"( * ju  N ? ?88@JXXtzz'C'C'E'+zz'C'C'E'+zz'C'C'E'GHN&&a0C9,ww~A6C Od.>.>z.JJK!1!11"+T__-1__-1__->#?=JAwJQ&)B, 6Q&)B,8N%)t= = XXd&6&67 ),Z :&'0';';J'G$' 4 8 8 :I!yy~~d.>.>z.JKH!yy~~j.DEHy)X-@@)##J/= @rmc^g}|dk(rgd}|S|dk(rddg}|S|dk(rddg}|S|dk(rddg}|S) a Get the indices for which of the x, y, z axes are constrained to have equal aspect ratios. Parameters ---------- aspect : {'auto', 'equal', 'equalxy', 'equalxz', 'equalyz'} See descriptions in docstring for `.set_aspect()`. rrr rrrr rrr)rdrrs rlrz!Axes3D._equal_aspect_axis_indicesMsm W "J y QJ  y QJy QJrmr )zoomcZ|dkrtd|d|tjdt}n2tj|t}t j d||d |ztj j|z z}|j|d |_ d |_ y) a{ Set the Axes box aspect. The box aspect is the ratio of height to width in display units for each face of the box when viewed perpendicular to that face. This is not to be confused with the data aspect (see `~.Axes3D.set_aspect`). The default ratios are 4:4:3 (x:y:z). To simulate having equal aspect in data space, set the box aspect to match your data range in each dimension. *zoom* controls the overall size of the Axes3D in the figure. Parameters ---------- aspect : 3-tuple of floats or None Changes the physical dimensions of the Axes3D, such that the ratio of the axis lengths in display units is x:y:z. If None, defaults to (4, 4, 3). zoom : float, default: 1 Control overall size of the Axes3D in the figure. Must be > 0. rzArgument zoom = z must be > 0N)rdtype)rrg }?Treverse) ValueErrorrasarrayfloatr check_shaperr_roll_to_verticalrrq)rdrrs rlrzAxes3D.set_box_aspectbs0 19/v\BC C >ZZ 7FZZe4F   T& 1 ,t3biinnV6LLL11&$1G rmc||jd}|jj}tjj j |}|j|jz }d}|j}|j|||}|j|j|j|dy)NT)originalr active) get_positionrStransSubfigure mtransformsr r< transformedheightwidthfrozenshrunk_to_aspect _set_positionanchored get_anchor)rdpositiontransbb fig_aspectr(pbpb1s rl apply_aspectzAxes3D.apply_aspects  (($(7H !00    " " $ 0 0 7YY)  __ !!*b*= 3<<(92>IrmcT|jsy|j|jj|d|_|j }|j |r |||nd|j|_tjj|j|_ d|jD}|jrtd|j j#Ddz}|x}}t%|ddD]P}t'|t(j*r ||_|dz }*t'|t.j0sE||_|dz }Rn|D]}|j3|j4r|j j#D]}|j7||j j#D]}|j9||j j#D]}|j|t: | |y)NFc3K|]@}t|tjtjfr|j r|BywN) isinstancemcoll CollectionmpatchesPatch get_visible).0artists rl zAxes3D.draw..s=#&&5#3#3X^^"DE""$ #&sAAc3<K|]}|jywr) get_zorder)rrs rlrzAxes3D.draw..s! E$(!% 1 Esr c"|jSr)do_3d_projection)rs rlzAxes3D.draw..sF4K4K4MrmT)keyr)r_unstale_viewLimr[draw_frameonget_axes_locatorrget_projrMrrinvrN _childrenr)r _axis_mapvaluessortedrrrzorderrrrrp draw_pane draw_gridrI) rdrendererlocatorcollections_and_patches zorder_offsetcollection_zorder patch_zorderrrrks rlrz Axes3D.draws!   ! '') W'$1$GIIMM$&&) #&!%#&     E,0NN,A,A,C EEGHIM/< <   !8%M)-/ &fe&6&67$5FM%*%7$0FM A%L &2 *'') * >>--/ )x( )--/ )x( )--/ $ (# $  Xrmc|j|j}|dd|ddkD}|dd|ddkD}|dd|ddkD}|||fS)Nr rrr)r get_w_lims)rdtcxhighyhighzhighs rlget_axis_positionzAxes3D.get_axis_positionst  # #DOO$5 61a2a58#1a2a58#1a2a58#eU""rmc y)zK Not implemented in `~mpl_toolkits.mplot3d.axes3d.Axes3D`. Nr)rdxysrhs rlupdate_datalimzAxes3D.update_datalims rm_get_autoscale_on_set_autoscale_onc|jS)z Retrieve autoscaling margin of the z-axis. .. versionadded:: 3.9 Returns ------- zmargin : float See Also -------- mpl_toolkits.mplot3d.axes3d.Axes3D.set_zmargin )_zmarginrrs rl get_zmarginzAxes3D.get_zmargins}}rmcb|dkr td||_|jdd|_y)a Set padding of Z data limits prior to autoscaling. *m* times the data interval will be added to each end of that interval before it is used in autoscaling. If *m* is negative, this will clip the data range instead of expanding it. For example, if your data is in the range [0, 2], a margin of 0.1 will result in a range [-0.2, 2.2]; a margin of -0.1 will result in a range of [0.2, 1.8]. Parameters ---------- m : float greater than -0.5 gz margin must be greater than -0.5rTN)rr_request_autoscale_viewrq)rdms rl set_zmarginzAxes3D.set_zmargins3 9?@ @  $$S) rm)rrrtightc|r||| tdt|dk(r |dx}x}}n"t|dk(r|\}}}n |r td|D|B|@|durtjd|d |j|j |j fS||j|||j|||j||j||du|du|du y) z Set or retrieve autoscaling margins. See `.Axes.margins` for full documentation. Because this function applies to 3D Axes, it also takes a *z* argument, and returns ``(xmargin, ymargin, zmargin)``. NzECannot pass both positional and keyword arguments for x, y, and/or z.r rrzYMust pass a single positional argument for all margins, or one for each margin (x, y, z).Tzignoring tight=z in get mode)r$scalexscaleyscalez) TypeErrorlenr warn_external_xmargin_ymarginr set_xmargin set_ymarginr#rP)rdrrrr$marginss rlr0zAxes3D.marginss  !-<= = \Q  "A "A \Q GAq! IJ J 9qyD ""_UI\#JK==$--> > =   Q  =   Q  =   Q  $$TM  rmc|d}d}d}nx|dvr"|j||j}nd}|dvr"|j||j}nd}|dvr"|j ||j }nd}|r|j d||r|j d ||r|j d |yy) a Convenience method for simple axis view autoscaling. See `.Axes.autoscale` for full documentation. Because this function applies to 3D Axes, *axis* can also be set to 'z', and setting *axis* to 'both' autoscales all three axes. NT)rbothF)rr2rr2r)r$rr)set_autoscalex_onget_autoscalex_onset_autoscaley_onget_autoscaley_onset_autoscalez_onget_autoscalez_onr!)rdenablerr$r&r'r(s rl autoscalezAxes3D.autoscale2s >FFF}$&&v.//1}$&&v.//1}$&&v.//1   ( (E ( :   ( (E ( :   ( (E ( : rmctj|tj|k(rY|jjtjtj |tj |g| n:|jj || |jj|| ||jj || |jyr) rshaper?update_from_data_xy column_stackravelupdate_from_data_xupdate_from_data_yr@rP)rdXYZhad_datas rlauto_scale_xyzzAxes3D.auto_scale_xyzUs 88A;"((1+ % OO / /!bhhqk :;\ K OO . .qh, ? OO . .qh, ? = OO . .qh, ? rmc\|k|j}|so|jD]M}t|tjrd} t|t j tjfsKd}nnt|x}|_|r|jr|jj\}}|jj} | j||\}}|j dkDr||z |j z} || z}|| z }|s| j#||\}}|j%|||j&|r|j)r|jj*\} } |j,j} | j| | \} } |j.dkDr| | z |j.z} | | z} | | z } |s| j#| | \} } |j1| | |j&|r|j3r|j4j\}}|j6j}|j||\}}|j8dkDr||z |j8z} || z}|| z }|s|j#||\}}|j;|||j&yyy)z Autoscale the view limits using the data limits. See `.Axes.autoscale_view` for full documentation. Because this function applies to 3D Axes, it also takes a *scalez* argument. NTFr)_tightrrmimage AxesImagemlinesLine2Drrboolr5r?r|rget_major_locator nonsingularr, view_limits set_xboundrOr7r}rr- set_yboundr9r@rvr set_zbound)rdr$r&r'r(rIrx0x1xlocatordeltay0y1ylocatorz0z1zlocators rlrPzAxes3D.autoscale_viewcsm =[[F"nnF!&&*:*:;!%#FV]]HNN,KL!& $(; .FT[ d,,.__..FBzz335H))"b1FB}}q bDMM1e e !--b"5B OOBD$5$5 6 d,,.__..FBzz335H))"b1FB}}q bDMM1e e !--b"5B OOBD$5$5 6 d,,.__..FBzz335H))"b1FB}}q bDMM1e e !--b"5B OOBD$5$5 6/6rmc|j\}}|j\}}|j\}}||||||fS)zGet 3D world limits.) get_xlim3d get_ylim3d get_zlim3d)rdrrrrrrs rlrzAxes3D.get_w_limssE__& d__& d__& dT4tT11rmc |tj|r|\}}|\}}||}||}|t||ft|d|y)z% Set 3D axis bounds. Nrr)riterablerrN) rd get_boundr axis_invertedlowerupperr old_lower old_uppers rl _set_bound3dzAxes3D._set_bound3ds^ =R[[/ LE5({ 9 =E =Eu~tMO/DE{ 4rmcl|j|j|j|j|||y)a Set the lower and upper numerical bounds of the x-axis. This method will honor axis inversion regardless of parameter order. It will not change the autoscaling setting (`.get_autoscalex_on()`). Parameters ---------- lower, upper : float or None The lower and upper bounds. If *None*, the respective axis bound is not modified. view_margin : float or None The margin to apply to the bounds. If *None*, the margin is handled by `.set_xlim`. See Also -------- get_xbound get_xlim, set_xlim invert_xaxis, xaxis_inverted N)rk get_xboundset_xlimxaxis_invertedrdrgrhrs rlrRzAxes3D.set_xbound-, $//4==$:M:M  5rmcl|j|j|j|j|||y)a Set the lower and upper numerical bounds of the y-axis. This method will honor axis inversion regardless of parameter order. It will not change the autoscaling setting (`.get_autoscaley_on()`). Parameters ---------- lower, upper : float or None The lower and upper bounds. If *None*, the respective axis bound is not modified. view_margin : float or None The margin to apply to the bounds. If *None*, the margin is handled by `.set_ylim`. See Also -------- get_ybound get_ylim, set_ylim invert_yaxis, yaxis_inverted N)rk get_yboundset_ylimyaxis_invertedrps rlrSzAxes3D.set_yboundrqrmcl|j|j|j|j|||y)a Set the lower and upper numerical bounds of the z-axis. This method will honor axis inversion regardless of parameter order. It will not change the autoscaling setting (`.get_autoscaley_on()`). Parameters ---------- lower, upper : float or None The lower and upper bounds. If *None*, the respective axis bound is not modified. view_margin : float or None The margin to apply to the bounds. If *None*, the margin is handled by `.set_zlim`. See Also -------- get_zbound get_zlim, set_zlim invert_zaxis, zaxis_inverted N)rk get_zboundset_zlimzaxis_invertedrps rlrTzAxes3D.set_zbounds-* $//4==$:M:M  5rmemitrraxminaxmaxc|0tj|r|\}}n||jd}|||jd}|| td|}|| td|}tj|stj|rt d|d|d|"t jdr |j}nd}||z |z} || z}|| z }|j|||| S) z% Set 3D axis limits. r rz"Cannot pass both 'lower' and 'min'z"Cannot pass both 'upper' and 'max'z Axis limits z, z cannot be infinitezaxes3d.automarginr{r) rrdrr)isinfrmplrcParamsrO_set_lim) rdrrgrhr{rrr|r}rXs rl _set_lim3dzAxes3D._set_lim3ds ={{5!$ u..03 =U]**,Q/E    DEEE    DEEE 88E?bhhuo|E7"UG;NOP P  ||/0"//  +-  }}UE4}@@rm)r{rrxminxmaxc H|j|j|||||||S)aX Set the 3D x-axis view limits. Parameters ---------- left : float, optional The left xlim in data coordinates. Passing *None* leaves the limit unchanged. The left and right xlims may also be passed as the tuple (*left*, *right*) as the first positional argument (or as the *left* keyword argument). .. ACCEPTS: (left: float, right: float) right : float, optional The right xlim in data coordinates. Passing *None* leaves the limit unchanged. emit : bool, default: True Whether to notify observers of limit change. auto : bool or None, default: False Whether to turn on autoscaling of the x-axis. *True* turns on, *False* turns off, *None* leaves unchanged. view_margin : float, optional The additional margin to apply to the limits. xmin, xmax : float, optional They are equivalent to left and right respectively, and it is an error to pass both *xmin* and *left* or *xmax* and *right*. Returns ------- left, right : (float, float) The new x-axis limits in data coordinates. See Also -------- get_xlim set_xbound, get_xbound invert_xaxis, xaxis_inverted Notes ----- The *left* value may be greater than the *right* value, in which case the x-axis values will decrease from *left* to *right*. Examples -------- >>> set_xlim(left, right) >>> set_xlim((left, right)) >>> left, right = set_xlim(left, right) One limit may be left unchanged. >>> set_xlim(right=right_lim) Limits may be passed in reverse order to flip the direction of the x-axis. For example, suppose ``x`` represents depth of the ocean in m. The x-axis limits might be set like the following so 5000 m depth is at the left of the plot and the surface, 0 m, is at the right. >>> set_xlim(5000, 0) rz)rr)rdleftrightr{rrrrs rlrnzAxes3D.set_xlim s2Jtzz4T+6d$P Prm)r{rryminymaxc H|j|j|||||||S)aV Set the 3D y-axis view limits. Parameters ---------- bottom : float, optional The bottom ylim in data coordinates. Passing *None* leaves the limit unchanged. The bottom and top ylims may also be passed as the tuple (*bottom*, *top*) as the first positional argument (or as the *bottom* keyword argument). .. ACCEPTS: (bottom: float, top: float) top : float, optional The top ylim in data coordinates. Passing *None* leaves the limit unchanged. emit : bool, default: True Whether to notify observers of limit change. auto : bool or None, default: False Whether to turn on autoscaling of the y-axis. *True* turns on, *False* turns off, *None* leaves unchanged. view_margin : float, optional The additional margin to apply to the limits. ymin, ymax : float, optional They are equivalent to bottom and top respectively, and it is an error to pass both *ymin* and *bottom* or *ymax* and *top*. Returns ------- bottom, top : (float, float) The new y-axis limits in data coordinates. See Also -------- get_ylim set_ybound, get_ybound invert_yaxis, yaxis_inverted Notes ----- The *bottom* value may be greater than the *top* value, in which case the y-axis values will decrease from *bottom* to *top*. Examples -------- >>> set_ylim(bottom, top) >>> set_ylim((bottom, top)) >>> bottom, top = set_ylim(bottom, top) One limit may be left unchanged. >>> set_ylim(top=top_lim) Limits may be passed in reverse order to flip the direction of the y-axis. For example, suppose ``y`` represents depth of the ocean in m. The y-axis limits might be set like the following so 5000 m depth is at the bottom of the plot and the surface, 0 m, is at the top. >>> set_ylim(5000, 0) rz)rr)rdbottomtopr{rrrrs rlrtzAxes3D.set_ylimh2Jtzz63T+6d$P Prm)r{rrzminzmaxc H|j|j|||||||S)aV Set the 3D z-axis view limits. Parameters ---------- bottom : float, optional The bottom zlim in data coordinates. Passing *None* leaves the limit unchanged. The bottom and top zlims may also be passed as the tuple (*bottom*, *top*) as the first positional argument (or as the *bottom* keyword argument). .. ACCEPTS: (bottom: float, top: float) top : float, optional The top zlim in data coordinates. Passing *None* leaves the limit unchanged. emit : bool, default: True Whether to notify observers of limit change. auto : bool or None, default: False Whether to turn on autoscaling of the z-axis. *True* turns on, *False* turns off, *None* leaves unchanged. view_margin : float, optional The additional margin to apply to the limits. zmin, zmax : float, optional They are equivalent to bottom and top respectively, and it is an error to pass both *zmin* and *bottom* or *zmax* and *top*. Returns ------- bottom, top : (float, float) The new z-axis limits in data coordinates. See Also -------- get_zlim set_zbound, get_zbound invert_zaxis, zaxis_inverted Notes ----- The *bottom* value may be greater than the *top* value, in which case the z-axis values will decrease from *bottom* to *top*. Examples -------- >>> set_zlim(bottom, top) >>> set_zlim((bottom, top)) >>> bottom, top = set_zlim(bottom, top) One limit may be left unchanged. >>> set_zlim(top=top_lim) Limits may be passed in reverse order to flip the direction of the z-axis. For example, suppose ``z`` represents depth of the ocean in m. The z-axis limits might be set like the following so 5000 m depth is at the bottom of the plot and the surface, 0 m, is at the top. >>> set_zlim(5000, 0) rz)rrv)rdrrr{rrrrs rlrxzAxes3D.set_zlimrrmc@t|jjSr)tupler=r|rrs rlget_xlimzAxes3D.get_xlimT__..//rmc@t|jjSr)rr=r}rrs rlget_ylimzAxes3D.get_ylimrrmc@t|jjS)a Return the 3D z-axis view limits. Returns ------- left, right : (float, float) The current z-axis limits in data coordinates. See Also -------- set_zlim set_zbound, get_zbound invert_zaxis, zaxis_inverted Notes ----- The z-axis may be inverted, in which case the *left* value will be greater than the *right* value. )rr>r|rrs rlget_zlimzAxes3D.get_zlims(T__..//rm get_scaler_set_axes_scalera Set the {}-axis scale. Parameters ---------- value : {{"linear"}} The axis scale type to apply. 3D Axes currently only support linear scales; other scales yield nonsensical results. **kwargs Keyword arguments are nominally forwarded to the scale class, but none of them is applicable for linear scales. get_ticklocs set_ticksget_majorticklabelsget_minorticklabelsget_ticklabelsset_ticklabelszAxis.set_tickszAxes3D.set_zticks)doc_sub axis_datez Notes ----- This function is merely provided for completeness, but 3D Axes do not support dates for ticks, and so this may not work as expected. cy)z:Currently not implemented for 3D Axes, and returns *None*.Nr)rdrgrhs rlclabelz Axes3D.clabelCrmcd|_| |j}| |j}| |j}t j t |jDcic]\}}|| c}}|}|r,|jdj|Dchc]}|} }n|g} | D]} || _ || _ || _ || _ ycc}}wcc}w)a Set the elevation and azimuth of the Axes in degrees (not radians). This can be used to rotate the Axes programmatically. To look normal to the primary planes, the following elevation and azimuth angles can be used. A roll angle of 0, 90, 180, or 270 deg will rotate these views while keeping the axes at right angles. ========== ==== ==== view plane elev azim ========== ==== ==== XY 90 -90 XZ 0 -90 YZ 0 0 -XY -90 90 -XZ 0 90 -YZ 0 180 ========== ==== ==== Parameters ---------- elev : float, default: None The elevation angle in degrees rotates the camera above the plane pierced by the vertical axis, with a positive angle corresponding to a location above that plane. For example, with the default vertical axis of 'z', the elevation defines the angle of the camera location above the x-y plane. If None, then the initial value as specified in the `Axes3D` constructor is used. azim : float, default: None The azimuthal angle in degrees rotates the camera about the vertical axis, with a positive angle corresponding to a right-handed rotation. For example, with the default vertical axis of 'z', a positive azimuth rotates the camera about the origin from its location along the +x axis towards the +y axis. If None, then the initial value as specified in the `Axes3D` constructor is used. roll : float, default: None The roll angle in degrees rotates the camera about the viewing axis. A positive angle spins the camera clockwise, causing the scene to rotate counter-clockwise. If None, then the initial value as specified in the `Axes3D` constructor is used. vertical_axis : {"z", "x", "y"}, default: "z" The axis to align vertically. *azim* rotates about this axis. share : bool, default: False If ``True``, apply the settings to all Axes with shared views. N) vertical_axisr)rzr9r8r:r check_getitemr _axis_namesrC get_siblingsr!r"r#_vertical_axis) rdr!r"r#rridxnamesiblingaxesaxs rlrAzAxes3D.view_initGsh <$$D <$$D <$$D**(1$2B2B(C D93T3Y D' ((0==dCEGEDE6D .BBGBGBG -B   . E Es  C  C ctjddg||dk(r(| d}||_y|dkrtd|d||_y|dtj fvrtd|d |tj |_y) a Set the projection type. Parameters ---------- proj_type : {'persp', 'ortho'} The projection type. focal_length : float, default: None For a projection type of 'persp', the focal length of the virtual camera. Must be > 0. If None, defaults to 1. The focal length can be computed from a desired Field Of View via the equation: focal_length = 1/tan(FOV/2) r ortho)r&Nr rzfocal_length = z must be greater than 0z must be None for proj_type = )rrr _focal_lengthrinf)rdr&r's rlr;zAxes3D.set_proj_types GW-C  # ".D " ?<.A2"233!-D D"&&>1 ?<.A99B "EFF!#D rmarrznp.typing.ArrayLikerreturnc|r&tj||jdz dzStj||jdz S)z Roll arrays to match the different vertical axis. Parameters ---------- arr : ArrayLike Array to roll. reverse : bool, default: False Reverse the direction of the roll. r)rr#r)rdrrs rlrzAxes3D._roll_to_verticalsD 773!4!4q!8B >? ?773!4!4q!8: :rmc|j|j}tjg|j |j |j d|i}d|z}tj|j}tj|j}tj|tj|z}tj|tj|z}tj|}|j|||g} ||j| zz} |j| \} } } | |_| |_| |_|j$tj&k(rDtj(| | | | }tj*|j |j}nm||j| z|j$zz}tj(| | | |}tj,|j |j|j$}tj.||}tj.||}|S)z?Create the projection matrix from the current viewing position. pb_aspect?)rrrworld_transformationr`rarbrdeg2radr!r"cossinrz_calc_view_axes_view_u_view_v_view_wrr_view_transformation_uvw_ortho_transformation_persp_transformationdot)rdr(worldMRelev_radazim_radp0p1p2pseyeuvwviewMprojM eye_focalM0rMs rlrzAxes3D.get_projs++D,<,<= ,, __  __  __  !   * ::dii(::dii( VVH x 0 0 VVH x 0 0 VVH  # #RRL 1$**r/!&&s+1a       '33Aq!SAE00$**djjIEDJJOd.@.@@@I33Aq!YGE00$**15151C1CEE VVE6 " FF5" rmcd|_tj|j|_tj|j|_tj|j|_y)a Set the mouse buttons for 3D rotation and zooming. Parameters ---------- rotate_btn : int or list of int, default: 1 The mouse button or buttons to use for 3D rotation of the Axes. pan_btn : int or list of int, default: 2 The mouse button or buttons to use to pan the 3D Axes. zoom_btn : int or list of int, default: 3 The mouse button or buttons to use to zoom the 3D Axes. N)button_pressedr atleast_1dtolist _rotate_btn_pan_btn _zoom_btn)rd rotate_btnpan_btnzoom_btns rlrRzAxes3D.mouse_initsZ#==4;;= g.557 x0779rmc,|jgggy)z > &!&&tU3(()=)=>  EJJUZZejj%2$  @rmc|t||jtjk(rt j d|_nd|_d}t||gd|z d|z gg|_ tj|_ d|_ |j|jt j dy)Nz axes.zmarginr+r-r r1z axes3d.grid)rIclearrrrrrrr r?r<r@rOrPgrid)rdrirks rlrz Axes3D.clearBs      'LL8DMDM8 4!"Xq8| < >?))+   #,,}-.rmcb|j|k(r|j|_|j|jc|_|_|jdjj}|r |j|j|r!|j|j|yyyNTr2)inaxesbuttonrxdataydata_sx_syrSrTtoolbar _nav_stack push_current set_message_mouse_event_to_messagerdeventrs rlrXzAxes3D._button_pressTs <<4 "',,D !&ekk DHdhoo4o077??G7--/7$$&##G$C$CE$JK rmcd|_|jdjj}|r |j |j |r!|j |j|yyr)rrSrTrget_navigate_moderrrrs rlrYzAxes3D._button_release^sf"//t/,33;; t--/7  "     ? ? F G rmc|j|j|j|j|j |j d|j |j|jffS)N)r autoscalex_onr autoscaley_onr autoscalez_on) rr5rr7rr9r!r"r#rrs rl _get_viewzAxes3D._get_viewhsgMMOd6L6L6NMMOd6L6L6NMMOd6L6L6N  IItyy$)) , - -rmcd|\}\}}}|jdi|||_||_||_y)Nr)setr!r"r#)rdrpropsr!r"r#s rl _set_viewzAxes3D._set_viewps9$(!!dD5   rmc |j|S#ttf$r1|jj j }||}|cYSwxYw)z Return *z* string formatted. This function will use the :attr:`fmt_zdata` attribute if it is callable, else will fall back on the zaxis major formatter )rQrHr)rvget_major_formatterformat_data_short)rdrfuncvals rl format_zdatazAxes3D.format_zdataxsP  >>!$ $ * ::113EEDq'CJ s=AAcd}|j|jvr|j}|S|j|j |||}|S)z Return a string giving the current view rotation angles, or the x, y, z coordinates of the point on the nearest axis pane underneath the mouse cursor, depending on the mouse button pressed. )rr_rotation_coordsrM_location_coords)rdxvyvr coordss rl format_coordzAxes3D.format_coordsW    $"2"2 2**,F  VV **2r8 {{EKK1 9 , TXXq488|B NN NN   $"2"2 2Qw27LL!<=Ezz$)),Q$ BFF4L0BqD#:bffTl3JJQ$ BFF4L0BqD#:bffTl3JJyy5(yy5(yy22TYY 499$EFHK'!bSUBqD!12A*Bcll+ABBB$RVVBZ266":bAB"&-- DHHQJ"GK"mmAaC15G((77 WM(G4{1{l7SSF#%::a.@.@.B#C dD!,,T-@-@AM NN+  DJ DMM 1^^--txx.BCFB NN2r1 % MM!T577EGG 4 LLN DNN 2q2vJE  # #E5% 8$( T"))335rmc$|j}|jj||f|j|jfg\\}}\}} ||c|_|_|j|||||z || z } } d} |dk(rd} n|dk(rd} | dk(r| dk(rytj|j|j|jg} | |jz |jz} | jtj| | | gz}|j!\}}}}}}||z |dz}||z |dz}||z |dz}|j#||z||zd|j%||z||zd|j'||z||zdy)Nrrrr rr) _pan_start trans_inverser_rrrrr^rrrrrrrzTrrrr)rdrrrrrPrr xdata_start ydata_startdudvdwrduvw_projectedrrrrrrr4r5r6s rlr_zAxes3D.drag_panfs OO56__5N5NVacc133Z 6"22k"E$( q!V$$ek&9B  #:B CZB 7rQw  HHdllDLL$,,? @ B!! !DJJ .rxxR 55.2__->*dD$dTk^A. .Tk^A. .Tk^A. . r 4"948 r 4"948 r 4"948rmctjtj|j}tjtj|j }d|j |jz}tjd}t|tjdz kDrdnd||j<tj||||\}}}|||fS)z Get the unit vectors for the viewing axes in data coordinates. `u` is towards the right of the screen `v` is towards the top of the screen `w` is out of the screen rrrrr )rrrr"r!r#rrr>rApirr _view_axes) rdrrroll_radrVrrrs rlrzAxes3D._calc_view_axess::e// :;::e// :; $(()9)9: : HHQK'*8}ruuQw'>A$  ##CAx81a!Qwrmc|\}}}} |dk(r3|jjd}|jjd} n7|dk(r2|jjd}|jjd}tjt ||g|jjd|jjd\}}tjt || g|jjd|jjd\}} ||zdz } || zdz } |jjd|jjdzdz } |jjd|jjdzdz } |j | | d|jdd| | |jt||z }t|| z }||jjd|jjdz z }||jjd|jjdz z }t||}|dk(rd|z }|j|||y)z Zoom in or out of the bounding box. Will center the view in the center of the bounding box, and zoom by the ratio of the size of the bounding box to the size of the Axes3D. rr rrrNout) bboxminrrcliprr^r_r`rA_zoom_data_limits)rdr directionmodetwinxtwinystart_xstart_ystop_xstop_y zoom_center_x zoom_center_y ax_center_x ax_center_yr4r5scale_uscale_vrs rl_set_view_from_bboxzAxes3D._set_view_from_bboxs(.2*'66 3;iimmA&GYY]]1%F S[iimmA&GYY]]1%F''&'6):";"&))--"2DIIMM!4DF''&'6):";"&))--"2DIIMM!4DF!6)1,  6)1, yy}}Q'$))--*::A= yy}}Q'$))--*::A=  }mQ7 a{K8 6! " 6! " a(499==+;;< a(499==+;;<GW%  IE ueU3rmcTtj|||g}tj||stj|j|j|j g}|tj dz}tjj|j|zd}|jdvrT|j|j}tjtj||dz }|||||<|j|d|d|dy)a Zoom in or out of a 3D plot. Will scale the data limits by the scale factors. These will be transformed to the x, y, z data axes based on the current view angles. A scale factor > 1 zooms out and a scale factor < 1 zooms in. For an Axes that has had its aspect ratio set to 'equal', 'equalxy', 'equalyz', or 'equalxz', the relevant axes are constrained to zoom equally. Parameters ---------- scale_u : float Scale factor for the u view axis (view screen horizontal). scale_v : float Scale factor for the v view axis (view screen vertical). scale_w : float Scale factor for the w view axis (view screen depth). rr rrrrN)rrallcloserrrrrrrtrrr@rAra) rdrrscale_wrrSax_idxs min_ax_idxss rlrzAxes3D._zoom_data_limitss*'7G45{{5'*$,, dllCDAq !AIINN1337N3E||II99$,,G iiuW~/A(BC !&w !<g a%(E!H=rmc|j\}}}}}} |j|||zdz z |||zdz zd|j|||zdz z |||zdz zd|j|| |zdz z || |zdz zdy)a Keeping the center of the x, y, and z data axes fixed, scale their limits by scale factors. A scale factor > 1 zooms out and a scale factor < 1 zooms in. Parameters ---------- scale_x : float Scale factor for the x data axis. scale_y : float Scale factor for the y data axis. scale_z : float Scale factor for the z data axis. rNrq)r0rrr) rdscale_xscale_yscale_zr1r2r3r4r5r6s rlrazAxes3D._scale_axis_limitss "&!;!;!=BBB RZ\)27 1 +<4H RZ\)27 1 +<4H RZ\)27 1 +<4Hrmc|j\}}}}}}||zdz }||zdz }||zdz } ||z } ||z } ||z } ||| | | | fS)z%Get 3D world centers and axis ranges.r)r) rdrrrrrrr1r2r3r4r5r6s rlr0zAxes3D._get_w_centers_ranges st.2__->*dD$dTk1_Tk1_Tk1_TkTkTk2r2r2%%rmc d|||j_|jj||fi|S)zI Set zlabel. See doc for `.set_ylabel` for description. )rvlabelpadset_label_text)rdzlabelfontdictrrhs rl set_zlabelzAxes3D.set_zlabels4  "*DJJ (tzz((DVDDrmcN|jj}|jS)z. Get the z-label text string. )rvlabelget_text)rdrs rl get_zlabelzAxes3D.get_zlabel#s    ~~rmc :t|rd}||_d|_y)z Set / unset 3D grid. .. note:: Currently, this function does not behave the same as `.axes.Axes.grid`, but it is intended to eventually support that behavior. TN)r* _draw_gridrq)rdvisiblerhs rlrz Axes3D.grid1s v;G! rmc Htjgd||dvrt| |fi||dvrpt |}|j dd|j dd|j dd|j d d|j jd i|yy) ax Convenience method for changing the appearance of ticks and tick labels. See `.Axes.tick_params` for full documentation. Because this function applies to 3D Axes, *axis* can also be set to 'z', and setting *axis* to 'both' autoscales all three axes. Also, because of how Axes3D objects are drawn very differently from regular 2D Axes, some of these settings may have ambiguous meaning. For simplicity, the 'z' axis will accept settings as if it was like the 'y' axis. .. note:: Axes3D currently ignores some of these settings. )rrrr2r)rrr2r3rNrlabeltop labelbottomr)rrrI tick_paramsdictrGrvset_tick_params)rdrrhzkwrks rlrzAxes3D.tick_paramsAs" 2> % % G  / / = v,C GGE4 GGHd # GGJ % GGM4 ( &DJJ & & - - !rmcR|j\}}|j||dy)z Invert the z-axis. See Also -------- zaxis_inverted get_zlim, set_zlim get_zbound, set_zbound Nrq)rrx)rdrrs rl invert_zaxiszAxes3D.invert_zaxis_s%mmo  c6 -rm get_invertedcB|j\}}||kr||fS||fS)z Return the lower and upper z-axis bounds, in increasing order. See Also -------- set_zbound get_zlim, set_zlim invert_zaxis, zaxis_inverted )r)rdrgrhs rlrwzAxes3D.get_zboundns.}} u 5=%< %< rm) axlim_clipc \t ||||fi|}tj|||||S)a Add the text *s* to the 3D Axes at location *x*, *y*, *z* in data coordinates. Parameters ---------- x, y, z : float The position to place the text. s : str The text. zdir : {'x', 'y', 'z', 3-tuple}, optional The direction to be used as the z-direction. Default: 'z'. See `.get_dir_vector` for a description of the values. axlim_clip : bool, default: False Whether to hide text that is outside the axes view limits. .. versionadded:: 3.10 **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.text`. Returns ------- `.Text3D` The created `.Text3D` instance. )rItextr text_2d_to_3d) rdrrrrJzdirrrhrrks rlrz Axes3D.text~s52w|Aq!.v. D!T:6 rm)rrc|j}|r&t|dts|^}}d|vrtd|j dd}t j |||\}}}t | ||g|i|} | D]} tj| |||tj||||\}}}|j||||| S)a Plot 2D or 3D data. Parameters ---------- xs : 1D array-like x coordinates of vertices. ys : 1D array-like y coordinates of vertices. zs : float or 1D array-like z coordinates of vertices; either one for all points or one for each point. zdir : {'x', 'y', 'z'}, default: 'z' When plotting 2D data, the direction to use as z. axlim_clip : bool, default: False Whether to hide data that is outside the axes view limits. .. versionadded:: 3.10 **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.plot`. rr.z,plot() for multiple values for argument 'zs'r.rr) has_datarstrr)rGr_broadcast_with_masksrIplotr line_2d_to_3d juggle_axesrG) rdr,r-rrrgrhrFr.lineslinerks rlrz Axes3D.plots,==?  47C0IBv~ NOOD!$B00R< B R5d5f5 OD   $: N O&&r2r48 B BB1 rmr)wherer facecolorsshaderc tjgd||j} tj||||||\}}}}}}| |j j g} ttj| } |d}nZtj|t}|j|jk7r&td|jd|jd|tj|z}|d k(rot!j"tj$||||ftj$||||ftj$||||fd rd }nd }| |d k(rd} nd} g}tj&|D]\}}|||}|||}|||}|||}|||}|||}t)|s1|d k(rt)|dz }tj*|ddf}tj,|dd|dd|ddf|dddddf<tj,|dd|dd|ddf|dddddf<tj,|dd|dd|ddf|dddddf<tj,|dd|dd|ddf|dddddf<|g|z}|d k(stj,|||f}tj,|ddd|ddd|dddf}tj$||fd}|j/|t!j0|f| | | d| }|j3||j5||g||g||g| |S)a Fill the area between two 3D curves. The curves are defined by the points (*x1*, *y1*, *z1*) and (*x2*, *y2*, *z2*). This creates one or multiple quadrangle polygons that are filled. All points must be the same length N, or a single value to be used for all points. Parameters ---------- x1, y1, z1 : float or 1D array-like x, y, and z coordinates of vertices for 1st line. x2, y2, z2 : float or 1D array-like x, y, and z coordinates of vertices for 2nd line. where : array of bool (length N), optional Define *where* to exclude some regions from being filled. The filled regions are defined by the coordinates ``pts[where]``, for all x, y, and z pts. More precisely, fill between ``pts[i]`` and ``pts[i+1]`` if ``where[i] and where[i+1]``. Note that this definition implies that an isolated *True* value between two *False* values in *where* will not result in filling. Both sides of the *True* position remain unfilled due to the adjacent *False* values. mode : {'quad', 'polygon', 'auto'}, default: 'auto' The fill mode. One of: - 'quad': A separate quadrilateral polygon is created for each pair of subsequent points in the two lines. - 'polygon': The two lines are connected to form a single polygon. This is faster and can render more cleanly for simple shapes (e.g. for filling between two lines that lie within a plane). - 'auto': If the points all lie on the same 3D plane, 'polygon' is used. Otherwise, 'quad' is used. facecolors : list of :mpltype:`color`, default: None Colors of each individual patch, or a single color to be used for all patches. shade : bool, default: None Whether to shade the facecolors. If *None*, then defaults to *True* for 'quad' mode and *False* for 'polygon' mode. axlim_clip : bool, default: False Whether to hide data that is outside the axes view limits. .. versionadded:: 3.10 **kwargs All other keyword arguments are passed on to `.Poly3DCollection`. Returns ------- `.Poly3DCollection` A `.Poly3DCollection` containing the plotted polygons. )rquadpolygon)rNTrz where size (z) does not match size ()rg-q=)atolrrFr rrrrrr)rrr)rrrrr_get_patches_for_fillget_next_colorlistmcolors to_rgba_arrayrrrNsizerisnanr_all_points_on_plane concatenatecontiguous_regionsr*emptyr?r=Poly3DCollectionadd_collectionrG)rdrVrZr]x2y2z2rrrrrrhrFpolysidx0idx1x1iy1iz1ix2iy2iz2i n_polys_ipolys_iline1line2polypolycs rl fill_betweenzAxes3D.fill_betweens| 6TB==?!&!))".."U)RY9O*P*,.."U)RY9O*P*,.."U)RY9O*P/46! =v~2259 #JD$T$-CT$-CT$-CT$-CT$-CT$-Cs8v~HqL ((Iq!#45#%??CHc#2hCR3Q#R1a #%??CGSWc!"g3N#O1a #%??CGSWc!"g3N#O1a #%??CHc#2hCR3Q#R1a  ' *"c38TrTC"Is4R4y(IJ~~uen1= T"1 #4&&uH52<H@FH E" RHr2hR(C rm)rvminvmax lightsourcerc ^ |j} |jdk7r tdtj|}t j |||\}}}|j\} } d| vxsd| v} d| vxsd| v}| r |r td| jdd}| jdd}| jdd }| jdd }tjd r|}n| }|rVttt j| |z d }ttt j| |z d }| jd d }| jdd }| jd|d u}| tdg}| d z |zdk(rK| d z |zdk(r@|>t j|||fDcgc]}tj |||c}d}nt#t%d| d z || d z gz}t#t%d| d z || d z gz}g}t'j(|D]\}}t'j(|D]\}}|||fDcgc]&}tj*|||d z||d zf(} }t j,| j.} |j1| |m|j1|||t3|t j4r#t j6|j9sg}!g}"t'j:||D]n\}#}$t j,|#t j6|#j9d }%t=|%sM|!j1|%|"j1|$p|!}||"}|t?j@|f|||||d| }&n.|rt?j@|fd|i| }&t3|t j4r|djCd}'n8t j,|D cgc]} | d d dfjCc} }'|&jE|'|||&jG||||&jI|nq| jdd }(|(|jJjM}(t j,tOjP|(}(t?j@|f|(|||d| }&|jS|&|jU|||| |&Scc}wcc}wcc} w)a Create a surface plot. By default, it will be colored in shades of a solid color, but it also supports colormapping by supplying the *cmap* argument. .. note:: The *rcount* and *ccount* kwargs, which both default to 50, determine the maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. .. note:: To maximize rendering speed consider setting *rstride* and *cstride* to divisors of the number of rows minus 1 and columns minus 1 respectively. For example, given 51 rows rstride can be any of the divisors of 50. Similarly, a setting of *rstride* and *cstride* equal to 1 (or *rcount* and *ccount* equal the number of rows and columns) can use the optimized path. Parameters ---------- X, Y, Z : 2D arrays Data values. rcount, ccount : int Maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Defaults to 50. rstride, cstride : int Downsampling stride in each direction. These arguments are mutually exclusive with *rcount* and *ccount*. If only one of *rstride* or *cstride* is set, the other defaults to 10. 'classic' mode uses a default of ``rstride = cstride = 10`` instead of the new default of ``rcount = ccount = 50``. color : :mpltype:`color` Color of the surface patches. cmap : Colormap, optional Colormap of the surface patches. facecolors : list of :mpltype:`color` Colors of each individual patch. norm : `~matplotlib.colors.Normalize`, optional Normalization for the colormap. vmin, vmax : float, optional Bounds for the normalization. shade : bool, default: True Whether to shade the facecolors. Shading is always disabled when *cmap* is specified. lightsource : `~matplotlib.colors.LightSource`, optional The lightsource to use when *shade* is True. axlim_clip : bool, default: False Whether to hide patches with a vertex outside the axes view limits. .. versionadded:: 3.10 **kwargs Other keyword arguments are forwarded to `.Poly3DCollection`. r!Argument Z must be 2-dimensional.rstridecstridercountccount.Cannot specify both stride and count argumentsr2_internal.classic_moder rNcmaprzshade cannot be None.rrr) edgecolorsrrrrr).rcolor)rrrr)+rndimrr_to_unmasked_float_arrayrbroadcast_arraysr=rGrrintrceilgetstack_array_patch_perimetersrr? itertoolspairwise_array_perimeterrrtr=rndarrayisfiniteall zip_longestr*rrr set_arrayset_climset_norm _get_linesrrto_rgbarrG))rdrCrDrErrrrrrhrFrowscols has_stride has_countrrrrcompute_stridesfcolorsrrcolsetrNrrow_indscol_indsrsrs_nextcscs_nextr new_polys new_colsetrPcolnew_polyravg_zrs) rl plot_surfacezAxes3D.plot_surfaceMsV==? 66Q;@A A  * *1 -%%aA.1aWW d&(?I,? &<(f*< )MN N**Y+**Y+Hb)Hb) <<0 1(O#-nO #bggdVm4a89G#bggdVm4a89G**\40zz&$' 7DDL1 =45 5 1H 1 $ 1H 1 $ ?HHa)%..q'7C%E E!T!VW56$q&AHE!T!VW56$q&AHE(11(; 7 G#,#5#5h#? 7KB#$Q..qGAIr'!)|1K/LMB "BLL$* gbk"o6 7 7"%,BKK4F4J4J4LIJ $//v> +388A;r{{1~'9'9q'9'ABx=$$X.%%c*  +E"#  **J"(V5'JJBHJE**5RZR6RE%,f ***3E!Bb"QT(--/!BC OOE "4#3tT*t$JJw-E}668HHW__U34E**1"'u+%1)/1E E" Aq!X. Y%\"Cs;T "+T%(T*c R|j}|jdk7r tdtj|||\}}}|j \}}d|vxsd|v} d|vxsd|v} | r | r td|j dd} |j dd} |j dd } |j dd }tjd ra| r| r+tttj|| z dnd } |r+tttj||z dnd } n`| s^| r+tttj|| z dnd } |r+tttj||z dnd } tj|tj|tj|}}}| r0ttd || }|d kDr|d |dz k7r ||dz gz }ng}| r0ttd || }|d kDr|d |dz k7r ||dz gz }ng}| d k(r| d k(r td |jd k(rg}g}|Dcgc]}|| }}|Dcgc]}|| }}|Dcgc]}|| }}|Dcgc]}|| }}|Dcgc]}|| }}|Dcgc]}|| }}t!|||Dcgc]\}}}tt!|||c}}}t!|||Dcgc]\}}}tt!|||c}}}z}t#j$|fd|i|}|j'||j)|||||Scc}wcc}wcc}wcc}wcc}wcc}wcc}}}wcc}}}w)at Plot a 3D wireframe. .. note:: The *rcount* and *ccount* kwargs, which both default to 50, determine the maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Parameters ---------- X, Y, Z : 2D arrays Data values. axlim_clip : bool, default: False Whether to hide lines and patches with vertices outside the axes view limits. .. versionadded:: 3.10 rcount, ccount : int Maximum number of samples used in each direction. If the input data is larger, it will be downsampled (by slicing) to these numbers of points. Setting a count to zero causes the data to be not sampled in the corresponding direction, producing a 3D line plot rather than a wireframe plot. Defaults to 50. rstride, cstride : int Downsampling stride in each direction. These arguments are mutually exclusive with *rcount* and *ccount*. If only one of *rstride* or *cstride* is set, the other defaults to 1. Setting a stride to zero causes the data to be not sampled in the corresponding direction, producing a 3D line plot rather than a wireframe plot. 'classic' mode uses a default of ``rstride = cstride = 1`` instead of the new default of ``rcount = ccount = 50``. **kwargs Other keyword arguments are forwarded to `.Line3DCollection`. rrrrrrrr rrrrz*Either rstride or cstride must be non zeror)rrrrrr=rGrrrrr transposerr?rziprLine3DCollectionrrG) rdrCrDrErrhrFrrrrrrrrtXtYtZriiciirxlinesylineszlinestxlinestylinestzlinesxlylzlrlinecs rlplot_wireframezAxes3D.plot_wireframe sX==? 66Q;@A A%%aA.1aWW d&(?I,? &<(f*< )MN N**Y***Y*Hb)Hb) <<0 1AG#c"''$-"8!<=QAG#c"''$-"8!<=QAG#c"''$-"8!<=QAG#c"''$-"8!<=Q \\!_bll1or||AB uQg./CaxCGq1QxC uQg./CaxCGq1QxC a@@RRs2r2'@$'w#ACCRRRR)CC &&uNNvN E" Aq!X. #%$$&&&@Cs0' M=9 N N N / N N !N!N" )rrrrrrc|j} ||jj}tjt j |}|jdd} |jd| du} tj|i|\} }} |jd} tj| } | j}| j|}| j|}| |}tj |||fd}| rrt#j$|g|d|i|}|dddddfj'd }|j)||||j+|||0|j-|nt#j$|g|| |||d |}|j/||j1| j| j| | |S#t$r|^} }Y?wxYw) a Plot a triangulated surface. The (optional) triangulation can be specified in one of two ways; either:: plot_trisurf(triangulation, ...) where triangulation is a `~matplotlib.tri.Triangulation` object, or:: plot_trisurf(X, Y, ...) plot_trisurf(X, Y, triangles, ...) plot_trisurf(X, Y, triangles=triangles, ...) in which case a Triangulation object will be created. See `.Triangulation` for an explanation of these possibilities. The remaining arguments are:: plot_trisurf(..., Z) where *Z* is the array of values to contour, one per point in the triangulation. Parameters ---------- X, Y, Z : array-like Data values as 1D arrays. color Color of the surface patches. cmap A colormap for the surface patches. norm : `~matplotlib.colors.Normalize`, optional An instance of Normalize to map values to colors. vmin, vmax : float, optional Minimum and maximum value to map. shade : bool, default: True Whether to shade the facecolors. Shading is always disabled when *cmap* is specified. lightsource : `~matplotlib.colors.LightSource`, optional The lightsource to use when *shade* is True. axlim_clip : bool, default: False Whether to hide patches with a vertex outside the axes view limits. .. versionadded:: 3.10 **kwargs All other keyword arguments are passed on to :class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection` Examples -------- .. plot:: gallery/mplot3d/trisurf3d.py .. plot:: gallery/mplot3d/trisurf3d_2.py NrrrErrrrr )rrrr)rrrrrrrrrGr get_from_args_and_kwargsKeyErrorrget_masked_trianglesrrrrrrr rrrrG)rdrrrrrrrgrhrFrrtrir trianglesxtytztvertsrr#s rl plot_trisurfzAxes3D.plot_trisurf sr==? =OO224E/0zz&$' 7DDL1  2 2D CF C T6  3A JJqM,,. UU9  UU9  y\"b"B/ **5L4L6@LDJLE!Q'N''Q'/E OOE "4#3tT*t$**CC$){ ZC;ACE E" CEE355!X6 ; HA sG G&%G&c|jd|jdz dz }g}g}t|jD]a\}}|j|}g|j} |j |} t j | ||z } t j | ||z} t| dsttt| d|z d} t| ddz | dz z }|jtt| dz Dcgc]V}| dt||z| dt|dz|z| dt|dz|z| dt||zfXc}|j| gt| dz zd|jt jtj|||d|j!ycc}w)z4 Extend a contour in 3D by creating r rrT)rrrN)levelsr get_paths_iter_connected_components get_edgecolorr_paths_to_3d_segmentsr*rroundextendr?add_collection3drrrremove)rdcsetstrider6 polyvertscolorsrlevelpathsubpathsrrbotnstepsstepsizers rl_3d_extend_contourzAxes3D._3d_extend_contour s kk!nt{{1~- 2 #DKK0 9JC>>#C(D;88:;H&&(-E--h CC--h CCs1v;s3q6{V34a8FCF aFQJ7H   uV}q013Qa(l+,c!fUAEX;M5N.OQq1u012CF5X;N4OQ3 4 MM5'U6]Q%67 8 9 e44 HHY &> ? 3sAG- cd|z}|r|j||ytj|||n |j||y)Nr!r)rYrcollection_2d_to_3drF)rdrOextend3drProffsetrs rladd_contour_setzAxes3D.add_contour_set sCTz   # #D& 1  % %6#54;;T% 'rmc.|j||||y)Nrr]r)_add_contourf_set)rdrOrr]rs rladd_contourf_setzAxes3D.add_contourf_set s t$v*4  6rmc d|z}|jddtj|jdz z}|jrL|jdtj|jdddz z }tj|d|}|j rK|jdtj|jdddz z}tj ||}tj|||n||||S)z Returns ------- levels : `numpy.ndarray` Levels at which the filled contours are added. r!Nrrrr) rFrdiff _extend_mininsert _extend_maxr=rr[)rdrOrr]r midpoints min_level max_levels rlrazAxes3D._add_contourf_set! sTzKK$rwwt{{';a'??    ARa)AA)EEI )Q :I    B"''$++bc2B*Ca*GGI )Y7I !! v1Vyt! #rm)r\rPrr]rc|j} tj||||\} } }t|| | |g| i| }|j |||||||j |||| |S)a Create a 3D contour plot. Parameters ---------- X, Y, Z : array-like, Input data. See `.Axes.contour` for supported data shapes. extend3d : bool, default: False Whether to extend contour in 3D. stride : int, default: 5 Step size for extending contour. zdir : {'x', 'y', 'z'}, default: 'z' The direction to use. offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to *zdir*. axlim_clip : bool, default: False Whether to hide lines with a vertex outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.contour`. Returns ------- matplotlib.contour.QuadContourSet )rr rotate_axesrIcontourr^rG)rdrCrDrEr\rPrr]rrgrhrFjXjYjZrOrks rlrnzAxes3D.contour8 szD==?&&q!Q5 Bwr2r;D;F; T8VT6:N Aq!X. rmc|j}tj|i|\} }}| j} | j} d|vr|j d} n|^} }t j| | | |\} }}t| || j| j} t|,| |g|i|}|j|||||||j| | | ||S)a Create a 3D contour plot. .. note:: This method currently produces incorrect output due to a longstanding bug in 3D PolyCollection rendering. Parameters ---------- X, Y, Z : array-like Input data. See `.Axes.tricontour` for supported data shapes. extend3d : bool, default: False Whether to extend contour in 3D. stride : int, default: 5 Step size for extending contour. zdir : {'x', 'y', 'z'}, default: 'z' The direction to use. offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to *zdir*. axlim_clip : bool, default: False Whether to hide lines with a vertex outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.tricontour`. Returns ------- matplotlib.tri._tricontour.TriContourSet rE)rr r:rrrGrrmr>maskrI tricontourr^rG)rdr\rPrr]rrgrhrFr=rCrDrErorprqrOrks rlrtzAxes3D.tricontoure sJ==?)BB!!T6 EE EE &= 3AHA&&q!Q5 BBCMM388<w!#r;D;F; T8VT6:N Aq!X. rmcd|d|d|||i}dDcgc]2}tj||tj||f4} }|jg| |ycc}w)Nrrrr)rnanminnanmaxrG) rdrCrDrErrFrFdim_valsdimlimitss rl_auto_scale_contourfzAxes3D._auto_scale_contourf suCCD&9-.99Xc]+RYYx}-EF...V.X..s7Ar`c|j} tj||||\} } } t|| | | g|i|} |j | |||}|j |||||| | S)aG Create a 3D filled contour plot. Parameters ---------- X, Y, Z : array-like Input data. See `.Axes.contourf` for supported data shapes. zdir : {'x', 'y', 'z'}, default: 'z' The direction to use. offset : float, optional If specified, plot a projection of the contour lines at this position in a plane normal to *zdir*. axlim_clip : bool, default: False Whether to hide lines with a vertex outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER *args, **kwargs Other arguments are forwarded to `matplotlib.axes.Axes.contourf`. Returns ------- matplotlib.contour.QuadContourSet )rrrmrIcontourfrar{)rdrCrDrErr]rrgrhrFrorprqrOrFrks rlr}zAxes3D.contourf s|8==?&&q!Q5 BwBrsrI tricontourfrar{)rdrr]rrgrhrFr=rCrDrErorprqrOrFrks rlrzAxes3D.tricontourf s@==?)BB!!T6 EE EE &= 3AHA&&q!Q5 BBCMM388<w"3|j"tj$|j&j)d|inUt|tj*r |j"|j,ddd|int|tj.r t0 |e|} | S)a Add a 3D collection object to the plot. 2D collection types are converted to a 3D version by modifying the object and adding z coordinate information, *zs* and *zdir*. Supported 2D collection types are: - `.PolyCollection` - `.LineCollection` - `.PatchCollection` (currently not supporting *autolim*) Parameters ---------- col : `.Collection` A 2D collection object. zs : float or array-like, default: 0 The z-positions to be used for the 2D objects. zdir : {'x', 'y', 'z'}, default: 'z' The direction to use for the z-positions. autolim : bool, default: True Whether to update the data limits. axlim_clip : bool, default: False Whether to hide the scatter points outside the axes view limits. .. versionadded:: 3.10 rrrFNr)rrrrrtyperPolyCollectionrpoly_collection_2d_to_3d set_sort_zposLineCollectionline_collection_2d_to_3dPatchCollectionpatch_collection_2d_to_3drr(rGr _segments3dr&r_vecPatch3DCollectionrIr) rdr!r.rautolimrrFzvalszsortval collectionrks rlrMzAxes3D.add_collection3d s}<==? b!%*ZZBFF5M  9,, ,  * *32D6@ B   h ' #Y%.. .  * *32D6@ B   h ' #Y%// /  + +CBT7A C   h ' #u556###RXXcoo%>%H%H%J7-57C!7!78###SXXcr]FXFC!8!89 W+C0 rm) r,r-r.rJrr7 facecolorrr) replace_namesc b|j} |} tj|||\}}}tjj |}tj |||||| jdd\}}}}}} | jd| | d<tj| |r|j}t|,||g| ||d| }tj||||||jdkr |jdkDr|j!d|j#|||| |S)a Create a scatter plot. Parameters ---------- xs, ys : array-like The data positions. zs : float or array-like, default: 0 The z-positions. Either an array of the same length as *xs* and *ys* or a single value to place all points in the same plane. zdir : {'x', 'y', 'z', '-x', '-y', '-z'}, default: 'z' The axis direction for the *zs*. This is useful when plotting 2D data on a 3D Axes. The data must be passed as *xs*, *ys*. Setting *zdir* to 'y' then plots the data to the x-z-plane. See also :doc:`/gallery/mplot3d/2dcollections3d`. s : float or array-like, default: 20 The marker size in points**2. Either an array of the same length as *xs* and *ys* or a single value to make all markers the same size. c : :mpltype:`color`, sequence, or sequence of colors, optional The marker color. Possible values: - A single color format string. - A sequence of colors of length n. - A sequence of n numbers to be mapped to colors using *cmap* and *norm*. - A 2D array in which the rows are RGB or RGBA. For more details see the *c* argument of `~.axes.Axes.scatter`. depthshade : bool, default: True Whether to shade the scatter markers to give the appearance of depth. Each call to ``scatter()`` will perform its depthshading independently. axlim_clip : bool, default: False Whether to hide the scatter points outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER **kwargs All other keyword arguments are passed on to `~.axes.Axes.scatter`. Returns ------- paths : `~matplotlib.collections.PathCollection` rN)rJr7)r.r depthshader皙?r)rrrrmar@delete_masked_pointsrmay_share_memorycopyrIscatterrrrrr#rG)rdr,r-r.rrJr7rrrgrhrFzs_origrpatchesrks rlrzAxes3D.scatterH s'n==?00R< B EEKKN"'"<"< B1fjj$7#BAq% ::g  *#F7O   w +B'/"bDTDADVD ''BT3=3= ? ==4 BGGaK   T " BB1rmc4|j}t|||g|i|} tj|t |d}g} g} t | |D]p\} } tj| }| |jz } | | gt |zz } tj| | ||d|vs]| j|drt | dkDr t | \}}ngg}}tj||| |\}}} |j||| || S)a Add 2D bar(s). Parameters ---------- left : 1D array-like The x coordinates of the left sides of the bars. height : 1D array-like The height of the bars. zs : float or 1D array-like, default: 0 Z coordinate of bars; if a single value is specified, it will be used for all bars. zdir : {'x', 'y', 'z'}, default: 'z' When plotting 2D data, the direction to use as z ('x', 'y' or 'z'). axlim_clip : bool, default: False Whether to hide bars with points outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER **kwargs Other keyword arguments are forwarded to `matplotlib.axes.Axes.bar`. Returns ------- mpl_toolkits.mplot3d.art3d.Patch3DCollection T)subokalphar)rrIbarr broadcast_tor*r'r_get_patch_vertsrpatch_2d_to_3d set_alpharrG)rdrrr.rrrgrhrFrrBverts_zsrPrvsr,r-rks rlrz Axes3D.bar s>==?'+dF%[FBB ,,RXtDB BHh7rmc  |j}tjtj||||||\}}}}}}tj|}tj ||z}tj|}tj ||z}tj|}tj ||z}tj gd}tj|j|jz}d||fd||fd||ffD]`\}}}|dtjtjf}|dtjtjf}|||d|fzz|d|f<b|jd|jddz}g}||jjg}ttj|}t!|t!|k(r|D]}|j#|gdzn*|}t!|t!|kr|dt!|zz}t%j&|g| ||| | | d | }|j)||j+||f||f||f||S) aR Generate a 3D barplot. This method creates three-dimensional barplot where the width, depth, height, and color of the bars can all be uniquely set. Parameters ---------- x, y, z : array-like The coordinates of the anchor point of the bars. dx, dy, dz : float or array-like The width, depth, and height of the bars, respectively. color : sequence of colors, optional The color of the bars can be specified globally or individually. This parameter can be: - A single color, to color all bars the same color. - An array of colors of length N bars, to color each bar independently. - An array of colors of length 6, to color the faces of the bars similarly. - An array of colors of length 6 * N bars, to color each face independently. When coloring the faces of the boxes specifically, this is the order of the coloring: 1. -Z (bottom of box) 2. +Z (top of box) 3. -Y 4. +Y 5. -X 6. +X zsort : {'average', 'min', 'max'}, default: 'average' The z-axis sorting scheme passed onto `~.art3d.Poly3DCollection` shade : bool, default: True When true, this shades the dark sides of the bars (relative to the plot's source of light). lightsource : `~matplotlib.colors.LightSource`, optional The lightsource to use when *shade* is True. axlim_clip : bool, default: False Whether to hide the bars with points outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER **kwargs Any additional keyword arguments are passed onto `~.art3d.Poly3DCollection`. Returns ------- collection : `~.art3d.Poly3DCollection` A collection of three-dimensional polygons representing the bars. ))rrrrr rr r rr rr)rrr r rr r r r rr r )rrrr)rrrr)rrrr)rrrrrr r.)rN)zsortrrrr)rrrrrrrrr=newaxisreshaperrrrrr*rLrrrrG)rdrrrr4r5r6rrrrrrgrhrFrrrrrrcuboidrrrPdprr7r!s rlbar3dz Axes3D.bar3d sqH==? 11 MM! aBB01aRvvayvva"f~vvayvva"f~vvayvva"f~ + + \6<</0QaBZ!Q< 4HAq"#rzz2::-.ACRZZ/0BVCF^ 33E#q&M 4  eekk!"o56 =//>>@AEW**512 u:Q  +!!1#'* +J:Q'q3q6z* $$U6 '+ 6+00:+01<0: 6 /5 6 C  T4L4,t hO rmc t||f||d|}|jj\}}|jj d|z|S)N)rrEgq= ףp?)rI set_titletitlerset_y) rdrrrErhretrrrks rlrzAxes3D.set_title sOgLcLVL((*A " rmg333333?tail)lengtharrow_length_ratiopivot normalizerc d} |j}tj||||||d}td|Dr)t j gfi| }|j ||Stjd|gt}||z}tjgd| | d k(r||z}n | d k(r||d z z}tj|d d }tj|d d jt}| r=tjj|d}d||dk(<||j!dz }t#|dkDr|tj$j'||z j)dd}| |}|d d d dftj$j'||z }|j!t#|dd f}|j)dd}g||d d d |dd d }ng}t j |fd| i| }|j ||j+|d d df|d d df|d d d f||S)a Plot a 3D field of arrows. The arguments can be array-like or scalars, so long as they can be broadcast together. The arguments can also be masked arrays. If an element in any of argument is masked, then that corresponding quiver element will not be plotted. Parameters ---------- X, Y, Z : array-like The x, y and z coordinates of the arrow locations (default is tail of arrow; see *pivot* kwarg). U, V, W : array-like The x, y and z components of the arrow vectors. length : float, default: 1 The length of each quiver. arrow_length_ratio : float, default: 0.3 The ratio of the arrow head with respect to the quiver. pivot : {'tail', 'middle', 'tip'}, default: 'tail' The part of the arrow that is at the grid point; the arrow rotates about this point, hence the name *pivot*. normalize : bool, default: False Whether all arrows are normalized to have the same length, or keep the lengths defined by *u*, *v*, and *w*. axlim_clip : bool, default: False Whether to hide arrows with points outside the axes view limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER **kwargs Any additional keyword arguments are delegated to :class:`.Line3DCollection` c R|dddf}|dddf}tjj|ddddfd}tj|||dk7tj|}tj| ||dk7tj |}t jd}t j|}t j|}||z} ||z} ||zd|z z} tj||dzd|z zz| | g| ||dzd|z zz| g| | tj||gg} | j} | gdgdfxxd zcc<tjd | |}tjd | |}tj||gdS) Nrr rr)rr)rr rr)rrrr rzij...,...j->...i)rrrdivide zeros_like ones_likemathradiansrrr full_likereinsumr)UVWrrrx_py_prangler7rJr13r32r12RposRneg Rpos_vecs Rneg_vecss rl calc_arrowsz"Axes3D.quiver..calc_arrows sAqD AAqD A99>>#a!e*1>5D))At419"--:JKC))QBTQYBLLOLC\\"%F A A'C'C)q1u%C88saxAE**C5qC1HQ//#6$R\\#q1245D 99;D |+ , 2 , "4dC@I "4dC@I88Y 2; ;rmT)compressc38K|]}t|dk(yw)rN)r*)rrs rlrz Axes3D.quiver.. s/qs1v{/sr+r)rmiddletip)rrrrNrr rr)rr rr)rrranyrr(rrrrrrr?astyperrrr*multiplyouterswapaxesrG)rdrCrDrEUrWrrrrrrhrrF input_argsr7shaft_dtarrow_dtXYZrrshafts head_dirsheadsrs rlquiverz Axes3D.quiver sC` <8==?00Aq!Q:>@  /J/ /**288E    &L88RL600 4EB F?  H h   "Hooj!n-oojn-44U; 99>>#A>.DDO W--C s8a<BKK--h<<FFq!LF#C(I1bqb5MBKK$5$5h $JJEMM3x="a"89ENN1a(E8f8uSqSz8E!$Q$K8EE&&uNNvN E" C1Is1a4y#ad)XF rmrrrrrc 23t|dk\rd}nd}||i|\} 3}3jdk7r tdtj3j tj } t| dz2| tj2\} } } n2fd| D\} } } 3fd }||jj}||d }||d }|j| | | tjgd gd gdgdgtj }tt}d}|dD]}|jj| \}}}tj |}tj |}tj |}|j|j}|ddd}|D];}|D]2}|j||dg}t|}3|r||j#||zt%j&|D]\}} |j|||g}!|j||| g}"t|!}#t|"}$3|#r3|$s||#j#|"|zf3|#rl3|$sr||$j#|"|z|j|||dz g}%|j|||g}&t|%}'3|'s||'j#|&|z5>i}(|j)D]\})}*| |*}+nwg}+|*D]p},|,dddf|,dddf|,dddff}-tj*|,j }.| |-|.dddf<| |-|.dddf<| |-|.dddf<|+j#|.r||)}/||)}0t-j.|+f|/|0|||d|}1|j1|1|1|(|)<|(S)a/ ax.voxels([x, y, z,] /, filled, facecolors=None, edgecolors=None, **kwargs) Plot a set of filled voxels All voxels are plotted as 1x1x1 cubes on the axis, with ``filled[0, 0, 0]`` placed with its lower corner at the origin. Occluded faces are not plotted. Parameters ---------- filled : 3D np.array of bool A 3D array of values, with truthy values indicating which voxels to fill x, y, z : 3D np.array, optional The coordinates of the corners of the voxels. This should broadcast to a shape one larger in every dimension than the shape of *filled*. These can be used to plot non-cubic voxels. If not specified, defaults to increasing integers along each axis, like those returned by :func:`~numpy.indices`. As indicated by the ``/`` in the function signature, these arguments can only be passed positionally. facecolors, edgecolors : array-like, optional The color to draw the faces and edges of the voxels. Can only be passed as keyword arguments. These parameters can be: - A single color value, to color all voxels the same color. This can be either a string, or a 1D RGB/RGBA array - ``None``, the default, to use a single color for the faces, and the style default for the edges. - A 3D `~numpy.ndarray` of color names, with each item the color for the corresponding voxel. The size must match the voxels. - A 4D `~numpy.ndarray` of RGB/RGBA data, with the components along the last axis. shade : bool, default: True Whether to shade the facecolors. lightsource : `~matplotlib.colors.LightSource`, optional The lightsource to use when *shade* is True. axlim_clip : bool, default: False Whether to hide voxels with points outside the axes view limits. .. versionadded:: 3.10 **kwargs Additional keyword arguments to pass onto `~mpl_toolkits.mplot3d.art3d.Poly3DCollection`. Returns ------- faces : dict A dictionary indexed by coordinate, where ``faces[i, j, k]`` is a `.Poly3DCollection` of the faces drawn for the voxel ``filled[i, j, k]``. If no faces were drawn for a given voxel, either because it was not asked to be drawn, or it is fully occluded, then ``(i, j, k) not in faces``. Examples -------- .. plot:: gallery/mplot3d/voxels.py .. plot:: gallery/mplot3d/voxels_rgb.py .. plot:: gallery/mplot3d/voxels_torus.py .. plot:: gallery/mplot3d/voxels_numpy_logo.py rc|||f||fSrr) _Axes3D__x _Axes3D__y _Axes3D__zfilledrhs rlvoxelszAxes3D.voxels..voxelsX sS#66rmc d||fSrr)rrhs rlrzAxes3D.voxels..voxels[ sVV++rmz%Argument filled must be 3-dimensionalrr Nc3JK|]}tj|ywr)rr)rr7 coord_shapes rlrz Axes3D.voxels..j sD1rq+6Ds #cVtj|dvr6tj|jtj|zStj|dvr6tj|ddjk7rt d|d|St d|d)N)rr )rrrzWhen multidimensional, z must match the shape of filledzInvalid z argument)rrrr=r)rrrs rl_broadcast_color_argz+Axes3D.voxels.._broadcast_color_argl swwu~'ufllRXXe_.LMM6)88E?2A&&,,6$1$8$$%%  8D6!;<.permutation_matrices sD&&"''*C1X . ggc11- .sAArrrr)r*rrrrr=rrindicesrrrGrrrtraranger=rritemsrrrrM)4rdrrrrrrgrhrxyzrrrrrsquare voxel_facesrpermutepcqcrcpindsqindsrindssquare_rot_possquare_rot_negrPrgri0r1rLrri1i2pkpk2ikpolygonscoord faces_indsfaces face_indsindfacer edgecolorrrrs4 @@rlrz Axes3D.voxels sX t9> 7 ,%d5f5VV ;;! DE Exx BGG4D1Ho ;jj-GAq!DDGAq! =  33BBDJ)*lC **lC  Aq!$       "$'  .,A.) EG t,JBBIIbMEIIbMEIIbME#ZZ 2N+DbD1N EEA !aAY/BrBbz#B..rN/BC#,"4"4U"; HB$[[!Q4$[[!Q4"2Y"2Y!":fRj'O2223FG!'r 'O2223FG H!aBqD\2B!++q!Rj1CrBbz#B..s^/CD;E E) EZ!,!2!2!4 # E:{"!+'I#AqD/9QT?IadOKC88IOO4D!"3DAJ!"3DAJ!"3DAJLL& '#5)I"5)I))"+ D  ! !$ '"HUO/ #2rm)rrrxerryerrzerrc MN|j}tj|tj}|j Dcic] \}}| || }}}|j dd|jd|fd|fd|fg|dtj|r|n|g}tj|r|n|g}tj|r|n|g}t|t|cxk(rt|k(std td |j|| M|jd d}d |d <|jj||d k(r||fn|||f|d \\}}t!j"||||r|j%|ddz n|j%|ddz|j'dk7r|j)|nd}|jdd|vrd|d<| |d} dD]}|j|di|d| i}| r| |d<n d|vr|d|d<dD]}||vs||||<i|ddi}| t*j,d} | dkDrd| z|d<| | |d<| |d<d}Mfd} ggg}#}"}!g}$d d d!d"}%dd#dd$N|j/dt*j,d%dz}&|&|j1d &j2d'z z}&|j4j7j9d(|&|&fg}&tj:tj<|&d)}&tj>|ddd*5tj@jC|jE}'dddtjF'|&dddgd#}&|&d+z}&i||&d#d,}(|(jddtIgd$|||g|||g|||g|||gD]\})}*}+},}-t!jJ|)}.N|)}/|+'tj|+s|+gt|*z}+tjL|+}+tjN|,t|*jQtR},tjN|-t|*jQtR}-tU|||gD01cgc]\}0}1| |+|.|0z|1|,|-}2}0}1|2\\}3}4\}5}6\}7}8|,|-z}9|9jWr| dkDr||3|5|7g|9Mz}:||4|6|8g|9Mz};t!jX|:d |%|/|d-|}}?}@|j\|>|?|@g|.i|(|-jWr,||3|5|7g|-Mz\}A}B}C|j\|A|B|Cg|. i|(t!j^tj`|2jbfd.|i|}D|je|D|!j[|D|$j[|2tj`|$}$Nfd/}E|E|$d\}F}G|E|$d\}H}I|E|$d\}J}K|jg|F|Gf|H|If|J|Kf|tijj|tm|"tm|!f|duxs|du|du|0}L|jnj[|L|!|"|#fScc}}w#1swYxYwcc}1}0w)1ag Plot lines and/or markers with errorbars around them. *x*/*y*/*z* define the data locations, and *xerr*/*yerr*/*zerr* define the errorbar sizes. By default, this draws the data markers/lines as well the errorbars. Use fmt='none' to draw errorbars only. Parameters ---------- x, y, z : float or array-like The data positions. xerr, yerr, zerr : float or array-like, shape (N,) or (2, N), optional The errorbar sizes: - scalar: Symmetric +/- values for all data points. - shape(N,): Symmetric +/-values for each data point. - shape(2, N): Separate - and + values for each bar. First row contains the lower errors, the second row contains the upper errors. - *None*: No errorbar. Note that all error arrays should have *positive* values. fmt : str, default: '' The format for the data points / data lines. See `.plot` for details. Use 'none' (case-insensitive) to plot errorbars without any data markers. ecolor : :mpltype:`color`, default: None The color of the errorbar lines. If None, use the color of the line connecting the markers. elinewidth : float, default: None The linewidth of the errorbar lines. If None, the linewidth of the current style is used. capsize : float, default: :rc:`errorbar.capsize` The length of the error bar caps in points. capthick : float, default: None An alias to the keyword argument *markeredgewidth* (a.k.a. *mew*). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For backwards compatibility, if *mew* or *markeredgewidth* are given, then they will over-ride *capthick*. This may change in future releases. barsabove : bool, default: False If True, will plot the errorbars above the plot symbols. Default is below. xlolims, ylolims, zlolims : bool, default: False These arguments can be used to indicate that a value gives only lower limits. In that case a caret symbol is used to indicate this. *lims*-arguments may be scalars, or array-likes of the same length as the errors. To use limits with inverted axes, `~.set_xlim`, `~.set_ylim`, or `~.set_zlim` must be called before `errorbar`. Note the tricky parameter names: setting e.g. *ylolims* to True means that the y-value is a *lower* limit of the True value, so, only an *upward*-pointing arrow will be drawn! xuplims, yuplims, zuplims : bool, default: False Same as above, but for controlling the upper limits. errorevery : int or (int, int), default: 1 draws error bars on a subset of the data. *errorevery* =N draws error bars on the points (x[::N], y[::N], z[::N]). *errorevery* =(start, N) draws error bars on the points (x[start::N], y[start::N], z[start::N]). e.g. *errorevery* =(6, 3) adds error bars to the data at (x[6], x[9], x[12], x[15], ...). Used to avoid overlapping error bars when two series share x-axis values. axlim_clip : bool, default: False Whether to hide error bars that are outside the axes limits. .. versionadded:: 3.10 Returns ------- errlines : list List of `~mpl_toolkits.mplot3d.art3d.Line3DCollection` instances each containing an errorbar line. caplines : list List of `~mpl_toolkits.mplot3d.art3d.Line3D` instances each containing a capline object. limmarks : list List of `~mpl_toolkits.mplot3d.art3d.Line3D` instances each containing a marker with an upper or lower limit. Other Parameters ---------------- data : indexable object, optional DATA_PARAMETER_PLACEHOLDER **kwargs All other keyword arguments for styling errorbar lines are passed `~mpl_toolkits.mplot3d.art3d.Line3DCollection`. Examples -------- .. plot:: gallery/mplot3d/errorbar3d.py NrrrrrF)convertz)'x', 'y', and 'z' must have the same sizer _nolegend_rT) return_kwargs)r.rg?nonerC0) marker markersizemarkerfacecolormarkeredgewidthmarkeredgecolor markevery linestyle fillstyle drawstyle dash_capstyledash_joinstylesolid_capstylesolid_joinstyle linewidth)r_rr rasterizedr(Nonezerrorbar.capsizerrr#r%cX|Dcgc]}gtj||c}Scc}wr)rr)arraysrsrs rl _apply_maskz$Axes3D.errorbar.._apply_masks-EKK56i((56K KKs'ct|jdk(r|\}}n||}}tj|z|||z }tj|z|||z}||fS)Nr)r*r=rr) errdatalomaskhimasklow_errhigh_errlowshighs everymasks rl _extract_errsz&Axes3D.errorbar.._extract_errssj399~"$'!$'88FiZ/tg~FDHHVyj0$xHE; rm|_rr rzlines.markersizer2Hr7r)r!r"r#gV&,t=?)rr)lsr"rrc tj|dd|ddddftj|dd|ddddffSr)rrvrw)err_arr coord_labeli_xyzs rl_digout_minmaxz'Axes3D.errorbar.._digout_minmaxsMIIga{);Q&ABCIIga{);Q&ABCE Erm)has_xerrhas_yerrr)8rrnormalize_kwargsrLrMr setdefault_process_unit_inforrdr*r_errorevery_to_maskrGr _plot_argsrr set_zorderrgadd_linerrrrSdpi transAxesr^r_rre _setattr_cmrrrrr'get_dir_vectorrrrrNrrLine3Dr=rr(rrtrrG mcontainerErrorbarContainerr containers)Ordrrrrrrfmt barsabove erroreveryecolor elinewidthcapsizecapthickxlolimsxuplimsylolimsyuplimszlolimszuplimsrrhrFrhrr data_line base_stylereb_lines_style eb_cap_styler4r?errlinescaplineslimmarks coorderrs capmarker quiversizerNeb_quiver_stylerr7r6lolimsuplims dir_vectori_zdirrrcoorderrr4xhr5yhr6zhnolims lo_caps_xyz hi_caps_xyzcap_locap_hixh0yh0zh0xl0yl0zl0errlinerHrrrrrrerrorbar_containerr>rGsO @@rlerrorbarzAxes3D.errorbar sb==?'' >#)<<>C41aQ]!Q$CC(A& #qC8c1X >(-  / QAaSQAaSQAaS1vQ)3q6)HI I*HI I,,Q ;  7D)&w $(??#=#= C2I1a&Aq#;d$>$T J I! C   !1B!6 7  !1B!6 7 99;& MM) $I NN7 # * $"&Jw  >(FK &C NN3 %  &9J88 *4N; ' F "*0*=N; 'A 2Cf}&,Sks# 2 ;*:k6: ?ll#56G Q;)+gL &  .6L* + & W L (*2rH( , aa("%%l&)ll3E&FHKLM doo4o044r99 ^^,,.88 Z,:./ WWRWWZa89   t!!! < 299==1D 2VVD:q!Q"78;  (( J\J%/qJL$/03!QT4,>'7+gw-H0J< ' +D$VV--d3J4[F{;;s#ec$i'--$C__VSY7>>tDF__VSY7>>tDF!*1a) 46AucJqM15&&I6H6,4 (HRhr2R'Fzz|! )2r2,8JK )2r2,8JK {r-6v->1;6)56{r-6v->1;6)56 f% f%''zz| +RRL&9:L M S# CcJJJ/Jzz| +RRL&9:L M S# CcKZKK?K,,RXXh-?-A-A?8B?/=?G    ( OOG $   X &y< '|HHY'  E$Is3 d#Is3 d#Is3 d T4L4,t hO(99 hx 9$&:$d*:$&  128++mDn 2 2H6s \-\-.\39]3\=call_axes_locatorbbox_extra_artistsfor_layout_onlyc:t |||||}|g}|jrZ|jj D]=}|j st j||}|s-|j|?tjj|S)Nr) rI get_tightbboxrprrrmartist_get_tightbbox_for_layout_onlyr=rr union) rdr rrrrbatchraxis_bbrks rlrzAxes3D.get_tightbbox.sg#H6G7I4C$E >>--/ .##%%DDh(G W-  . %%e,,rmzC0-C0ozC3-)linefmt markerfmtbasefmtrr orientationrc ddlm} |j} tjgd| t j |t j|f} t j |t j|f}t j |t j|f}| dk(r3||}}||}}t|||Dcgc]\}}}|||f|||fg}}}}nj| dk(r3|| }}||}}t|||Dcgc]\}}}|||f|||fg}}}}n2|| }}||}}t|||Dcgc]\}}}|||f|||fg}}}}t|\}}}|tjd}|j||||| d \}tj|||d| }|j||j||||d \}| |||f| }|j!|tj"||||g| \}} }!|j%g|| g| |g|!|| |Scc}}}wcc}}}wcc}}}w) a Create a 3D stem plot. A stem plot draws lines perpendicular to a baseline, and places markers at the heads. By default, the baseline is defined by *x* and *y*, and stems are drawn vertically from *bottom* to *z*. Parameters ---------- x, y, z : array-like The positions of the heads of the stems. The stems are drawn along the *orientation*-direction from the baseline at *bottom* (in the *orientation*-coordinate) to the heads. By default, the *x* and *y* positions are used for the baseline and *z* for the head position, but this can be changed by *orientation*. linefmt : str, default: 'C0-' A string defining the properties of the vertical lines. Usually, this will be a color or a color and a linestyle: ========= ============= Character Line Style ========= ============= ``'-'`` solid line ``'--'`` dashed line ``'-.'`` dash-dot line ``':'`` dotted line ========= ============= Note: While it is technically possible to specify valid formats other than color or color and linestyle (e.g. 'rx' or '-.'), this is beyond the intention of the method and will most likely not result in a reasonable plot. markerfmt : str, default: 'C0o' A string defining the properties of the markers at the stem heads. basefmt : str, default: 'C3-' A format string defining the properties of the baseline. bottom : float, default: 0 The position of the baseline, in *orientation*-coordinates. label : str, optional The label to use for the stems in legends. orientation : {'x', 'y', 'z'}, default: 'z' The direction along which stems are drawn. axlim_clip : bool, default: False Whether to hide stems that are outside the axes limits. .. versionadded:: 3.10 data : indexable object, optional DATA_PARAMETER_PLACEHOLDER Returns ------- `.StemContainer` The container may be treated like a tuple (*markerline*, *stemlines*, *baseline*) Examples -------- .. plot:: gallery/mplot3d/stem3d_demo.py r) StemContainerr)rrrzlines.linestyler)r.rr) linestylesrRrr)r)matplotlib.containerrrrrrrrr'r rrrrr(r add_containerrrG)"rdrrrrrrrrrrrrFrrrbasexbasexlimbaseybaseylimthisxthisythiszrr( linemarker linecolorbaseline stemlines markerlinestem_containerjxjyjzs" rlstemz Axes3D.stem>sN 7==? ? Dq 266!9%q 266!9%q 266!9% # 8E8E03Aq! >>,uue,ueU.CD>E> C 8E8E03Aq! >>,ufe,ueU.CD>E> 8E8E03Aq! >>,ueV,ueU.CD>E>,@+H( :y   %67IIIeUG#.lD ** i !#  I&ii1a,iG & Ix'H-24 >*&&xFF;K'24 B LbL4L,B,, " t hOG> > >s H.H57H<r)NNF)Tr2N)NN)NTTT)NNN)NNNrF)F)r rr)inNFF)T)r2)rD)FrDrNF)rN)rNF)rrT)rrNT)rr)NaverageTN)Ncenter)NNNrFr NNNNFFFFFFF)__name__ __module__ __qualname____doc__rrrGrouperrrCrJrKrLrxrZrrr get_zgridlinesget_zticklinesrrrrrrallow_rasterizationrrrr9r8rr#r0r;rGrPrrkrRrSrTrrnrtrxrrrrrr get_zscale set_xscale set_yscale set_zscalemapformat get_zticks set_zticksget_zmajorticklabelsget_zminorticklabelsget_zticklabelsset_zticklabels zaxis_datetextwrapdedentrrAr;rNrr rrrRrrrr%r$rrXrYr rrrrrr9r(rrRrWr_rrrrar0rr get_frame_on set_frame_onrrrryrwrtext3Dtext2Drplot3Drr$r8rCrYr^rbrarrn contour3Drtr{r} contourf3DrrMr scatter3Drrrrquiver3Drrrrstem3D __classcell__)rks@rlrr)sw D!K*U]]_Dc - DfD* cT$ D*L+ ( *'?CN)'?CN 1T0l*./'RJ"   9!9v# -W6IJ,W6IJ ,#'$$d" H!;F $(8<97v2:>4"525250At4t4A@FPd!4FPPFPd!4FPPFPd!4FPPJJJ000,&g{;J&g/@AJ%g/@AJ%g/@AJAD  FB>J *J,> &g~>J%g{;J/9NO/9NO*74DEO*!!#679O&g{;Johoo/   HKK.Z(:;@;(;37; ;$9v:*@/&@"/$LH- "  #J%EbjjB\6|"9H,37:?.4`$>LI. &E LL .< .*'>BN :F YYF'*u*XF fT %B-1tDUEN5:zx)-4d!%%dL:DH '6%6.qs4E((TI!!#du77r/$5""HJ&)$522hA$)AF%<=:>N N=N`I999v/37;eeeNBf}}~H'+DEUn$KLEGHLEJFK! J,MJ,X -)-u- ',uTsuxxtFrmrctjdd|x}}tj||\}}tj|dz|dzz dz dtjzz }tj|dz dz dz|dz dz dzz dz dtjzdzdzz }||z }|dz}|dz}|dz}|||fS) z,Return a tuple X, Y, Z with a test data set.gg@rr g?rri)rrmeshgridexpr|)rXrrrCrDZ1Z2rEs rl get_test_datars IIdC ''A ;;q! DAq !Q$A+" #q255y 1B &&QUcMA%!a%3(::;a? @ ruu9s?S  "B RA BA BA CA a7NrmceZdZdZdZdZdZdZedZ dZ dZ d Z e Z d Zd Zd Zed ZedZdZy)rXzb Quaternions consisting of scalar, along 1, and vector, with components along i, j, k cF||_tj||_yr)scalarrrvector)rdrrs rlrJz_Quaternion.__init__s hhv& rmcR|j|j |j Srrkrrrrs rl__neg__z_Quaternion.__neg__s~~t{{lT[[L99rmcb|j|j|jztj|j|jz |j|jz|j|jzztj |j|jzS)a Product of two quaternions i*i = j*j = k*k = i*j*k = -1 Quaternion multiplication can be expressed concisely using scalar and vector parts, see )rkrrrrcrossrdrs rl__mul__z_Quaternion.__mul__sz~~ KK $rvvdkk5<<'H H KK $t{{5<<'? ?hht{{ELL1 23 3rmcP|j|j|j S)z5The conjugate quaternion -(1/2)*(q+i*q*i+j*q*j+k*q*k)rrrs rl conjugatez_Quaternion.conjugates~~dkkDKK<88rmc|j|jztj|j|jzS)zThe 2-norm, q*q', a scalar)rrrrrrs rlrz_Quaternion.norms/{{4;;& T[[)IIIrmctj|j}|j|j|z |j |z S)zScaling such that norm equals 1)rrIrrkrrrdrs rlrz_Quaternion.normalizes5 GGDII ~~dkk!mT[[];;rmct|j}|j|j|z |j |z S)z.The reciprocal, 1/q = q'/(q*q') = q' / norm(q))rrkrrrs rl reciprocalz_Quaternion.reciprocals. II~~dkk!mdkk\!^<r@rr)clsr rLrhrirjrgs rlrZz_Quaternion.rotate_from_to s  HHR  YY^^A  ZZBFF2rN + a 7vvb"~! VWHHQK&'"))BrE"#HHRO q))1I 9%BFF2J"&&* R0Armctj|dz tj|dz }}tj|dz tj|dz }}tj|dz tj|dz } }||z|z||z| zz} ||z| z||z|zz } ||z|z||z| zz} ||z| z||z|zz } || | | | gS)z Converts the angles to a quaternion q = exp((roll/2)*e_x)*exp((elev/2)*e_y)*exp((-azim/2)*e_z) i.e., the angles are a kind of Tait-Bryan angles, -z,y',x". The angles should be given in radians, not degrees. r)rrr)rr!r"r#casacesecrsrqwqxqyqzs rlrYz_Quaternion.from_cardan_angles%sQQBQQBQQB U2X2b  U2X2b  U2X2b  U2X2b 2B|$$rmc|j}|jdddf\}}}tjd| |z||zzz||z||zz||zz ||zz }tjtj d||z||zzz||z||zz||zz||zzz dd}tjd||z||zz z||z||zz ||zz ||zz}|||fS)z The inverse of `from_cardan_angles()`. Note that the angles returned are in radians, not degrees. The angles are not sensitive to the quaternion's norm(). .Nrrr )rrrrarcsinr)rdrrrrr"r!r#s rlr\z_Quaternion.as_cardan_angles7s [[[[a( Bzz!bSVBrE\*BrE"R%K2,=be,CDyyBrE"R%K"R%2+be2CBrE2I!JBPQRSzz!RU2b5[/2b5B;r"u+rs $ @@#&#!!%)+ L&7  J XJ@AM>TM>AM>`|  v v rm