plot_gauges

plot_gauges(
    scores,
    scales=None,
    title=None,
    height=GAUGE_HEIGHT,
    label_size=None,
)

Stacked score gauges (NPS over average quality, etc.).

Draws two or more scores as thin banded gauge bars stacked one above another, each on its own scale with a “you are here” marker: the headline summary slide, with the Net Promoter Score on top and the average quality rating below it. Each gauge is normalised to its own scale, so an NPS of +23 and a rating of 3.4 line up on a shared panel with the band boundaries drawn where each scale puts them. Each bar carries its own band boundaries as small numbers underneath, and a band too narrow to hold its name is left unlabelled rather than having the text run over its neighbours.

Parameters

Name Type Description Default
scores dict or pandas.Series Scores keyed by gauge label; the first is drawn at the top. required
scales str or list of str “nps” (a -100..100 scale) or “rating” (a 1..5 scale) per gauge, one value recycled or one per score. None (default) infers “rating” for a value in 1..5 and “nps” otherwise. None
title str Title. None (default) draws none. None
height float Bar thickness in plot units (row spacing is 1). Default 0.5. GAUGE_HEIGHT
label_size float Band-label size in points. None (default) is a compact 10 pt. None

Returns

Name Type Description
plotnine.ggplot The chart.

See Also

plot_nps_gauge, calc_nps, ipm_model

Examples

>>> nps = calc_nps(podracing_survey, "nps_value")["nps"].iloc[0]
>>> plot_gauges({"Net Promoter Score": nps, "Average quality rating": 3.4})