+
    ^|iC                     <  a  RA t#0 t R t^ RIHt ^ RIHt ^ RIHt ^ RIt^ RI	H
t
 ^ RIHt / RRbR	R
bRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbR R bR!R!bR"R"bR#R$R%R&R'R&/Ct]! ]! ]P!                  4       ]P#                  4       4      4      t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. tR/ tR0 tRBR1 ltRCR2 ltR3 tR4 tR5 tRDR6 ltR7 tRER8 ltRs] ^ k R9 R: ltR; R< lt R= R> lt!R? R@ lt"R# )Fz%Pylab (matplotlib) support utilities.)BytesIO)
b2a_base64)partialN)_pngxy)
flag_callstkTkAgggtkGTKAgggtk3GTK3Agggtk4GTK4AggwxWXAggqt4Qt4Aggqt5Qt5Aggqt6QtAggqtosxMacOSXnbaggnbAggwebaggWebAggnotebookaggsvgpdfpsinlinez)module://matplotlib_inline.backend_inlineipymplmodule://ipympl.backend_nbaggwidgetGTKGTKCairo	GTK3Cairo	GTK4CairoWXCocoaAggc                     V R9   d3   \         P                  ! V  R2\        4       \        4       RV  2,          # \	        R\
        : RV : 24      h)backendszg is deprecated since IPython 8.24, backends are managed in matplotlib and can be externally registered._deprecated_zmodule z has no attribute )r.   backend2gui)warningswarnDeprecationWarningglobalsAttributeError__name__)names   &9/usr/lib/python3/dist-packages/IPython/core/pylabtools.py__getattr__r9   K   sX    **f > >	

 y<v.//
78,.@I
JJ    c                 \   ^ RI Hp V '       g6   VP                  4       pV Uu. uF  q3P                  P                  NK  	  up# . pV  F[  pVP
                  P                  V4      pVf   \        RV,          4       K6  VP                  VP                  P                  4       K]  	  V# u upi )ag  Get a list of matplotlib figures by figure numbers.

If no arguments are given, all available figures are returned.  If the
argument list contains references to invalid figures, a warning is printed
but the function continues pasting further figures.

Parameters
----------
figs : tuple
    A tuple of ints giving the figure numbers of the figures to return.
)Gcfz!Warning: figure %s not available.)	matplotlib._pylab_helpersr<   get_all_fig_managerscanvasfigurefigsgetprintappend)fig_numsr<   fig_managersfmrA   numfs   *      r8   getfigsrJ   [   s     .//1+78<R		  <88CS!Ay9C?@AHHOO,   9s   B)c                .    ^ RI pW.VP                  R&   R# )zSet the default figure size to be [sizex, sizey].

This is just an easy to remember, convenience wrapper that sets::

  matplotlib.rcParams['figure.figsize'] = [sizex, sizey]
Nzfigure.figsize)
matplotlibrcParams)sizexsizeyrL   s   && r8   figsizerP   v   s     -2NJ()r:   c           
     "   V P                   '       g   V P                  '       g   R# V P                  pVR8X  d   V^,          pRpRVRV P                  4       RV P	                  4       RVRV/pVP                  V4       \        4       pV P                  f   ^ R	IH	p V! V 4       V P                  P                  ! V3/ VB  VP                  4       p	VR
8X  d   V	P                  R4      p	V	# V'       d   \        V	RR7      P                  R4      p	V	# )a  Print a figure to an image, and return the resulting file data

Returned data will be bytes unless ``fmt='svg'``,
in which case it will be unicode.

Any keyword args are passed to fig.canvas.print_figure,
such as ``quality`` or ``bbox_inches``.

If `base64` is True, return base64-encoded str instead of raw bytes
for binary-encoded image formats

.. versionadded:: 7.29
    base64 argument
Nretinapngformat	facecolor	edgecolordpibbox_inches)FigureCanvasBaser    zutf-8Fnewlineascii)axeslinesrW   get_facecolorget_edgecolorupdater   r?   matplotlib.backend_basesrY   print_figuregetvaluedecoder   )
figfmtrX   base64kwargsrW   kwbytes_iorY   datas
   &&&&,     r8   rc   rc      s    " 888CIII
''C
hAg 	C%%'C%%'ck
B IIfyH
zz=JJH++D
e|{{7# K 
$.55g>Kr:   c                    \        V 3RRRR/VB pVf   R# \        V4      w  rERV^,          RV^,          /pV'       d   \        VRR7      P                  R	4      pW63# )
zformat a figure as a pixel-doubled (retina) PNG

If `base64` is True, return base64-encoded str instead of raw bytes
for binary-encoded image formats

.. versionadded:: 7.29
    base64 argument
rg   rR   rh   FNwidthheightrZ   r\   )rc   r   r   re   )rf   rh   ri   pngdatawhmetadatas   &&,    r8   retina_figurert      sk     3EHEUEfEG '?DAAx1-HWe4;;GDr:   c                   a  V 3R lpV# )a4  Factory to return a matplotlib-enabled runner for %run.

