liveBook · Manning

Label_dollar() function

As explained in Statistics Slam Dunk

The label_dollar() function from the scales package formats numeric values as currency labels with a dollar-sign prefix.

label_dollar() from the scales package formats numeric plot labels as US currency by adding a dollar-sign prefix. Used with ggplot2 continuous scales, it makes payroll axes easier to read. section 10.4.2

Format NBA payroll axes

Pass label_dollar() to scale_x_continuous() or scale_y_continuous(). Combining it with cut_short_scale() turns 20000000 into a compact label such as $20M; rotating axis labels can improve fit. section 10.4.2 section 10.4.3

How Statistics Slam Dunk covers it

How deep it goes
Demonstrates placement within continuous scales and compact-label composition with cut_short_scale(), without detailing formatter internals.
Examples
Uses NBA payroll dot plots, payroll-comparison lollipop charts, and salary-per-win bar charts.
What it assumes
Assumes basic R and ggplot2 scale syntax while demonstrating the formatter in complete plotting workflows.
What you can do after
Apply it via ggplot2 to display numeric monetary axes with readable dollar-prefixed labels.
How it connects
Connects label_dollar() with scales, ggplot2, scale_x_continuous(), scale_y_continuous(), and cut_short_scale().

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.