ggplot_parallel {DEXiR}R Documentation

ggplot_parallel

Description

Makes a basic ggplot2 chart for displaying DEXi alternatives using parallel axes. Generally, axes are uniformly scaled to the ⁠[0,1]⁠ interval.

Usage

ggplot_parallel(
  model,
  alternatives = NULL,
  attids = NULL,
  aggregate = c("minmax", "min", "max", "mean", "none"),
  name = "name",
  shift = 0.01
)

Arguments

model

A DexiModel object. Required.

alternatives

A data.frame of alternatives (normally an output of evaluate()) or indices to model$alternatives. The default value NULL selects the whole model$alternatives.

attids

character(). A character vector of DexiAttribute IDs to be included in the result. Default: all model attributes.

aggregate

One of "minmax", "min", "max", "mean" or "none". Determines how to aggregate alternatives' values that are represented by sets or distributions.

name

character(1), The name of the column in alternatives that contains alternatives' names. Default: "name".

shift

numeric(1). Used to "shift" numeric values by a small amount to avoid overlapping lines in charts. Default: 0.01. You may want to experiment with charts to determine the right value,

Details

Uses GGally::ggparcoord() and requires package "GGally" to be installed. Data presented in the chart is prepared by scale_alternatives().

Value

A basic 'ggplot2' chart. Generally, this chart needs to be further enhanced by graph layers, such as themes, labels, geom_points() and geom_line(). See plotalt_parallel() that already provides some such layers.

See Also

scale_alternatives(), plotalt_parallel()

Examples

if (requireNamespace("GGally", quietly = TRUE)) {

# Load "Car.dxi"
CarDxi <- system.file("extdata", "Car.dxi", package = "DEXiR")
Car <- read_dexi(CarDxi)

# Plot all Car$alternatives with points and lines
ggplot_parallel(Car) + ggplot2::geom_line(linewidth = 2) + ggplot2::geom_point(size = 3)
}

[Package DEXiR version 1.0.2 Index]