Ë
    £�Dj’  ã                   ó.   — d dl mZ d dlZdd„Z	 	 	 dd„Zy)é    Nc                 ó¦  — t        j                  «       }|€t        | «      n|}| }|d| }|j                  d«      }|j	                  t        j                  |«      |d| d«       |j                  d¬«       t        j                  |j                  «       «      }|d   |d   z
  }|dt        j                  | |g«      z  z  }|j                  t        j                  |«      «       |j                  |«       t        j                  |j                  «       «      }	d}
|	d   |	d   z
  }|	|
t        j                  | |g«      z  z  }	|j                  |	«       |j                  d	«       |j                  d
«       |j!                  |«       ||z  }t        j"                  |«      }|j                  d«      }|j	                  t        j                  |«      |d| d«       |j	                  t        j                  |«      |d| d«       |j                  d¬«       t        j                  |j                  «       «      }|d   |d   z
  }|dt        j                  | |g«      z  z  }|j                  t        j                  |«      «       |j                  |«       t        j                  |j                  «       «      }	d}
|	d   |	d   z
  }|	|
t        j                  | |g«      z  z  }	|j                  |	«       |j                  d«       |j                  d«       |j!                  |«       |j%                  ddgd¬«       |j'                  «        |S )a
  
    Plot of the ordered eigenvalues and variance explained for the loadings

    Parameters
    ----------
    eigenvals : array_like
        The eigenvalues
    total_var : float
        the total variance (for plotting percent variance explained)
    ncomp : int, optional
        Number of factors to include in the plot.  If None, will
        included the same as the number of maximum possible loadings
    x_label : str
        label of x-axis

    Returns
    -------
    Figure
        Handle to the figure.
    Néy   zb-oT)Útighté   r   g{®Gáz”?z
Scree PlotÚ
Eigenvalueéz   zg--ozVariance ExplainedÚ
ProportionÚ
Cumulativeé   )Úloc)ÚpltÚfigureÚlenÚadd_subplotÚplotÚnpÚarangeÚ	autoscaleÚarrayÚget_xlimÚ
set_xticksÚset_xlimÚget_ylimÚset_ylimÚ	set_titleÚ
set_ylabelÚ
set_xlabelÚcumsumÚlegendÚtight_layout)Ú	eigenvalsÚ	total_varÚncompÚx_labelÚfigÚvalsÚaxÚxlimÚspÚylimÚscaleÚper_varianceÚcumper_variances                úbC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\statsmodels/multivariate/plots.pyÚ
plot_screer/      sÂ  € ô* �*‰*‹,€CØ#˜mŒC�	ŒN°€EØ€DØ��ˆ<€Dð 
�‰˜Ó	€BØ‡G�GŒB�I‰I�eÓ˜d 7 U˜m¨UÔ3Ø‡L�L�t€LÔÜ�8‰8�B—K‘K“MÓ"€DØ	ˆa‰�4˜‘7Ñ	€BØˆD”2—8‘8˜b˜S "˜IÓ&Ñ&Ñ&€DØ‡M�M”"—)‘)˜EÓ"Ô#Ø‡K�K�Ôä�8‰8�B—K‘K“MÓ"€DØ€EØ	ˆa‰�4˜‘7Ñ	€BØˆE”B—H‘H˜r˜c 2˜YÓ'Ñ'Ñ'€DØ‡K�K�ÔØ‡L�L�ÔØ‡M�M�,ÔØ‡M�M�'Ôà˜)Ñ#€LÜ—i‘i Ó-€OØ	�‰˜Ó	€Bà‡G�GŒB�I‰I�eÓ˜l¨7¨UÐ3°UÔ;Ø‡G�GŒB�I‰I�eÓ˜o¨g°Ð6¸Ô?Ø‡L�L�t€LÔÜ�8‰8�B—K‘K“MÓ"€DØ	ˆa‰�4˜‘7Ñ	€BØˆD”2—8‘8˜b˜S "˜IÓ&Ñ&Ñ&€DØ‡M�M”"—)‘)˜EÓ"Ô#Ø‡K�K�Ôä�8‰8�B—K‘K“MÓ"€DØ€EØ	ˆa‰�4˜‘7Ñ	€BØˆE”B—H‘H˜r˜c 2˜YÓ'Ñ'Ñ'€DØ‡K�K�ÔØ‡L�LÐ%Ô&Ø‡M�M�,ÔØ‡M�M�'ÔØ‡I�Iˆ|˜\Ð*°€IÔ2Ø×ÑÔØ€Jó    c                 ó¼  — | j                   \  }}|€9g }t        |«      D ])  }t        |dz   |«      D ]  }	|j                  ||	g«       Œ Œ+ |€t        |«      D �cg c]  }d|z  ‘Œ	 }}|€t        |«      D �cg c]  }d|z  ‘Œ	 }}g }
|D �]Å  }|d   }|d   }	t        j                  d¬«      }|
j                  |«       |j                  d«      }t        | j                   d   «      D ](  }t        j                  | ||f   | ||	f   ||   d	¬
«       Œ* |j                  | dd…|f   | dd…|	f   d«       |j                  |«       |�A||   › d||   d›d�}||	   › d||	   d›d�}|j                  |«       |j                  |«       n(|j                  ||   «       |j                  ||	   «       d}t        j                  | |g«      }t        j                  | |g«      }|j                  |ddgd«       |j                  ddg|d«       |j                  dd«       |j                  |«       |j                  |«       |j!                  «        �ŒÈ |
S c c}w c c}w )a¬  
    Plot factor loadings in 2-d plots

    Parameters
    ----------
    loadings : array like
        Each column is a component (or factor)
    col_names : a list of strings
        column names of `loadings`
    row_names : a list of strings
        row names of `loadings`
    loading_pairs : None or a list of tuples
        Specify plots. Each tuple (i, j) represent one figure, i and j is
        the loading number for x-axis and y-axis, respectively. If `None`,
        all combinations of the loadings will be plotted.
    percent_variance : array_like
        The percent variance explained by each factor.

    Returns
    -------
    figs : a list of figure handles
    Nr   z	factor %dzvar %dr   )é   r2   )Úfigsizeéo   é   )ÚfontsizeÚboz (z.1fz%)gÍÌÌÌÌÌð?zk--ÚequalÚdatalim)ÚshapeÚrangeÚappendr   r   r   Útextr   r   r   r   r   r   Ú
