plot_nps_gauge

plot_nps_gauge(
    score,
    scale='nps',
    title=None,
    height=GAUGE_HEIGHT,
    label_size=None,
)

Score gauge with decision bands and a value marker.

A horizontal gauge that places a single score (NPS or mean rating) onto a banded scale with a black “you are here” marker, for the headline “where do we stand” slide. “nps” uses a -100..100 scale banded from needs-work to excellent; “rating” uses a 1..5 scale with BAD/OK/GOOD bands. Pair it with calc_nps() for the score.

Parameters

Name Type Description Default
score float The score to mark (NPS on -100..100, or a mean rating on 1..5). required
scale str “nps” (default) or “rating”. 'nps'
title str Title; a sensible default is generated from score. None
height float Bar thickness in plot units. Default 0.5. GAUGE_HEIGHT
label_size float Band-label size in points. None (default) matches the theme’s base font size (11 pt). None

Returns

Name Type Description
plotnine.ggplot The chart.

See Also

calc_nps, plot_nps, plot_gauges

Examples

>>> plot_nps_gauge(calc_nps(podracing_survey, "nps_value")["nps"].iloc[0])
>>> plot_nps_gauge(3.8, scale="rating")