
    >hS                     H    S r SSKJr  SS/rS rSS jrSS jrS	 rS
 rS r	g)z.Helper functions for graphics with Matplotlib.    )lrangecreate_mpl_axcreate_mpl_figc                  4     SSK Jn   U $ !   [        S5      e= f)z6This function is not needed outside this utils module.r   NzMatplotlib is not found.)matplotlib.pyplotpyplotImportError)plts    mC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\statsmodels/graphics/utils.py_import_mplr      s$    6' J6455s   
 Nc                     U c.  [        5       nUR                  5       nUR                  S5      n X 4$ U R                  nX 4$ )aY  Helper function for when a single plot axis is needed.

Parameters
----------
ax : AxesSubplot, optional
    If given, this subplot is used to plot in instead of a new figure being
    created.

Returns
-------
fig : Figure
    If `ax` is None, the created figure.  Otherwise the figure to which
    `ax` is connected.
ax : AxesSubplot
    The created axis if `ax` is None, otherwise the axis that was passed
    in.

Notes
-----
This function imports `matplotlib.pyplot`, which should only be done to
create (a) figure(s) with ``plt.figure``.  All other functionality exposed
by the pyplot module can and should be imported directly from its
Matplotlib module.

See Also
--------
create_mpl_fig

Examples
--------
A plotting function has a keyword ``ax=None``.  Then calls:

>>> from statsmodels.graphics import utils
>>> fig, ax = utils.create_mpl_ax(ax)
o   )r   figureadd_subplot)axr
   figs      r   r   r      sE    H 
zmjjl__S! 7N ii7N    c                 >    U c  [        5       nUR                  US9n U $ )a  Helper function for when multiple plot axes are needed.

Those axes should be created in the functions they are used in, with
``fig.add_subplot()``.

Parameters
----------
fig : Figure, optional
    If given, this figure is simply returned.  Otherwise a new figure is
    created.

Returns
-------
Figure
    If `fig` is None, the created figure.  Otherwise the input `fig` is
    returned.

See Also
--------
create_mpl_ax
)figsize)r   r   )r   r   r
   s      r   r   r   ?   s%    , {mjjj)Jr   c                    U c"  [        UR                  R                  S   5      n [        U [        5      (       a  UR
                  U    nU nX#4$ [        U [        [        45      (       a?  / n/ nU  H2  n[        XA5      u  pVUR                  U5        UR                  U5        M4     X#4$ U nUR
                  R                  U 5      nX#4$ )zf
Give a name or an integer and return the name and integer location of the
column in a design matrix.
   )r   exogshape
isinstanceint
exog_namestuplelistmaybe_name_or_idxappendindex)idxmodel	exog_nameexog_idxitemexog_name_itemexog_idx_items          r   r   r   \   s    
 {UZZ%%a()#s$$S)	  
C%	'	'	D,=d,J)N^,OOM*   	##))#.r   c                 ,   [        U SS5      nU(       d  [        U SS5      nU(       dV  [        U SS/5      n[        U5      S:X  a  SOU R                  S   n[        U5       Vs/ s H  nSPM     nnUS:X  a  US   nU$ UR	                  5       nU$ s  snf )z
Input can be an array or pandas-like. Will handle 1d array-like but not
2d. Returns a str for 1d data or a list of strings for 2d data.
nameNcolumnsr   r   zX%dr   )getattrlenr   rangetolist)series_or_dataframenamesr   nvars_s        r   get_data_namesr4   u   s    
 '6E+Y=+Wqc:Z1_*=*C*CA*F %e-1-A:!HE L L .s   $Bc                 ^    U  H&  nX   nX'   n	X7   n
UR                   " X4U
SUS.UD6  M(     U$ )zP
Annotate Axes with labels, points, offset_points according to the
given index.
zoffset points)xytext
textcoordssize)annotate)r!   labelspointsoffset_pointsr8   r   kwargsilabelpointoffsets              r   annotate_axesrB      sM    
 		!
E 	)O	)!'	)	  Ir   )N)NN)
__doc__statsmodels.compat.pythonr   __all__r   r   r   r   r4   rB    r   r   <module>rG      s5    4 ,,
-+\:2&r   