plotlet v0.6.2

pointplot

Categorical

["w1","w2","w4","w8"]

Minimal call

import random
rng = random.Random(7)
data = {"t": [], "score": []}
for i, t in enumerate(["w1", "w2", "w4", "w8"]):
    data["t"] += [t] * 20
    data["score"] += [rng.gauss(5 + 0.4 * i, 1) for _ in range(20)]

c = pt.chart(data, aes(x="t", y="score"), ylabel="score")
c.add_pointplot()

Worked example

["1 wk","2 wk","4 wk","8 wk"]
import random

import plotlet as pt
from plotlet import aes

rng = random.Random(30)
weeks = ["1 wk", "2 wk", "4 wk", "8 wk"]
data = {"week": [], "score": [], "arm": []}
for arm, slope in (("control", 0.04), ("drug", 0.45)):
    for i, week in enumerate(weeks):
        for _ in range(20):
            data["week"].append(week)
            data["arm"].append(arm)
            data["score"].append(rng.gauss(5.0 + slope * i, 1.0))

c = pt.chart(data, aes(x="week", y="score", color="arm"),
             title="response over time", xlabel="timepoint",
             ylabel="score",
             data_width=320, data_height=200)
c.xscale("category", order=weeks)
c.add_pointplot()

Docstring

Categorical point estimate + CI bar + connecting line. Seaborn's pointplot.

CI options:
  ci="t"     -> t-distribution CI on the mean (analytic; classic textbook bar).
  ci="boot"  -> percentile bootstrap CI (default 1 000 resamples). Works for
                any estimator.
  ci=None    -> no CI, just points and connectors.

API (long-form only):
  c.add_pointplot(aes(x="cat", y="value"))
  c.add_pointplot(aes(x="cat", y="value", color="group"))   # one series per level

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

Styling kwargs:
  estimator='mean'   'median' for the central tendency
  ci='t'             see above
  level=0.95         confidence level
  n_boot=1000        bootstrap resamples (ci='boot' only)
  seed=0             RNG seed for bootstrap
  size=4             point radius in pixels
  capsize=4          half-width of CI cap tick in pixels
  linewidth=1.4      line and bar stroke width
  label=None         legend label (overridden by column-driven grouping)