zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
U
¬ý°dQJã @s\ddlmZddlmZddlmZmZddlmZerhddl    m
Z
ddl m Z ddl ZddlmZmZd    d
„Zd d œd d„Zd d œdd„ZdAddddddddddœ    dd„ZdBdddd d!d"œd#d$„ZdCdddd&d d!d'œd(d)„ZdDd,d-d&d&d.d/œd0d1„ZdEddd3dd dd4ddd!d5œ
d6d7„ZdFd,d&dd!d9œd:d;„ZdGd,dd!d<œd=d>„ZGd?d@„d@eƒZeƒZdS)Hé)Ú annotations)Úcontextmanager)Ú TYPE_CHECKINGÚ    Generator)Ú_get_plot_backend)ÚAxes)ÚFigureN)Ú    DataFrameÚSeriescKs"tdƒ}|jf||dddœ|—ŽS)a¹
    Helper function to convert DataFrame and Series to matplotlib.table.
 
    Parameters
    ----------
    ax : Matplotlib axes object
    data : DataFrame or Series
        Data for table contents.
    **kwargs
        Keyword arguments to be passed to matplotlib.table.table.
        If `rowLabels` or `colLabels` is not specified, data index or column
        name will be used.
 
    Returns
    -------
    matplotlib table object
    Ú
matplotlibN)ÚaxÚdataZ    rowLabelsZ    colLabels)rÚtable)r r ÚkwargsÚ plot_backend©rúLd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/plotting/_misc.pyrsÿÿrÚNone©ÚreturncCstdƒ}| ¡dS)až
    Register pandas formatters and converters with matplotlib.
 
    This function modifies the global ``matplotlib.units.registry``
    dictionary. pandas adds custom converters for
 
    * pd.Timestamp
    * pd.Period
    * np.datetime64
    * datetime.datetime
    * datetime.date
    * datetime.time
 
    See Also
    --------
    deregister_matplotlib_converters : Remove pandas formatters and converters.
    r N)rÚregister©rrrrr.srcCstdƒ}| ¡dS)a-
    Remove pandas formatters and converters.
 
    Removes the custom converters added by :func:`register`. This
    attempts to set the state of the registry back to the state before
    pandas registered its own units. Converters for pandas' own types like
    Timestamp and Period are removed completely. Converters for types
    pandas overwrites, like ``datetime.datetime``, are restored to their
    original value.
 
    See Also
    --------
    register_matplotlib_converters : Register pandas formatters and converters
        with matplotlib.
    r N)rÚ
deregisterrrrrrDsrçà?FÚhistÚ.皙™™™™©?r    Úfloatztuple[float, float] | Nonez Axes | NoneÚboolÚstrz
np.ndarray)    ÚframeÚalphaÚfigsizer ÚgridÚdiagonalÚmarkerÚ range_paddingrc
Ks.tdƒ} | jf||||||||||    dœ
|
—ŽS)aB
    Draw a matrix of scatter plots.
 
    Parameters
    ----------
    frame : DataFrame
    alpha : float, optional
        Amount of transparency applied.
    figsize : (float,float), optional
        A tuple (width, height) in inches.
    ax : Matplotlib axis object, optional
    grid : bool, optional
        Setting this to True will show the grid.
    diagonal : {'hist', 'kde'}
        Pick between 'kde' and 'hist' for either Kernel Density Estimation or
        Histogram plot in the diagonal.
    marker : str, optional
        Matplotlib marker type, default '.'.
    density_kwds : keywords
        Keyword arguments to be passed to kernel density estimate plot.
    hist_kwds : keywords
        Keyword arguments to be passed to hist function.
    range_padding : float, default 0.05
        Relative extension of axis range in x and y with respect to
        (x_max - x_min) or (y_max - y_min).
    **kwargs
        Keyword arguments to be passed to scatter function.
 
    Returns
    -------
    numpy.ndarray
        A matrix of scatter plots.
 
    Examples
    --------
 
    .. plot::
        :context: close-figs
 
        >>> df = pd.DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'])
        >>> pd.plotting.scatter_matrix(df, alpha=0.2)
        array([[<AxesSubplot: xlabel='A', ylabel='A'>,
            <AxesSubplot: xlabel='B', ylabel='A'>,
            <AxesSubplot: xlabel='C', ylabel='A'>,
            <AxesSubplot: xlabel='D', ylabel='A'>],
           [<AxesSubplot: xlabel='A', ylabel='B'>,
            <AxesSubplot: xlabel='B', ylabel='B'>,
            <AxesSubplot: xlabel='C', ylabel='B'>,
            <AxesSubplot: xlabel='D', ylabel='B'>],
           [<AxesSubplot: xlabel='A', ylabel='C'>,
            <AxesSubplot: xlabel='B', ylabel='C'>,
            <AxesSubplot: xlabel='C', ylabel='C'>,
            <AxesSubplot: xlabel='D', ylabel='C'>],
           [<AxesSubplot: xlabel='A', ylabel='D'>,
            <AxesSubplot: xlabel='B', ylabel='D'>,
            <AxesSubplot: xlabel='C', ylabel='D'>,
            <AxesSubplot: xlabel='D', ylabel='D'>]], dtype=object)
    r )