Parameters
----------
safe_execfile : function
    This must be a function with the same interface as the
    :meth:`safe_execfile` method of IPython.

Returns
-------
A function suitable for use as the ``runner`` argument of the %run magic
function.
c                  < ^ RI p^ RIHp VP                  RR/4      ;_uu_ 4        S! V .VO5/ VB  RRR4       VP	                  4       '       d   VP                  4        VP                  P                  '       d"   VP                  4        RVP                  n         VP                  pV! 4        R#   + '       g   i     L; i  \         d     R# i ; i)zmatplotlib-aware wrapper around safe_execfile.

Its interface is identical to that of the :func:`execfile` builtin.

This is ultimately a call to execfile(), but wrapped in safeties to
properly handle interactive rendering.NinteractiveF)rL   matplotlib.pyplotpyplot
rc_contextis_interactiveshowdraw_if_interactivecalleddrawdraw_allr5   )fnamewhererj   rL   pltdasafe_execfiles   &*,   r8   mpl_execfile mpl_runner.<locals>.mpl_execfile   s     	' ""M5#9::%.%.2. ; $$&&HHJ "")))HHJ-2C##*	B D# ;:  		s   B5 C 5C	CC )r   r   s   f r8   
mpl_runnerr      s    @ r:   c                     V P                   P                  P                  pV! 4        R#   \         d   p\	        4       ThRp?ii ; i)zreshow an nbagg figureN)r?   managerreshowr5   NotImplementedError)rf   r   es   &  r8   _reshow_nbagg_figurer      s@    ##** 	  +!#*+s    + AAAc           
     x   ^ RI p^ RIHp V P                  P                  R,          pV P                  P                  R,          pV P                  P                  R,          pV P                  P                  R,          p\        V\        4      '       d   V0p\        V4      pV P                  P                  P                  4        U	u. uF  qP                  VR4      NK  	   p	VP                  4       P                  4       p
V
R9   d-   V P                  P                  pVP                  V\        4       0 RmpVP                  V4      pV'       dv   RRP!                  V U	u. uF  p	\#        V	4      NK  	  up	4      ,          pRRP!                  V U	u. uF  p	\#        V	4      NK  	  up	4      ,          p\%        RV: RV: 24      hRV9   d%   VP                  V\'        \(        3RRRR/VB 4       R	V9   g   RV9   d#   VP                  V\'        \*        3RR/VB 4       R
V9   g   RV9   d%   VP                  V\'        \(        3RR
RR/VB 4       RV9   d#   VP                  V\'        \(        3RR/VB 4       RV9   d'   VP                  V\'        \(        3RRRR/VB 4       R# R# u up	i u up	i u up	i )a;  Select figure formats for the inline backend.

Parameters
----------
shell : InteractiveShell
    The main IPython instance.
formats : str or set
    One or a set of figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'.
**kwargs : any
    Extra keyword arguments to be passed to fig.canvas.print_figure.
N)Figurezimage/svg+xmlz	image/pngz
image/jpegzapplication/pdfrS   png2xrR   jpgjpegr    r!   z%s,zsupported formats are: z not rg   rh   T)r   r$   r&   r%   >   r   r!   rS   r    r   r   rR   )rL   matplotlib.figurer   display_formatter
formatters
isinstancestrsetvaluespopget_backendloweripython_display_formatterfor_typer   
differencejoinrepr
ValueErrorr   rc   rt   )shellformatsri   rL   r   svg_formatterpng_formatterjpg_formatterpdf_formatterrI   
mplbackend	formatter	supportedbadbsgss   &&,             r8   select_figure_formatsr     sh    (++66GM++66{CM++66|DM++667HIM'3)'lG#(#:#:#E#E#L#L#NP#NaeeFD#NP'')//1JSS++EE	6#78GI


Y
'C
CHHs3s!d1gs344CHHy9y!d1gy9::r2FGGGLKeKDKFK	
 7g0vw}'TT'TV'TU6W,GLKeKDKFK	
 vw|'Q'Q&'QRGLKeKDKFK	
 3 Q 49s   	J-#J2
J7
c                V   ^ RI p\        4       '       d{   VP                  P                  P                  pV R	9   d(   VP
                  R,          pVP                  V4      w  r@M\        V 4      p VP                  V 4      w  r@\        V 4      p W3# \        VRR
4      pVR8  p\        \        4      pV'       g   RVR&   V '       d   V R8w  d   Wp,          pV R8X  d   Rp MAVP
                  R,          p\        P                  VR4      p V'       d   W8w  d   Tp Wp,          pV R8X  d   Rp W3# )a  Given a gui string return the gui and mpl backend.

Parameters
----------
gui : str
    Can be one of ('tk','gtk','wx','qt','qt4','inline','agg').
gui_select : str
    Can be one of ('tk','gtk','wx','qt','qt4','inline').
    This is any gui already selected by the shell.

Returns
-------
A tuple of (gui, backend) where backend is one of ('TkAgg','GTKAgg',
'WXAgg','Qt4Agg','module://matplotlib_inline.backend_inline','agg').
Nautobackend__version_info__qt5aggr   r   r#   )r   N)    r   )      )rL   _matplotlib_manages_backendsr.   registrybackend_registryrcParamsOrigresolve_backend_convert_gui_to_matplotlibresolve_gui_or_backend_convert_gui_from_matplotlibgetattrdict_deprecated_backends_deprecated_backend2guirB   )gui
gui_selectrL   r   r   mpl_version_infohas_unified_qt_backend	backends_s   &&      r8   find_gui_and_backendr   A  s)   " #%%%..77HH .  --i8G+;;GDLGS,S1C+BB3GLG*3/| z+=vF-7 )*I!"	$
sf}.%<C )))4 &))'48 #+CnG h<r:   c                    ^ RI pVP                  R4       WP                  R&   ^ RI Hp VP	                  V 4       RVP
                  n        \        VP                  4      Vn        R# )z7Activate the given backend and set interactive to True.NTr   )ry   F)	rL   rw   rM   ry   switch_backendr|   	_needmainr   r}   )r   rL   r   s   &  r8   activate_matplotlibr     sY     4 
 &-	"
 )wCHH ))@)@ACr:   c                    Rp\        W 4       V'       d   Rp\        W 4       \        V R&   ^ RIHp W0R&   \        V R&   R# )zPopulate the namespace with pylab-related values.

