plotBLB: Plot a Binary Logistic Biplot

View source: R/plotBLB.R

plotBLBR Documentation

Plot a Binary Logistic Biplot

Description

Produces a ggplot2-based logistic biplot from a BiplotML object fitted with LogBip. Supports coloring and shaping of row markers by a categorical variable, filled arrowheads, dashed reference lines that span the full plot area, and flexible axis-limit control via xylim, xlim, and ylim.

Usage

plotBLB(
  x,
  dim = c(1, 2),
  col.ind = NULL,
  col.var = "#0E185F",
  label.ind = FALSE,
  draw = c("biplot", "ind", "var"),
  titles = NULL,
  ellipses = FALSE,
  endsegm = 0.75,
  repel = FALSE,
  xylim = NULL,
  xlim = NULL,
  ylim = NULL,
  escala = NULL
)

Arguments

x

An object of class BiplotML, as returned by LogBip.

dim

Integer vector of length 2 specifying which dimensions to plot. Default is c(1, 2).

col.ind

Optional vector of the same length as the number of rows in the original data, used to color and shape the row markers by a categorical variable (e.g., col.ind = df$group). Levels are mapped to the "Set1" palette and to filled geometric shapes. If NULL (default), all row markers are drawn as gold triangles (shape = 17, color "#E7B800") when no col.ind is provided.

col.var

Color for the variable arrows. Default is "#0E185F" (dark navy).

label.ind

Logical; if TRUE, row markers are labelled. Default is FALSE.

draw

Which graph to draw. One of "biplot" (default, both row and column markers), "ind" (row markers only), or "var" (variable arrows only). Partial matching is supported.

titles

Main title for the plot. If NULL (default), a generic title is used depending on draw.

ellipses

Logical; if TRUE, bootstrap confidence ellipses are drawn around the row markers. Requires a bootstrap fit

endsegm

End point of the variable arrow on the probability scale. The arrow starts at p = 0.5 and ends at this value. Default is 0.75.

repel

Logical; if TRUE, overlapping variable labels are repelled using ggrepel. Default is FALSE.

xylim

Numeric vector of length 2 specifying a symmetric range applied to both axes, e.g., c(-80, 80). Overrides automatic limits. Takes precedence over automatic limits but is overridden by xlim/ylim if those are also supplied. Default is NULL.

xlim

Numeric vector of length 2 specifying the range of the x-axis independently, e.g., c(-100, 60). Takes precedence over xylim. Default is NULL.

ylim

Numeric vector of length 2 specifying the range of the y-axis independently, e.g., c(-80, 80). Takes precedence over xylim. Default is NULL.

escala

Positive numeric scalar. Multiplicative factor applied to the row marker coordinates (x$Ahat) before plotting, so that they are on a comparable visual scale to the variable arrows. If NULL (default), the value is chosen automatically so that the range of the scaled row markers matches the range of the variable arrows, producing a visually balanced biplot. Pass an explicit numeric value to override the automatic calculation (e.g., escala = 65).

Details

Variable vectors are drawn as arrows from the point where the predicted probability equals 0.5 to the point where it equals endsegm. Short arrows indicate a rapid increase in the probability of the corresponding characteristic. The orthogonal projection of a row marker onto a variable's arrow approximates the probability that the characteristic is present for that individual.

The three arguments that control axis limits are evaluated in the following order of priority:

  1. xlim and ylim (independent limits for each axis).

  2. xylim (symmetric limits applied to both axes).

  3. Automatic limits derived from all plotted elements.

The escala argument multiplies the row marker coordinates before plotting so that they are visually comparable to the variable arrows, which are expressed in the original parameter units. It only affects the display, not the stored coordinates.

Value

A ggplot2 object that can be further customised with standard ggplot2 functions (e.g., theme(), labs()).

Author(s)

Giovany Babativa <jgbabativam@unal.edu.co>

References

Meulman, J. J., & Heiser, W. J. (1983). The Display of Bootstrap Solutions in Multidimensional Scaling (Technical memorandum). Bell Laboratories.

Vicente-Villardon, J. L., & Galindo, M. P. (2006). Logistic biplots. In M. Greenacre & J. Blasius (Eds.), Multiple Correspondence Analysis and Related Methods (pp. 503–521). Chapman & Hall.

See Also

LogBip

Examples


data("Methylation")
set.seed(123456)
res <- LogBip(x = Methylation, method = "MM", maxit = 1000, plot = FALSE)


BiplotML documentation built on May 8, 2026, 5:06 p.m.

Related to plotBLB in BiplotML...