Learn R Programming

esvis (version 0.2.0)

create_legend: Create a legend for a plot

Description

This is an alternative legend for plots which uses the actual plotting environment to create the legend, rather than overlaying it. I prefer this legend because it scales better than the base legend. It is currently only implemented to support lines.

Usage

create_legend(n, leg_labels, left_mar = 0, height = NULL,
  main_cols = NULL, cut = NULL, cut_cols = NULL, n_1 = FALSE, ...)

Arguments

n

Number of lines to produce on the legend.

leg_labels

Labels for the lines in the legend.

left_mar

Left margin argument. Defaults to 0. Larger numbers push the legend more to the right.

height

The height of the legend. Counter-intuitively, larger numbers result in a smaller legend (more squished to the bottom).

main_cols

Primary colors (of the lines, rather than the cut scores)

cut

Cut scores (see pp_plot).

cut_cols

The color of the lines/points for the cut scores.

n_1

Should the lines on the legend be displayed when there is only one value? Defaults to FALSE, and is relevant when values to cut are provided.

...

Additional arguments passed to lines.