set_aspectr   r   r    )ÚloadingsÚ	col_namesÚ	row_namesÚloading_pairsÚpercent_varianceÚtitleÚk_varÚn_factorÚiÚjÚfigsÚitemr%   r'   ÚkÚx_strÚy_strÚvr(   r*   s                       r.   Úplot_loadingsrO   L   st  € ð2 —n‘n�O€Eˆ8ØÐØˆÜ�x“ò 	-ˆAÜ˜1˜q™5 Ó*ò -�Ø×$Ñ$ a¨ VÕ,ñ-ð	-ð ÐÜ.3°H«oÖ>¨�[ 1“_Ð>ˆ	Ð>ØÐÜ+0°«<Ö8 a�X “\Ð8ˆ	Ð8Ø€DØó ˆØ�‰GˆØ�‰GˆÜ�j‰j Ô(ˆØ�‰�CÔØ�_‰_˜SÓ!ˆÜ�x—~‘~ aÑ(Ó)ò 	0ˆAÜ�H‰H�X˜a ˜d‘^ X¨a°¨d¡^Ø˜q‘\¨Bö0ð	0ð 	�‰�š˜A˜‘ ª¨A¨¡°Ô5Ø
�‰�UÔØÐ'Ø  ‘|�n BÐ'7¸Ñ':¸3Ð&?¸rÐBˆEØ  ‘|�n BÐ'7¸Ñ':¸3Ð&?¸rÐBˆEØ�M‰M˜%Ô Ø�M‰M˜%Õ à�M‰M˜) A™,Ô'Ø�M‰M˜) A™,Ô'ØˆÜ�x‰x˜!˜˜Q˜Ó ˆÜ�x‰x˜!˜˜Q˜Ó ˆØ
�‰��q˜!�f˜eÔ$Ø
�‰��A�˜˜eÔ$Ø
�‰�g˜yÔ)Ø
�‰�DÔØ
�‰�DÔØ×ÑÖð7ð8 €KùòA ?ùâ8s   ÁIÁ7I)NÚfactor)NNNNzFactor patterns)Úmatplotlib.pyplotÚpyplotr   Únumpyr   r/   rO   © r0   r.   ú<module>rU      s#   ðÝ Û óDðN 7;Ø7;Ø)ô@r0   