Skip to contents

This function creates a scatter plot of legislators' ideal points based on W-NOMINATE analysis results. The plot can optionally include confidence ellipses around the points, representing uncertainty in the coordinates.

Usage

plot_wnom_coords(
  obj,
  shapeVar = NULL,
  dropNV = FALSE,
  ptSize = 4,
  ci = FALSE,
  level = 0.95
)

Arguments

obj

An object of class wnominate containing the results of a W-NOMINATE analysis, including legislators' ideal points and associated uncertainties.

shapeVar

An optional variable used to differentiate groups of legislators by shape and color in the plot. If provided, the points will be shaped and colored according to this variable.

dropNV

A logical value indicating whether to drop non-voters (NA values) from the plot. Default is FALSE.

ptSize

A numeric value specifying the size of the points in the plot. Default is 4.

ci

A logical value indicating whether to include confidence ellipses around the points. Default is FALSE.

level

A numeric value specifying the confidence level for the ellipses. Default is 0.95.

Value

A ggplot object displaying the legislators' coordinates, optionally with confidence ellipses.

Examples

if (FALSE) { # \dontrun{
# Assuming `result` is a wnominate object and `legislator_data` contains a grouping variable
g <- plot_wnom_coords(result, dropNV = TRUE, ci = TRUE)
print(g)
} # }