plotlet v0.6.2

qq

Distributions

Minimal call

import random
rng = random.Random(16)
sample = [rng.gauss(0, 1) + 0.2 * (rng.expovariate(1) - 1) for _ in range(150)]
df = {"s": sample}

c = pt.chart(df, aes(sample="s"), xlabel="theoretical", ylabel="sample")
c.add_qq(dist="normal")

Worked example

import random

import plotlet as pt
from plotlet import aes

rng = random.Random(16)
df = {"s": [rng.gauss(0, 1) + 0.2 * (rng.expovariate(1) - 1)
            for _ in range(150)]}

c = pt.chart(df, aes(sample="s"),
             title="Q-Q vs N(0, 1)",
             xlabel="theoretical quantile", ylabel="sample quantile",
             data_width=260, data_height=230)
c.add_qq(dist="normal")

Docstring

Quantile-quantile plot — sample vs theoretical quantiles.

The classic "is my sample normal?" diagnostic. Default comparison is the
standard normal; pass a `scipy.stats` distribution (or another sample)
for an arbitrary reference.

API:
  c.add_qq(aes(sample="col"))                    # vs N(0, 1)
  c.add_qq(aes(sample="col"), dist=other)        # two-sample / scipy RV
  c.add_qq(aes(sample="col", color="group"))     # one series per level

The dashed reference line passes through the 0.25/0.75 quantile pair —
robust to outliers in the tails. Ungrouped it stays neutral gray; with
`aes(color=...)` grouping each group's line takes the group color.

Aesthetics:
  color=          bare → literal point color; aes(color="col") → one
                  series per level
  palette=        maps levels → colors when color is mapped in aes

Styling kwargs:
  dist="normal"   "normal" | another sample | scipy.stats RV
  size=2.5        point radius in pixels
  alpha=0.7       point opacity
  rasterize=None  None = auto-raster the dots to one <image> above the
                  point threshold (the reference line stays vector);
                  True/False forces it on/off