Ë
    £�DjS  ã                   óD   — d Z ddlmZ ddgZd„ Zdd„Zdd„Zd	„ Zd
„ Zd„ Z	y)z.Helper functions for graphics with Matplotlib.é    )ÚlrangeÚcreate_mpl_axÚcreate_mpl_figc                  ó4   — 	 ddl m}  | S #  t        d«      ‚xY w)z6This function is not needed outside this utils module.r   NzMatplotlib is not found.)Úmatplotlib.pyplotÚpyplotÚImportError)Úplts    ú^C:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\statsmodels/graphics/utils.pyÚ_import_mplr      s$   € ð6Ý'ð €Jøð6ÜÐ4Ó5Ð5ús   ‚
 ŠNc                 ó„   — | €/t        «       }|j                  «       }|j                  d«      } || fS | j                  }|| fS )aÉ  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      sI   € ðH 
€zÜ‹mˆØ�j‰j‹lˆØ�_‰_˜SÓ!ˆð �ˆ7€Nð �i‰iˆà�ˆ7€Nó    c                 óB   — | €t        «       }|j                  |¬«      } | S )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ˆØ�j‰j ˆjÓ)ˆà€Jr   c                 ó‚  — | €"t        |j                  j                  d   «      } t        | t        «      r|j
                  |    }| }||fS t        | t        t        f«      r@g }g }| D ]3  }t        ||«      \  }}|j                  |«       |j                  |«       Œ5 ||fS | }|j
                  j                  | «      }||fS )zr
    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×   € ð
 €{Ü�U—Z‘Z×%Ñ% aÑ(Ó)ˆÜ�#”sÔØ×$Ñ$ SÑ)ˆ	Øˆð �hÐÐô 
�Cœ%¤˜Ô	'Øˆ	ØˆØò 	+ˆDÜ,=¸dÀEÓ,JÑ)ˆN˜MØ×Ñ˜^Ô,Ø�O‰O˜MÕ*ð	+ð �hÐÐð ˆ	Ø×#Ñ#×)Ñ)¨#Ó.ˆà�hÐÐr   c                 ó  — t        | dd«      }|st        | dd«      }|sQt        | ddg«      }t        |«      dk(  rdn| j                  d   }t        |«      D �cg c]  }d‘Œ }}|dk(  r|d   }|S |j	                  «       }|S c c}w )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›   € ô
 Ð'¨°Ó6€EÙÜÐ+¨Y¸Ó=ˆÙÜÐ+¨W°q°cÓ:ˆÜ˜“Z 1’_‘Ð*=×*CÑ*CÀAÑ*FˆÜ % e£Ö-˜1’Ð-ˆÐ-Ø�AŠ:Ø˜!‘HˆEð €Lð —‘“ˆØ€Lùò .s   Á	Bc                 ób   — | D ])  }||   }||   }	||   }
 |j                   ||	f|
d|dœ|¤Ž Œ+ |S )z\
    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   ˆ   s\   € ð
 ò )ˆØ�q‘	ˆØ�q‘	ˆØ˜qÑ!ˆØˆ�‰�E˜5ð 	)¨¸OØñ	)Ø!'ó	)ð	)ð €Ir   )N)NN)
Ú__doc__Ústatsmodels.compat.pythonr   Ú__all__r   r   r   r   r4   rB   © r   r   ú<module>rG      s5   ðÙ 4Ý ,àÐ,Ð
-€òó+ó\ò:ò2ó&r   