
    'h                        S SK Jr  S SKrS SKJrJr  S SKJr  \(       a3  S SK	r	S SK
Jr  S SKJr  \	R                  S:  a  S SKJr  OS SKJr  S S	KJr   " S
 S5      rg)    )annotationsN)TYPE_CHECKINGCallable)altair)
EncodeKwds)	Encodings)      )Unpack)Seriesc                  f    \ rS rSrSrSrSS jr    SS jr    SS jr    SS jr	SS jr
S	rg
)
SeriesPlot   zSeries.plot namespace.plotc                f    UR                   =(       d    SnUR                  U5      U l        X l        g )Nvalue)nameto_frame_df_series_name)selfsr   s      iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\polars/series/plotting.py__init__SeriesPlot.__init__   s&    vv ::d#     c                   U R                   S:X  a  Sn[        U5      e[        R                  " U R                    S3SS9SS.n[        R                  " U R
                  5      R                  SS9R                  " S0 UDUD6R                  5       $ )	a  
Draw histogram.

Polars does not implement plotting logic itself but instead defers to
`Altair <https://altair-viz.github.io/>`_.

`s.plot.hist(**kwargs)` is shorthand for
`alt.Chart(s.to_frame()).mark_bar(tooltip=True).encode(x=alt.X(f'{s.name}:Q', bin=True), y='count()', **kwargs).interactive()`,
and is provided for convenience - for full customisatibility, use a plotting
library directly.

.. versionchanged:: 1.6.0
    In prior versions of Polars, HvPlot was the plotting backend. If you would
    like to restore the previous plotting functionality, all you need to do
    is add `import hvplot.polars` at the top of your script and replace
    `df.plot` with `df.hvplot`.

Parameters
----------
**kwargs
    Additional arguments and keyword arguments passed to Altair.

Examples
--------
>>> s = pl.Series("price", [1, 3, 3, 3, 5, 2, 6, 5, 5, 5, 7])
>>> s.plot.hist()  # doctest: +SKIP
zcount()z6cannot use `plot.hist` when Series name is `'count()'`z:QT)binxytooltip )	r   
ValueErroraltXChartr   mark_barencodeinteractiver   kwargsmsg	encodingss       r   histSeriesPlot.hist!   s    @ 	)JCS/!$++,B/T: 
	
 IIdhhXdX#V ++#)+ []		
r   c               <   U R                   S:X  a  Sn[        U5      eU R                   SS.n[        R                  " U R                  5      R                  U R                   U R                   S/S9R                  SS9R                  " S0 UDUD6R                  5       $ )	a  
Draw kernel density estimate plot.

Polars does not implement plotting logic itself but instead defers to
`Altair <https://altair-viz.github.io/>`_.

`s.plot.kde(**kwargs)` is shorthand for
`alt.Chart(s.to_frame()).transform_density(s.name, as_=[s.name, 'density']).mark_area(tooltip=True).encode(x=s.name, y='density:Q', **kwargs).interactive()`,
and is provided for convenience - for full customisatibility, use a plotting
library directly.

.. versionchanged:: 1.6.0
    In prior versions of Polars, HvPlot was the plotting backend. If you would
    like to restore the previous plotting functionality, all you need to do
    is add `import hvplot.polars` at the top of your script and replace
    `df.plot` with `df.hvplot`.

Parameters
----------
**kwargs
    Additional keyword arguments passed to Altair.

Examples
--------
>>> s = pl.Series("price", [1, 3, 3, 3, 5, 2, 6, 5, 5, 5, 7])
>>> s.plot.kde()  # doctest: +SKIP
densityz5cannot use `plot.kde` when Series name is `'density'`z	density:Qr   )as_Tr"   r$   )	r   r%   r&   r(   r   transform_density	mark_arear*   r+   r,   s       r   kdeSeriesPlot.kdeO   s    @ 	)ICS/!%)%6%6[I	IIdhht00t7H7H)6TUYtY$V +  + $*+ []	
r   c                  U R                   S:X  a  Sn[        U5      eSU R                   S.n[        R                  " U R                  R                  5       5      R                  SS9R                  " S0 UDUD6R                  5       $ )aj  
Draw line plot.

Polars does not implement plotting logic itself but instead defers to
`Altair <https://altair-viz.github.io/>`_.

`s.plot.line(**kwargs)` is shorthand for
`alt.Chart(s.to_frame().with_row_index()).mark_line(tooltip=True).encode(x='index', y=s.name, **kwargs).interactive()`,
and is provided for convenience - for full customisatibility, use a plotting
library directly.

.. versionchanged:: 1.6.0
    In prior versions of Polars, HvPlot was the plotting backend. If you would
    like to restore the previous plotting functionality, all you need to do
    is add `import hvplot.polars` at the top of your script and replace
    `df.plot` with `df.hvplot`.

Parameters
----------
**kwargs
    Additional keyword arguments passed to Altair.

Examples
--------
>>> s = pl.Series("price", [1, 3, 3, 3, 5, 2, 6, 5, 5, 5, 7])
>>> s.plot.line()  # doctest: +SKIP
indexz3cannot call `plot.line` when Series name is 'index'r   Tr"   r$   )	r   r%   r&   r(   r   with_row_index	mark_liner*   r+   r,   s       r   lineSeriesPlot.line{   s    @ 'GCS/!%,43D3DE	IIdhh--/0YtY$V ++#)+ []		
r   c                  ^^ U R                   S:X  a  SU S3n[        U5      eUS:X  a  Sn[        [        R                  " U R
                  R                  5       5      SU 3S 5      mTc  SU S3n[        U5      eSU R                   S	.mS
[        R                  " T5      R                  R                  5        Vs1 s H  o3R                  iM     sn;   nU(       a  SUU4S jjnU$ SUU4S jjnU$ s  snf )Nr:   zCannot call `plot.z` when Series name is 'index'scatterpointmark_zAltair has no method 'mark_'r   r#   c                 P   > T" SS9R                   " S0 TDU D6R                  5       $ )NTr"   r$   r*   r+   r-   r/   methods    r   func$SeriesPlot.__getattr__.<locals>.func   s*    d+22IYI&IUUWWr   c                 R   > T" 5       R                   " S0 TDU D6R                  5       $ )Nr$   rE   rF   s    r   rH   rI      s%    x==f=IIKKr   )r-   r   return	alt.Chart)r   r%   getattrr&   r(   r   r;   AttributeErrorinspect	signature
parametersvaluesr   )r   attrr.   r   accepts_tooltip_argumentrH   r/   rG   s         @@r   __getattr__SeriesPlot.__getattr__   s    '&tf,IJCS/!9D488#:#:#<=tf~tT>/vQ7C %%%,43D3DE	#,$+$5$5f$=$H$H$O$O$Q1
$Q5JJ$Q1
 $
  $X X L L 1
s   <C3)r   r   N)r   r   rK   None)r-   zUnpack[EncodeKwds]rK   rL   )rS   strrK   zCallable[..., alt.Chart])__name__
__module____qualname____firstlineno____doc__	_accessorr   r0   r7   r=   rU   __static_attributes__r$   r   r   r   r      sb     I!
,
 %,
 
	,
\*
 %*
 
	*
X)
 %)
 
	)
Vr   r   )
__future__r   rO   typingr   r   polars.dependenciesr   r&   sysaltair.typingr   polars.dataframe.plottingr   version_infor   typing_extensionspolarsr   r   r$   r   r   <module>ri      s@    "  * -(3
7"!,h hr   