r r!r"r r#r$r%Ú density_kwdsÚ    hist_kwdsr&)rÚscatter_matrix) r r!r"r r#r$r%r'r(r&rrrrrr)XsGö õr)z"list[str] | tuple[str, ...] | Noner)r Ú class_columnr ÚcolorrcKs$tdƒ}|jf|||||dœ|—ŽS)a’    
    Plot a multidimensional dataset in 2D.
 
    Each Series in the DataFrame is represented as a evenly distributed
    slice on a circle. Each data point is rendered in the circle according to
    the value on each Series. Highly correlated `Series` in the `DataFrame`
    are placed closer on the unit circle.
 
    RadViz allow to project a N-dimensional data set into a 2D space where the
    influence of each dimension can be interpreted as a balance between the
    influence of all dimensions.
 
    More info available at the `original article
    <https://doi.org/10.1145/331770.331775>`_
    describing RadViz.
 
    Parameters
    ----------
    frame : `DataFrame`
        Object holding the data.
    class_column : str
        Column name containing the name of the data point category.
    ax : :class:`matplotlib.axes.Axes`, optional
        A plot instance to which to add the information.
    color : list[str] or tuple[str], optional
        Assign a color to each category. Example: ['blue', 'green'].
    colormap : str or :class:`matplotlib.colors.Colormap`, default None
        Colormap to select colors from. If string, load colormap with that
        name from matplotlib.
    **kwds
        Options to pass to matplotlib scatter plotting method.
 
    Returns
    -------
    :class:`matplotlib.axes.Axes`
 
    See Also
    --------
    pandas.plotting.andrews_curves : Plot clustering visualization.
 
    Examples
    --------
 
    .. plot::
        :context: close-figs
 
        >>> df = pd.DataFrame(
        ...     {
        ...         'SepalLength': [6.5, 7.7, 5.1, 5.8, 7.6, 5.0, 5.4, 4.6, 6.7, 4.6],
        ...         'SepalWidth': [3.0, 3.8, 3.8, 2.7, 3.0, 2.3, 3.0, 3.2, 3.3, 3.6],
        ...         'PetalLength': [5.5, 6.7, 1.9, 5.1, 6.6, 3.3, 4.5, 1.4, 5.7, 1.0],
        ...         'PetalWidth': [1.8, 2.2, 0.4, 1.9, 2.1, 1.0, 1.5, 0.2, 2.1, 0.2],
        ...         'Category': [
        ...             'virginica',
        ...             'virginica',
        ...             'setosa',
        ...             'virginica',
        ...             'virginica',
        ...             'versicolor',
        ...             'versicolor',
        ...             'setosa',
        ...             'virginica',
        ...             'setosa'
        ...         ]
        ...     }
        ... )
        >>> pd.plotting.radviz(df, 'Category')
        <AxesSubplot: xlabel='y(t)', ylabel='y(t + 1)'>
    r )r r*r r+Úcolormap)rÚradviz)r r*r r+r,Úkwdsrrrrr-¯sMûúr-éÈÚint)r r*r Úsamplesr+rc    Ks&tdƒ}|jf||||||dœ|—ŽS)a9
    Generate a matplotlib plot for visualising clusters of multivariate data.
 
    Andrews curves have the functional form:
 
    .. math::
        f(t) = \frac{x_1}{\sqrt{2}} + x_2 \sin(t) + x_3 \cos(t) +
        x_4 \sin(2t) + x_5 \cos(2t) + \cdots
 
    Where :math:`x` coefficients correspond to the values of each dimension
    and :math:`t` is linearly spaced between :math:`-\pi` and :math:`+\pi`.
    Each row of frame then corresponds to a single curve.
 
    Parameters
    ----------
    frame : DataFrame
        Data to be plotted, preferably normalized to (0.0, 1.0).
    class_column : label
        Name of the column containing class names.
    ax : axes object, default None
        Axes to use.
    samples : int
        Number of points to plot in each curve.
    color : str, list[str] or tuple[str], optional
        Colors to use for the different classes. Colors can be strings
        or 3-element floating point RGB values.
    colormap : str or matplotlib colormap object, default None
        Colormap to select colors from. If a string, load colormap with that
        name from matplotlib.
    **kwargs
        Options to pass to matplotlib plotting method.
 
    Returns
    -------
    :class:`matplotlib.axes.Axes`
 
    Examples
    --------
 
    .. plot::
        :context: close-figs
 
        >>> df = pd.read_csv(
        ...     'https://raw.githubusercontent.com/pandas-dev/'
        ...     'pandas/main/pandas/tests/io/data/csv/iris.csv'
        ... )
        >>> pd.plotting.andrews_curves(df, 'Name')
        <AxesSubplot: title={'center': 'width'}>
    r )r r*r r1r+r,)rÚandrews_curves)r r*r r1r+r,rrrrrr2s:úùr2é2éôr
