Minimal call
import random
rng = random.Random(0)
data = {"grp": [], "value": []}
for i, grp in enumerate(["a", "b", "c"]):
data["grp"] += [grp] * 40
data["value"] += [rng.gauss(5 + i, 1 + 0.3 * i) for _ in range(40)]
c = pt.chart(data, aes(x="grp", y="value"), ylabel="value")
c.add_boxplot()
Worked example
import plotlet as pt
from plotlet import aes
df = pt.load_dataset("tips")
c = pt.chart(df, aes(x="day", y="total_bill"),
title="bill by day", ylabel="total bill ($)",
data_width=340, data_height=220)
c.xscale("category", order=["Thur", "Fri", "Sat", "Sun"])
c.add_boxplot()
c.add_strip(size=2.5, alpha=0.45)
Docstring
Tukey-style box-and-whisker: Q1-Q3 box, median line, 1.5*IQR whiskers, outlier dots.
Long-form only:
c.add_boxplot(aes(x="cat", y="value"))
c.add_boxplot(aes(x="cat", y="value", fill="group"), palette={...})
Mapping `aes(fill="col")` dodges sub-boxes side-by-side within each cat and
emits one legend entry per group level. A bare literal `fill="#hex"` paints
every box the same color; `fill=False` leaves them outline-only.
Aesthetics:
fill=True/<literal>/False body fill (True = palette/cycle default,
bare literal color string, or False for
outline-only); aes(fill="col") → grouping
color=<literal> box / whisker / cap stroke (defaults to frame color)
palette= maps group levels → fills when fill is mapped in aes
Other styling kwargs:
orientation='v' 'h' for horizontal (cats on y axis)
width=0.6 total dodge-group width as a band fraction
gap=0.1 slot-gap fraction between dodged boxes
fill_alpha=0.55 box-fill opacity
linewidth=1 border / whisker / cap stroke width
median_linewidth=1.6 median line stroke width
notch=False draw 95 % CI waist on the box
showmeans=False show mean as a small triangle marker
mean_marker='^' marker kind for the mean indicator
whis=1.5 IQR multiplier for whisker fences
showfliers=True False hides outliers
flier_size=2.2 outlier-marker radius
flier_color=<color> override outlier stroke color