plotlet v0.6.2

freqpoly

Distributions

Minimal call

import random
rng = random.Random(14)
df1 = {"x": [rng.gauss(0, 1) for _ in range(400)]}
df2 = {"x": [rng.gauss(1, 1.4) for _ in range(400)]}

c = pt.chart(xlabel="value", ylabel="count")
c.add_freqpoly(df1, aes(x="x"), bins=25)
c.add_freqpoly(df2, aes(x="x"), bins=25)

Docstring

Frequency polygon — histogram drawn as a line through bin midpoints.

Better than overlaid `hist` calls when comparing two or more distributions
— no fill-blocking, no semi-transparent muddle.

  c.add_freqpoly(aes(x="col"))                       # columns via aes
  c.add_freqpoly(aes(x="col", color="group"))        # one polygon per group

Multi-group overlays share bin edges so the polygons are comparable.

Aesthetics:
  color=         bare → literal line color; aes(color="col") → grouped polygons
  palette=       maps group levels → colors when color is mapped in aes

Other styling kwargs:
  bins=20         number of bins
  density=False   True normalises so area under each polygon is 1
  linewidth=1.6   stroke width
  label=None      legend label (single-series only)