adjust_ylim: Adjust y-axis limits of 'ggplot2' object

View source: R/nested_loop.R

adjust_ylimR Documentation

Adjust y-axis limits of ggplot2 object

Description

Set y-axis limits in a way which is useful for the output from nested_loop_plot. Makes functionality of expand_scale available.

Usage

adjust_ylim(p, y_expand_mult = NULL, y_expand_add = NULL)

Arguments

y_expand_mult

NULL, a named list or a vector of length 2. Used for adjustments to the display area similar to what expand_scale does. The lower limit of display will be expanded by a fraction of the plotting range as given by the first entry of the vector, the upper limit by a fraction according to the second entry. Useful to adjust the y-axis when steps for design parameters are drawn below the results. If a list, then the names of the list should correspond to facet panels of the plot and the entries should be vectors of length two, which apply the scale expansion only to the specified facets. If NULL, then no adjustment is done.

y_expand_add

NULL, a named list or a vector of length 2. Used for adjustments to the display area similar to what expand_scale does. The lower limit of display will be changed by addition of the first entry, the upper limit by addition of the second entry. Specified in y-axis coordinates. Useful to adjust the y-axis when steps for design parameters are drawn below the results. If a list, then the names of the list should correspond to facet panels of the plot and the entries should be vectors of length two, which apply the scale expansion only to the specified facets. If NULL, then no adjustment is done.

Details

Often helpful to deal with clipping issue when e.g. text is not fully displayed within the plot.

This function extends the axis range via additive or multiplicative factors.

Note that all numeric values are converted to absolute values (i.e. this function can not be used to shrink the y-axis).

Value

A ggplot2 object.


matherealize/looplot documentation built on May 24, 2024, 9:14 a.m.