Skip to contents

This helper caches the output of a breaks function (such as scales::breaks_width()). This means that the first time the breaks are computed with the helper, the resulting breaks vector will be stored. All subsequent invocations of the helper will return the same stored breaks, regardless of the limits provided.

Usage

breaks_cached(breaks)

Arguments

breaks

A function that takes the limits as input and returns breaks as output. See ggplot2::continuous_scale for details.

Value

A wrapped breaks function suitable for use with ggplot scales.

Details

In general this is not what you want, since the breaks should change when the limits change.