Skip to contents

Modifies the legend position and margins to place it closer to the plot area than the default ggplot2 spacing.

Usage

closer_legend(
  position = "bottom",
  amount = 12,
  unit = "pt",
  justify = "center"
)

Arguments

position

Character string specifying the legend position ('bottom', 'top', etc.)

amount

Numeric value for the amount to move the legend closer to the plot area

unit

Character string specifying the unit of the move amount ('pt', 'px', etc.)

justify

Character string specifying the justification of the legend ('center', 'left', 'right', 'top', 'bottom')

Value

A ggplot2 theme object that modifies legend positioning