From 6bd3a1620ba2470aa82f982ddb77e2b5ced21b6b Mon Sep 17 00:00:00 2001 From: Mark Heckmann Date: Wed, 25 Mar 2026 22:39:27 +0100 Subject: [PATCH 1/4] calibrated biplot axes v1 #77 --- R/repgrid-plots.r | 146 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/R/repgrid-plots.r b/R/repgrid-plots.r index c390fb1..43de9a1 100644 --- a/R/repgrid-plots.r +++ b/R/repgrid-plots.r @@ -655,6 +655,9 @@ prepareBiplotData <- function(x, dim = c(1, 2), map.dim = 3, se <- 1 sc <- 1 } + x@calcs$biplot$se <- se + x@calcs$biplot$sc <- sc + Cu <- C * sc Eu <- E * se @@ -1235,6 +1238,126 @@ addVarianceExplainedToBiplot2d <- function(x, dim = c(1, 2, 3), var.cex = .7, } } + +#' Add calibrated axes (tick marks with original scale values) to a 2D biplot. +#' +#' Calibrated axes allow reading off approximated original ratings by projecting +#' element points onto construct axes. Each tick mark corresponds to a value on +#' the original rating scale. +#' +#' @param x `repgrid` object after [calcBiplotCoords()] and [prepareBiplotData()]. +#' @param dim Dimensions displayed in the biplot (default `c(1, 2)`). +#' @param center Centering type used (must match the biplot calculation). +#' @param normalize Normalization type used. +#' @param g Power for left singular vectors. +#' @param h Power for right singular vectors. +#' @param col.active Active columns. +#' @param col.passive Passive columns. +#' @param calibrated.tick.length Length of tick marks in plot coordinates (default `0.02`). +#' @param calibrated.cex Text size for tick labels (default `0.6`). +#' @param calibrated.col Color for tick marks and labels (default `grey(0.4)`). +#' @param ... Not evaluated. +#' @keywords internal +#' @export +#' +addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), + center = 1, + normalize = 0, + g = 0, h = 1 - g, + col.active = NA, + col.passive = NA, + calibrated.tick.length = 0.02, + calibrated.cex = 0.6, + calibrated.col = grey(0.4), + ...) { + # get unscaled construct coords and element scaling factor + C <- x@calcs$biplot$con + se <- x@calcs$biplot$se + nc <- nrow(C) + + # compute centering offsets per construct + dat <- x@ratings[, , 1] + if (center == 0) { + offsets <- rep(0, nc) + } else if (center == 1) { + offsets <- rowMeans(dat, na.rm = TRUE) + } else if (center == 2) { + offsets <- rep(0, nc) + } else if (center == 3) { + offsets <- rowMeans(dat, na.rm = TRUE) + } else if (center == 4) { + offsets <- rep(getScaleMidpoint(x), nc) + } + + # scale values + v_min <- x@scale$min + v_max <- x@scale$max + values <- seq(v_min, v_max) + + # determine which constructs are visible from plotdata + pd <- x@plotdata + visible <- pd$type == "cr" & pd$showlabel == TRUE + visible_idx <- which(visible) + # map plotdata row index back to construct index (cr rows are in order) + cr_rows <- which(pd$type == "cr") + + # determine plot extent for clipping + max.all <- max(abs(pd$x), abs(pd$y)) + max.ext <- max.all * 1.1 + + for (k in seq_along(cr_rows)) { + if (!visible[cr_rows[k]]) next + + i <- k # construct index + Ci <- C[i, dim[1:2]] + norm2 <- sum(Ci^2) + if (norm2 < 1e-10) next # skip degenerate constructs + + # perpendicular unit vector for tick marks + perp <- c(-Ci[2], Ci[1]) / sqrt(norm2) + + # axis angle for text rotation (perpendicular to axis) + axis_angle <- atan2(Ci[2], Ci[1]) * 180 / pi + label_srt <- axis_angle + 90 + # keep angle in readable range + if (label_srt > 90) label_srt <- label_srt - 180 + if (label_srt < -90) label_srt <- label_srt + 180 + + for (v in values) { + v_centered <- v - offsets[i] + tick_x <- se * v_centered * Ci[1] / norm2 + tick_y <- se * v_centered * Ci[2] / norm2 + + # skip ticks too close to origin (avoids clutter in center) + tick_dist <- sqrt(tick_x^2 + tick_y^2) + if (tick_dist < max.ext * 0.03) next + + # clip to plot area + if (abs(tick_x) > max.ext || abs(tick_y) > max.ext) next + + # draw tick mark + segments( + tick_x - perp[1] * calibrated.tick.length, + tick_y - perp[2] * calibrated.tick.length, + tick_x + perp[1] * calibrated.tick.length, + tick_y + perp[2] * calibrated.tick.length, + col = calibrated.col + ) + + # draw label offset slightly from tick + label_offset <- 2.0 * calibrated.tick.length + text( + tick_x + perp[1] * label_offset, + tick_y + perp[2] * label_offset, + labels = v, srt = label_srt, + cex = calibrated.cex, col = calibrated.col, + adj = c(0.5, 0) + ) + } + } +} + + # x <- randomGrid(20, 40) # x <- boeker # x <- raeithel @@ -1480,6 +1603,15 @@ addVarianceExplainedToBiplot2d <- function(x, dim = c(1, 2, 3), var.cex = .7, #' @param var.show Show explained sum-of-squares in biplot? (default `TRUE`). #' @param var.cex The cex value for the percentages shown in the plot. #' @param var.col The color value of the percentages shown in the plot. +#' @param calibrated Logical. Whether to draw calibrated axes with tick marks showing +#' original scale values on each construct axis (default `FALSE`). +#' This allows to read off approximated original ratings by projecting +#' element points onto construct axes. +#' @param calibrated.tick.length Length of calibrated axis tick marks in plot coordinates +#' (default `0.02`). +#' @param calibrated.cex Text size for calibrated axis tick labels (default `0.6`). +#' @param calibrated.col Color for calibrated axis tick marks and labels +#' (default `grey(0.4)`). #' @param ... parameters passed on to come. #' @export #' @seealso @@ -1589,6 +1721,10 @@ biplot2d <- function(x, dim = c(1, 2), map.dim = 3, var.show = TRUE, var.cex = .7, var.col = grey(.1), + calibrated = FALSE, + calibrated.tick.length = 0.02, + calibrated.cex = 0.6, + calibrated.col = grey(0.4), ...) { x <- calcBiplotCoords(x, center = center, normalize = normalize, @@ -1633,6 +1769,16 @@ biplot2d <- function(x, dim = c(1, 2), map.dim = 3, axis.ext = axis.ext, mai = mai, rect.margins = rect.margins, srt = srt, cex.pos = cex.pos, xpd = xpd, zoom = zoom ) + if (calibrated) { + addCalibratedAxesToBiplot2d(x, + dim = dim, center = center, normalize = normalize, + g = g, h = h, col.active = col.active, + col.passive = col.passive, + calibrated.tick.length = calibrated.tick.length, + calibrated.cex = calibrated.cex, + calibrated.col = calibrated.col, ... + ) + } addVarianceExplainedToBiplot2d(x, dim = dim, center = center, normalize = normalize, g = g, h = h, col.active = col.active, From 826e972c31b4418276204370c8b0274d814a4a96 Mon Sep 17 00:00:00 2001 From: Mark Heckmann Date: Wed, 25 Mar 2026 22:46:29 +0100 Subject: [PATCH 2/4] Only show calibrated values on a subset of axes --- R/repgrid-plots.r | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/R/repgrid-plots.r b/R/repgrid-plots.r index 43de9a1..3d56cfa 100644 --- a/R/repgrid-plots.r +++ b/R/repgrid-plots.r @@ -1266,6 +1266,7 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), g = 0, h = 1 - g, col.active = NA, col.passive = NA, + calibrated = TRUE, calibrated.tick.length = 0.02, calibrated.cex = 0.6, calibrated.col = grey(0.4), @@ -1294,10 +1295,14 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), v_max <- x@scale$max values <- seq(v_min, v_max) + # determine which constructs to calibrate + # calibrated = TRUE: all visible constructs + # calibrated = numeric vector: only those construct indices + calibrate_idx <- if (isTRUE(calibrated)) seq_len(nc) else as.integer(calibrated) + # determine which constructs are visible from plotdata pd <- x@plotdata visible <- pd$type == "cr" & pd$showlabel == TRUE - visible_idx <- which(visible) # map plotdata row index back to construct index (cr rows are in order) cr_rows <- which(pd$type == "cr") @@ -1307,6 +1312,7 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), for (k in seq_along(cr_rows)) { if (!visible[cr_rows[k]]) next + if (!(k %in% calibrate_idx)) next i <- k # construct index Ci <- C[i, dim[1:2]] @@ -1603,10 +1609,12 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), #' @param var.show Show explained sum-of-squares in biplot? (default `TRUE`). #' @param var.cex The cex value for the percentages shown in the plot. #' @param var.col The color value of the percentages shown in the plot. -#' @param calibrated Logical. Whether to draw calibrated axes with tick marks showing -#' original scale values on each construct axis (default `FALSE`). -#' This allows to read off approximated original ratings by projecting -#' element points onto construct axes. +#' @param calibrated Logical or numeric. If `TRUE`, draw calibrated axes with tick marks +#' showing original scale values on all construct axes. If a numeric +#' vector, only draw calibrated axes for constructs with these indices +#' (e.g. `c(1, 3)` for constructs 1 and 3). Default is `FALSE`. +#' Calibrated axes allow reading off approximated original ratings +#' by projecting element points onto construct axes. #' @param calibrated.tick.length Length of calibrated axis tick marks in plot coordinates #' (default `0.02`). #' @param calibrated.cex Text size for calibrated axis tick labels (default `0.6`). @@ -1769,11 +1777,12 @@ biplot2d <- function(x, dim = c(1, 2), map.dim = 3, axis.ext = axis.ext, mai = mai, rect.margins = rect.margins, srt = srt, cex.pos = cex.pos, xpd = xpd, zoom = zoom ) - if (calibrated) { + if (!identical(calibrated, FALSE)) { addCalibratedAxesToBiplot2d(x, dim = dim, center = center, normalize = normalize, g = g, h = h, col.active = col.active, col.passive = col.passive, + calibrated = calibrated, calibrated.tick.length = calibrated.tick.length, calibrated.cex = calibrated.cex, calibrated.col = calibrated.col, ... From ef10d1896a223a2453122acaeddc00501f5003f1 Mon Sep 17 00:00:00 2001 From: Mark Heckmann Date: Wed, 25 Mar 2026 22:57:47 +0100 Subject: [PATCH 3/4] projections from elements onto axes --- R/repgrid-plots.r | 99 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/R/repgrid-plots.r b/R/repgrid-plots.r index 3d56cfa..6e4c273 100644 --- a/R/repgrid-plots.r +++ b/R/repgrid-plots.r @@ -1364,6 +1364,81 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), } +#' Add projection lines from elements onto construct axes in a 2D biplot. +#' +#' Draws perpendicular projection lines from element points onto construct axes, +#' showing where each element projects on the axis. This visualizes the +#' approximated original rating for each element-construct combination. +#' +#' @param x `repgrid` object after [calcBiplotCoords()] and [prepareBiplotData()]. +#' @param projections Logical or numeric. `TRUE` for all construct axes, +#' or a numeric vector of construct indices (default `TRUE`). +#' @param projections.e Logical or numeric. `TRUE` for all elements (default), +#' or a numeric vector of element indices. +#' @param projections.col Color of projection lines (default `grey(0.5)`). +#' @param projections.lty Line type for projection lines (default `3`, dotted). +#' @param projections.lwd Line width for projection lines (default `1`). +#' @param ... Not evaluated. +#' @keywords internal +#' @export +#' +addProjectionsToBiplot2d <- function(x, + projections = TRUE, + projections.e = TRUE, + projections.col = grey(0.5), + projections.lty = 3, + projections.lwd = 1, + ...) { + pd <- x@plotdata + nc <- getNoOfConstructs(x) + ne <- getNoOfElements(x) + + # which construct axes to project onto + c_idx <- if (isTRUE(projections)) seq_len(nc) else as.integer(projections) + + # which elements to project + e_idx <- if (isTRUE(projections.e)) seq_len(ne) else as.integer(projections.e) + + # element display coordinates (type "e" rows are first ne rows in plotdata) + e_rows <- which(pd$type == "e") + # construct right-pole rows give axis direction (type "cr" rows) + cr_rows <- which(pd$type == "cr") + + for (ci in c_idx) { + if (ci < 1 || ci > nc) next + + # construct axis direction from "cr" entry + cr_row <- cr_rows[ci] + ax <- c(pd$x[cr_row], pd$y[cr_row]) + norm2 <- sum(ax^2) + if (norm2 < 1e-10) next + + # unit direction vector + u <- ax / sqrt(norm2) + + for (ei in e_idx) { + if (ei < 1 || ei > ne) next + + e_row <- e_rows[ei] + ex <- pd$x[e_row] + ey <- pd$y[e_row] + + # scalar projection onto axis + s <- ex * u[1] + ey * u[2] + + # projection point on axis + px <- s * u[1] + py <- s * u[2] + + # draw projection line from element to projection point + segments(ex, ey, px, py, + col = projections.col, lty = projections.lty, lwd = projections.lwd + ) + } + } +} + + # x <- randomGrid(20, 40) # x <- boeker # x <- raeithel @@ -1620,6 +1695,16 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), #' @param calibrated.cex Text size for calibrated axis tick labels (default `0.6`). #' @param calibrated.col Color for calibrated axis tick marks and labels #' (default `grey(0.4)`). +#' @param projections Logical or numeric. If `TRUE`, draw perpendicular projection +#' lines from elements onto all construct axes. If a numeric vector, +#' only project onto constructs with these indices (e.g. `c(1, 3)`). +#' Default is `FALSE`. +#' @param projections.e Logical or numeric. Which elements to project. `TRUE` (default +#' when `projections` is active) projects all elements. A numeric +#' vector selects specific elements by index (e.g. `c(1, 5)`). +#' @param projections.col Color of projection lines (default `grey(0.5)`). +#' @param projections.lty Line type for projection lines (default `3`, dotted). +#' @param projections.lwd Line width for projection lines (default `1`). #' @param ... parameters passed on to come. #' @export #' @seealso @@ -1733,6 +1818,11 @@ biplot2d <- function(x, dim = c(1, 2), map.dim = 3, calibrated.tick.length = 0.02, calibrated.cex = 0.6, calibrated.col = grey(0.4), + projections = FALSE, + projections.e = TRUE, + projections.col = grey(0.5), + projections.lty = 3, + projections.lwd = 1, ...) { x <- calcBiplotCoords(x, center = center, normalize = normalize, @@ -1788,6 +1878,15 @@ biplot2d <- function(x, dim = c(1, 2), map.dim = 3, calibrated.col = calibrated.col, ... ) } + if (!identical(projections, FALSE)) { + addProjectionsToBiplot2d(x, + projections = projections, + projections.e = projections.e, + projections.col = projections.col, + projections.lty = projections.lty, + projections.lwd = projections.lwd, ... + ) + } addVarianceExplainedToBiplot2d(x, dim = dim, center = center, normalize = normalize, g = g, h = h, col.active = col.active, From fe145d7a2cf3645104c0e2d6ba25a32dddd3c8be Mon Sep 17 00:00:00 2001 From: Mark Heckmann Date: Wed, 25 Mar 2026 23:03:28 +0100 Subject: [PATCH 4/4] tweak projections, update docs --- NAMESPACE | 2 ++ NEWS.md | 5 +++ R/repgrid-plots.r | 31 ++++++++++++----- man/addCalibratedAxesToBiplot2d.Rd | 53 ++++++++++++++++++++++++++++++ man/addProjectionsToBiplot2d.Rd | 43 ++++++++++++++++++++++++ man/biplot2d.Rd | 43 ++++++++++++++++++++++++ 6 files changed, 169 insertions(+), 8 deletions(-) create mode 100644 man/addCalibratedAxesToBiplot2d.Rd create mode 100644 man/addProjectionsToBiplot2d.Rd diff --git a/NAMESPACE b/NAMESPACE index 73c9de2..7d3b4be 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -39,9 +39,11 @@ export("preferredPoles<-") export("ratings<-") export("rightpoles<-") export(addAvgElement) +export(addCalibratedAxesToBiplot2d) export(addConstruct) export(addElement) export(addIndexColumnToMatrix) +export(addProjectionsToBiplot2d) export(addVarianceExplainedToBiplot2d) export(alignByIdeal) export(alignByLoadings) diff --git a/NEWS.md b/NEWS.md index be64974..218a0fd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ # OpenRepGrid 0.1.19 (dev version) +* `biplot2d`: New arg `calibrated` draws calibrated axes with tick marks showing original rating scale + values on construct axes. Supports `TRUE` (all constructs) or a numeric vector of construct indices. +* `biplot2d`: New arg `projections` draws perpendicular projection lines from elements onto construct + axes. Supports `TRUE` (all) or numeric indices. `projections.e` selects which elements to project (#77) + `projections.col`, `projections.lty`, and `projections.lwd` accept per-element vectors for distinct styling. * `biplot2d`: Construct pole labels are automatically colorized by preference status (green = preferred, red = non-preferred, dark gray = neutral/undefined) when preferred poles are set in the repgrid object. New arg `c.color.preferred` controls the behavior (`NULL` = auto-detect, `TRUE` = always, `FALSE` = never) (#71). diff --git a/R/repgrid-plots.r b/R/repgrid-plots.r index 6e4c273..c09fcc4 100644 --- a/R/repgrid-plots.r +++ b/R/repgrid-plots.r @@ -1375,9 +1375,13 @@ addCalibratedAxesToBiplot2d <- function(x, dim = c(1, 2), #' or a numeric vector of construct indices (default `TRUE`). #' @param projections.e Logical or numeric. `TRUE` for all elements (default), #' or a numeric vector of element indices. -#' @param projections.col Color of projection lines (default `grey(0.5)`). -#' @param projections.lty Line type for projection lines (default `3`, dotted). -#' @param projections.lwd Line width for projection lines (default `1`). +#' @param projections.col Color(s) of projection lines (default `grey(0.5)`). +#' A vector of colors is recycled to match the number of selected elements, +#' so each element's projections can have a distinct color. +#' @param projections.lty Line type(s) for projection lines (default `3`, dotted). +#' Recycled per element like `projections.col`. +#' @param projections.lwd Line width(s) for projection lines (default `1`). +#' Recycled per element like `projections.col`. #' @param ... Not evaluated. #' @keywords internal #' @export @@ -1398,6 +1402,12 @@ addProjectionsToBiplot2d <- function(x, # which elements to project e_idx <- if (isTRUE(projections.e)) seq_len(ne) else as.integer(projections.e) + n_e <- length(e_idx) + + # recycle col, lty, lwd to match number of selected elements + projections.col <- rep_len(projections.col, n_e) + projections.lty <- rep_len(projections.lty, n_e) + projections.lwd <- rep_len(projections.lwd, n_e) # element display coordinates (type "e" rows are first ne rows in plotdata) e_rows <- which(pd$type == "e") @@ -1416,7 +1426,8 @@ addProjectionsToBiplot2d <- function(x, # unit direction vector u <- ax / sqrt(norm2) - for (ei in e_idx) { + for (k in seq_along(e_idx)) { + ei <- e_idx[k] if (ei < 1 || ei > ne) next e_row <- e_rows[ei] @@ -1432,7 +1443,7 @@ addProjectionsToBiplot2d <- function(x, # draw projection line from element to projection point segments(ex, ey, px, py, - col = projections.col, lty = projections.lty, lwd = projections.lwd + col = projections.col[k], lty = projections.lty[k], lwd = projections.lwd[k] ) } } @@ -1702,9 +1713,13 @@ addProjectionsToBiplot2d <- function(x, #' @param projections.e Logical or numeric. Which elements to project. `TRUE` (default #' when `projections` is active) projects all elements. A numeric #' vector selects specific elements by index (e.g. `c(1, 5)`). -#' @param projections.col Color of projection lines (default `grey(0.5)`). -#' @param projections.lty Line type for projection lines (default `3`, dotted). -#' @param projections.lwd Line width for projection lines (default `1`). +#' @param projections.col Color(s) of projection lines (default `grey(0.5)`). +#' A vector is recycled per element, so each element can have +#' a distinct color (e.g. `c("red", "blue")` for two elements). +#' @param projections.lty Line type(s) for projection lines (default `3`, dotted). +#' Recycled per element like `projections.col`. +#' @param projections.lwd Line width(s) for projection lines (default `1`). +#' Recycled per element like `projections.col`. #' @param ... parameters passed on to come. #' @export #' @seealso diff --git a/man/addCalibratedAxesToBiplot2d.Rd b/man/addCalibratedAxesToBiplot2d.Rd new file mode 100644 index 0000000..8ed7c3a --- /dev/null +++ b/man/addCalibratedAxesToBiplot2d.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/repgrid-plots.r +\name{addCalibratedAxesToBiplot2d} +\alias{addCalibratedAxesToBiplot2d} +\title{Add calibrated axes (tick marks with original scale values) to a 2D biplot.} +\usage{ +addCalibratedAxesToBiplot2d( + x, + dim = c(1, 2), + center = 1, + normalize = 0, + g = 0, + h = 1 - g, + col.active = NA, + col.passive = NA, + calibrated = TRUE, + calibrated.tick.length = 0.02, + calibrated.cex = 0.6, + calibrated.col = grey(0.4), + ... +) +} +\arguments{ +\item{x}{\code{repgrid} object after \code{\link[=calcBiplotCoords]{calcBiplotCoords()}} and \code{\link[=prepareBiplotData]{prepareBiplotData()}}.} + +\item{dim}{Dimensions displayed in the biplot (default \code{c(1, 2)}).} + +\item{center}{Centering type used (must match the biplot calculation).} + +\item{normalize}{Normalization type used.} + +\item{g}{Power for left singular vectors.} + +\item{h}{Power for right singular vectors.} + +\item{col.active}{Active columns.} + +\item{col.passive}{Passive columns.} + +\item{calibrated.tick.length}{Length of tick marks in plot coordinates (default \code{0.02}).} + +\item{calibrated.cex}{Text size for tick labels (default \code{0.6}).} + +\item{calibrated.col}{Color for tick marks and labels (default \code{grey(0.4)}).} + +\item{...}{Not evaluated.} +} +\description{ +Calibrated axes allow reading off approximated original ratings by projecting +element points onto construct axes. Each tick mark corresponds to a value on +the original rating scale. +} +\keyword{internal} diff --git a/man/addProjectionsToBiplot2d.Rd b/man/addProjectionsToBiplot2d.Rd new file mode 100644 index 0000000..99e0d38 --- /dev/null +++ b/man/addProjectionsToBiplot2d.Rd @@ -0,0 +1,43 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/repgrid-plots.r +\name{addProjectionsToBiplot2d} +\alias{addProjectionsToBiplot2d} +\title{Add projection lines from elements onto construct axes in a 2D biplot.} +\usage{ +addProjectionsToBiplot2d( + x, + projections = TRUE, + projections.e = TRUE, + projections.col = grey(0.5), + projections.lty = 3, + projections.lwd = 1, + ... +) +} +\arguments{ +\item{x}{\code{repgrid} object after \code{\link[=calcBiplotCoords]{calcBiplotCoords()}} and \code{\link[=prepareBiplotData]{prepareBiplotData()}}.} + +\item{projections}{Logical or numeric. \code{TRUE} for all construct axes, +or a numeric vector of construct indices (default \code{TRUE}).} + +\item{projections.e}{Logical or numeric. \code{TRUE} for all elements (default), +or a numeric vector of element indices.} + +\item{projections.col}{Color(s) of projection lines (default \code{grey(0.5)}). +A vector of colors is recycled to match the number of selected elements, +so each element's projections can have a distinct color.} + +\item{projections.lty}{Line type(s) for projection lines (default \code{3}, dotted). +Recycled per element like \code{projections.col}.} + +\item{projections.lwd}{Line width(s) for projection lines (default \code{1}). +Recycled per element like \code{projections.col}.} + +\item{...}{Not evaluated.} +} +\description{ +Draws perpendicular projection lines from element points onto construct axes, +showing where each element projects on the axis. This visualizes the +approximated original rating for each element-construct combination. +} +\keyword{internal} diff --git a/man/biplot2d.Rd b/man/biplot2d.Rd index eb29aa0..d6e1153 100644 --- a/man/biplot2d.Rd +++ b/man/biplot2d.Rd @@ -57,6 +57,15 @@ biplot2d( var.show = TRUE, var.cex = 0.7, var.col = grey(0.1), + calibrated = FALSE, + calibrated.tick.length = 0.02, + calibrated.cex = 0.6, + calibrated.col = grey(0.4), + projections = FALSE, + projections.e = TRUE, + projections.col = grey(0.5), + projections.lty = 3, + projections.lwd = 1, ... ) } @@ -270,6 +279,40 @@ the plot in and out (default \code{1}).} \item{var.col}{The color value of the percentages shown in the plot.} +\item{calibrated}{Logical or numeric. If \code{TRUE}, draw calibrated axes with tick marks +showing original scale values on all construct axes. If a numeric +vector, only draw calibrated axes for constructs with these indices +(e.g. \code{c(1, 3)} for constructs 1 and 3). Default is \code{FALSE}. +Calibrated axes allow reading off approximated original ratings +by projecting element points onto construct axes.} + +\item{calibrated.tick.length}{Length of calibrated axis tick marks in plot coordinates +(default \code{0.02}).} + +\item{calibrated.cex}{Text size for calibrated axis tick labels (default \code{0.6}).} + +\item{calibrated.col}{Color for calibrated axis tick marks and labels +(default \code{grey(0.4)}).} + +\item{projections}{Logical or numeric. If \code{TRUE}, draw perpendicular projection +lines from elements onto all construct axes. If a numeric vector, +only project onto constructs with these indices (e.g. \code{c(1, 3)}). +Default is \code{FALSE}.} + +\item{projections.e}{Logical or numeric. Which elements to project. \code{TRUE} (default +when \code{projections} is active) projects all elements. A numeric +vector selects specific elements by index (e.g. \code{c(1, 5)}).} + +\item{projections.col}{Color(s) of projection lines (default \code{grey(0.5)}). +A vector is recycled per element, so each element can have +a distinct color (e.g. \code{c("red", "blue")} for two elements).} + +\item{projections.lty}{Line type(s) for projection lines (default \code{3}, dotted). +Recycled per element like \code{projections.col}.} + +\item{projections.lwd}{Line width(s) for projection lines (default \code{1}). +Recycled per element like \code{projections.col}.} + \item{...}{parameters passed on to come.} } \description{