mark_value
mark_value(
plot,
value,
axis='x',
colour='black',
linewidth=1,
label=None,
**kwargs,
)Mark a single value on a plot.
Adds a reference line (and optional label) at a single value: the “you are here” marker used on the NPS and quality gauges. The label is justified into the panel next to the marker line, so it is not clipped at the edge.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| plot | plotnine.ggplot | A chart. | required |
| value | float | Position of the marker. | required |
| axis | str | Axis the value is on: “x” (default, a vertical line) or “y” (a horizontal line). | 'x' |
| colour | Line appearance. | 'black' |
|
| linewidth | Line appearance. | 'black' |
|
| label | str | Text drawn at the marker. | None |
| **kwargs | Passed to plotnine’s annotate() for the label, overriding the default placement. |
{} |
Returns
| Name | Type | Description |
|---|---|---|
| plotnine.ggplot | The chart with the marker added. |
See Also
annotate_bands
Examples
>>> p = plot_bars(calc_percentage(podracing_survey, "demo_gender"))
>>> mark_value(p, 20, axis="y", label="Target 20%")