z Figure | Noner)ÚseriesÚfigÚsizer1rcKs"tdƒ}|jf||||dœ|—ŽS)a/
    Bootstrap plot on mean, median and mid-range statistics.
 
    The bootstrap plot is used to estimate the uncertainty of a statistic
    by relying on random sampling with replacement [1]_. This function will
    generate bootstrapping plots for mean, median and mid-range statistics
    for the given number of samples of the given size.
 
    .. [1] "Bootstrapping (statistics)" in     https://en.wikipedia.org/wiki/Bootstrapping_%28statistics%29
 
    Parameters
    ----------
    series : pandas.Series
        Series from where to get the samplings for the bootstrapping.
    fig : matplotlib.figure.Figure, default None
        If given, it will use the `fig` reference for plotting instead of
        creating a new one with default parameters.
    size : int, default 50
        Number of data points to consider during each sampling. It must be
        less than or equal to the length of the `series`.
    samples : int, default 500
        Number of times the bootstrap procedure is performed.
    **kwds
        Options to pass to matplotlib plotting method.
 
    Returns
    -------
    matplotlib.figure.Figure
        Matplotlib figure.
 
    See Also
    --------
    pandas.DataFrame.plot : Basic plotting for DataFrame objects.
    pandas.Series.plot : Basic plotting for Series objects.
 
    Examples
    --------
    This example draws a basic bootstrap plot for a Series.
 
    .. plot::
        :context: close-figs
 
        >>> s = pd.Series(np.random.uniform(size=100))
        >>> pd.plotting.bootstrap_plot(s)
        <Figure size 640x480 with 6 Axes>
    r )r5r6r7r1)rÚbootstrap_plot)r5r6r7r1r.rrrrr8Ms6ÿÿr8Tzlist[str] | Nonezlist | tuple | None)
r r*Úcolsr r+Ú use_columnsÚxticksÚaxvlinesÚ sort_labelsrc Ks0tdƒ} | jf||||||||||    |
dœ | —ŽS)aÊ
    Parallel coordinates plotting.
 
    Parameters
    ----------
    frame : DataFrame
    class_column : str
        Column name containing class names.
    cols : list, optional
        A list of column names to use.
    ax : matplotlib.axis, optional
        Matplotlib axis object.
    color : list or tuple, optional
        Colors to use for the different classes.
    use_columns : bool, optional
        If true, columns will be used as xticks.
    xticks : list or tuple, optional
        A list of values to use for xticks.
    colormap : str or matplotlib colormap, default None
        Colormap to use for line colors.
    axvlines : bool, optional
        If true, vertical lines will be added at each xtick.
    axvlines_kwds : keywords, optional
        Options to be passed to axvline method for vertical lines.
    sort_labels : bool, default False
        Sort class_column labels, useful when assigning colors.
    **kwargs
        Options to pass to matplotlib plotting method.
 
    Returns
    -------
    matplotlib.axes.Axes
 
    Examples
    --------
 
    .. plot::
        :context: close-figs
 
        >>> df = pd.read_csv(
        ...     'https://raw.githubusercontent.com/pandas-dev/'
        ...     'pandas/main/pandas/tests/io/data/csv/iris.csv'
        ... )
        >>> pd.plotting.parallel_coordinates(
        ...     df, 'Name', color=('#556270', '#4ECDC4', '#C7F464')
        ... )
        <AxesSubplot: xlabel='y(t)', ylabel='y(t + 1)'>
    r ) r r*r9r r+r:r;r,r<Ú axvlines_kwdsr=)rÚparallel_coordinates) r r*r9r r+r:r;r,r<r>r=rrrrrr?‰s >õ ôr?é)r5Úlagr rcKs tdƒ}|jf|||dœ|—ŽS)aµ
    Lag plot for time series.
 
    Parameters
    ----------
    series : Series
        The time series to visualize.
    lag : int, default 1
        Lag length of the scatter plot.
    ax : Matplotlib axis object, optional
        The matplotlib axis object to use.
    **kwds
        Matplotlib scatter method keyword arguments.
 
    Returns
    -------
    matplotlib.axes.Axes
 
    Examples
    --------
    Lag plots are most commonly used to look for patterns in time series data.
 
    Given the following time series
 
    .. plot::
        :context: close-figs
 
        >>> np.random.seed(5)
        >>> x = np.cumsum(np.random.normal(loc=1, scale=5, size=50))
        >>> s = pd.Series(x)
        >>> s.plot()
        <AxesSubplot: xlabel='Midrange'>
 
    A lag plot with ``lag=1`` returns
 
    .. plot::
        :context: close-figs
 
        >>> pd.plotting.lag_plot(s, lag=1)
        <AxesSubplot: xlabel='y(t)', ylabel='y(t + 1)'>
    r )r5rAr )rÚlag_plot)r5rAr r.rrrrrBØs*rB)r5r rcKstdƒ}|jf||dœ|—ŽS)a3
    Autocorrelation plot for time series.
 
    Parameters
    ----------
    series : Series
        The time series to visualize.
    ax : Matplotlib axis object, optional
        The matplotlib axis object to use.
    **kwargs
        Options to pass to matplotlib plotting method.
 
    Returns
    -------
    matplotlib.axes.Axes
 
    Examples
    --------
    The horizontal lines in the plot correspond to 95% and 99% confidence bands.
 
    The dashed line is 99% confidence band.
 
    .. plot::
        :context: close-figs
 
        >>> spacing = np.linspace(-9 * np.pi, 9 * np.pi, num=1000)
        >>> s = pd.Series(0.7 * np.random.rand(1000) + 0.3 * np.sin(spacing))
        >>> pd.plotting.autocorrelation_plot(s)
        <AxesSubplot: title={'center': 'width'}, xlabel='Lag', ylabel='Autocorrelation'>
    r )r5r )rÚautocorrelation_plot)r5r rrrrrrCsrCcs¢eZdZdZddiZdgZddddœ‡fdd    „ Z‡fd