Imports matplotlib, pylab, numpy, and everything from pylab and numpy.

Also imports a few names from IPython (figsize, display, getfigs)

zbimport numpy
import matplotlib
from matplotlib import pylab, mlab, pyplot
np = numpy
plt = pyplot
z3from matplotlib.pylab import *
from numpy import *
rP   )displayr   rJ   N)execrP   IPython.displayr   rJ   )user_ns
import_allsr   s   &&  r8   import_pylabr     sF    
A 	%Q !GI' I GIr:   c                $    V ^8  d   QhR\         /#    return)bool)rT   s   "r8   __annotate__r     s     . .d .r:   c                     \         f    ^ RIHp  \        V R4      s \         # \         #   \         d    Rs  \         # i ; i)a  Return True if Matplotlib manages backends, False otherwise.

If it returns True, the caller can be sure that
matplotlib.backends.registry.backend_registry is available along with
member functions resolve_gui_or_backend, resolve_backend, list_all, and
list_gui_frameworks.

This function can be removed as it will always return True when Python
3.12, the latest version supported by Matplotlib < 3.9, reaches
end-of-life in late 2028.
r   r   F)"_matplotlib_manages_backends_valuematplotlib.backends.registryr   hasattrImportErrorr   s    r8   r   r     sN     *1	7E18 ":2. .---  	716.--	7s   ( ==c                :    V ^8  d   QhR\         \        ,          /# r   )listr   )rT   s   "r8   r   r     s     " "c "r:   c                 .   \        4       '       dF   ^ RIHp  V P                  4       V P	                  4        Uu. uF  p\        V4      NK  	  up,           pM)^ RIHp \        VP                  P                  4       4      p\        R.V,           4      # u upi )zqReturn list of all Matplotlib backends and GUI event loops.

This is the list returned by
    %matplotlib --list
r   )
pylabtoolsr   )r   r   r   list_alllist_gui_frameworksr   IPython.corer   r   r.   keyssorted)r   r   retr   s       r8   '_list_matplotlib_backends_and_gui_loopsr     s     $%%A'')';;=-
= )-=-
 

 	,:&&++-.6(S.!!-
s   Bc                L    V ^8  d   QhR\         R,          R\         R,          /# r   r   Nr   r   )rT   s   "r8   r   r     s"      C$J 3: r:   c                 D    V '       d   V P                  4       R 8X  d   R# V # )r   macosxr   r   s   &r8   r   r     s    
syy{e#Jr:   c                L    V ^8  d   QhR\         R,          R\         R,          /# r   r   )rT   s   "r8   r   r     s"      cDj S4Z r:   c                 D    V '       d   V P                  4       R 8X  d   R# V # )r   r   r   r   s   &r8   r   r     s    
syy{h&Jr:   c                N    V ^8  d   Qh/ ^ \         9   d   \        R,          ;R&   # )r   Nr   )__conditional_annotations__r   )rT   s   "r8   r   r      s      + +D 7 6D4K 6E ,r:   )rS   tightF)F)NN)T)$r   __doc__ior   binasciir   	functoolsr   r1   IPython.core.displayr   IPython.utils.decoratorsr   r   r   zipr   r   r   r9   rJ   rP   rc   rt   r   r   r   r   r   r   r   r   r   r   r   r   )r   s   @r8   <module>r     s4   +
     ' /'	8 I I	
 	' 
8 
8 
7 	' 
8 W h  
5 
5  
5!" 	$#$ 9--) 6 ##%';'@'@'BC 
 HM L  !8!D'-  $'-  $ $  &+ 
 # $(   $)  !$)  ! G$E"E"E"D!GH;<K 6;/b./d5
xEPB0!F 37 " 6.4"0r:   