make_log_breaks: Make pretty breaks and labels for a log axis

View source: R/make_log_breaks.R

make_log_breaksR Documentation

Make pretty breaks and labels for a log axis

Description

make_log_breaks creates a set of evenly spaced breaks and labels in what will be a log-transformed axis. These are set up to be used with a ggplot2 log-transformed axis like this, where "G" is whatever else you have specified for a ggplot2 graph and "MyBreaks" is the output from running make_log_breaks: G + scale_y_log10(limits = MyBreaks$axis_limits_log, breaks = MyBreaks$breaks, labels = MyBreaks$labels) If the limits are powers of 10, this will put breaks at all powers of 10, and, if not, it will guess at reasonably spaced intervals. Note that this will make it so that there are unlabeled tick marks between the labels; this is to help make it clearer visually that the axis has been log transformed.

Usage

make_log_breaks(data_range, axis_limits_log = NA)

Arguments

data_range

the range of values to be plotted on a log-transformed axis

axis_limits_log

desired axis limits for an axis that will be log transformed. Leave this as NA if you'd like us to make a reasonable guess.

Value

a list of log axis breaks and log axis labels

Examples

# none



shirewoman2/Consultancy documentation built on Feb. 18, 2025, 10 p.m.