d „Zdd œ‡fd d„ Zdd œ‡fdd„ Z    dd œ‡fdd„ Z
dd œdd„Z dd„Z e dd œdd„ƒZ‡ZS)Ú_Optionsa
    Stores pandas plotting options.
 
    Allows for parameter aliasing so you can just use parameter names that are
    the same as the plot function parameters, but is stored in a canonical
    format that makes it easy to breakdown into groups later.
    Zx_compatú xaxis.compatFrr)Ú
deprecatedrcs||_tƒ dd¡dS)NrEF)Z _deprecatedÚsuperÚ __setitem__)ÚselfrF©Ú    __class__rrÚ__init__6sz_Options.__init__cs,| |¡}||kr t|›dƒ‚tƒ |¡S)Nz& is not a valid pandas plotting option)Ú_get_canonical_keyÚ
ValueErrorrGÚ __getitem__©rIÚkeyrJrrrO:s
z_Options.__getitem__rcs| |¡}tƒ ||¡dS©N)rMrGrH)rIrQÚvaluerJrrrH@s
z_Options.__setitem__cs2| |¡}||jkr"td|›ƒ‚tƒ |¡dS)Nz Cannot remove default parameter )rMÚ _DEFAULT_KEYSrNrGÚ __delitem__rPrJrrrUDs
 
z_Options.__delitem__cs| |¡}tƒ |¡SrR)rMrGÚ __contains__rPrJrrrVJs
z_Options.__contains__cCs | ¡dS)zk
        Reset the option store to its initial state
 
        Returns
        -------
        None
        N)rL)rIrrrÚresetNs    z_Options.resetcCs|j ||¡SrR)Ú_ALIASESÚgetrPrrrrMYsz_Options._get_canonical_keyzGenerator[_Options, None, None]c    cs*||}z|||<|VW5|||<XdS)zg
        Temporarily set a parameter value using the with statement.
        Aliasing allowed.
        Nr)rIrQrSÚ    old_valuerrrÚuse\s
 
z _Options.use)F)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rXrTrLrOrHrUrVrWrMrr[Ú __classcell__rrrJrrD)s      rD)    rNNFrrNNr)NNN)Nr/NN)Nr3r4)    NNNFNNTNF)r@N)N)Ú
__future__rÚ
contextlibrÚtypingrrZpandas.plotting._corerZmatplotlib.axesrZmatplotlib.figurerÚnumpyÚnpZpandasr    r
rrrr)r-r2r8r?rBrCÚdictrDZ plot_paramsrrrrÚ<module>s`     ö Zû[úHü?õ"O.#A