File: quantile.rst

package info (click to toggle)
python-altair 5.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,952 kB
  • sloc: python: 25,649; sh: 14; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download
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
.. currentmodule:: altair

.. _user-guide-quantile-transform:

Quantile
~~~~~~~~
The quantile transform calculates empirical `quantile <https://en.wikipedia.org/wiki/Quantile>`_
values for input data. If a groupby parameter is provided, quantiles are estimated
separately per group. Among other uses, the quantile transform is useful for creating
`quantile-quantile (Q-Q) plots <https://en.wikipedia.org/wiki/Q%E2%80%93Q_plot>`_.

Here is an example of a quantile plot of normally-distributed data:

.. altair-plot::

   import altair as alt
   import pandas as pd
   import numpy as np

   np.random.seed(42)
   df = pd.DataFrame({'x': np.random.randn(200)})

   alt.Chart(df).transform_quantile(
       'x', step=0.01
   ).mark_point().encode(
       x='prob:Q',
       y='value:Q'
   )

Transform Options
^^^^^^^^^^^^^^^^^
The :meth:`~Chart.transform_quantile` method is built on the :class:`~QuantileTransform`
class, which has the following options:

.. altair-object-table:: altair.QuantileTransform