plotalt_parallel {DEXiR} | R Documentation |
Makes and plots DEXi alternatives on parallel axes, corresponding to attributes.
Generally, axes are uniformly scaled to the [0,1]
interval.
plotalt_parallel(
model,
alternatives = NULL,
attids = NULL,
aggregate = c("minmax", "min", "max", "mean", "none"),
name = "name",
shift = 0.01,
linewidth = 2,
pointsize = 3,
split = c("no", "h", "v")
)
model |
A DexiModel object. Required. |
alternatives |
A |
attids |
|
aggregate |
One of |
name |
|
shift |
|
linewidth |
|
pointsize |
|
split |
One of:
|
Data presented in the chart is prepared by scale_alternatives()
.
plotalt_parallel()
invokes ggplot_parallel()
to make a basic chart and then
enhances it with graphic layers that are suitable for presenting DEXi alternatives.
A 'ggplot2' chart, enhanced with additional graph layers.
scale_alternatives()
, ggplot_parallel()
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
plotalt_parallel(Car)
# Show alternatives on two separate chart segments, shown one above the other.
plotalt_parallel(Car, split = "v")
alts3 <- structure(
list(
name = c("MyCar", "MyCar2", "MyCar1b"),
CAR.1 = list(4L, 4L, c(1L, 4L)),
PRICE = list(3L, 3L, c(1L, 3L)),
BUY.PRICE = list(3L, 3L, 3L),
MAINT.PRICE = list(2, 1, structure(c(0.1, 0.6, 0.3), class = "distribution")),
TECH.CHAR. = list(3L, 3:4, 3L),
COMFORT = list(3L, 2, 3L),
X.PERS = list(3, 3, 3L),
X.DOORS = list(3, 3, 3L),
LUGGAGE = list(2L, 2L, 2),
SAFETY = list(2, c(2, 3), 2)
),
row.names = c(NA, -3L),
class = "data.frame"
)
# Plot `alts2` with points and lines.
# Notice the "minmax" aggregation of sets and distributions.
plotalt_parallel(Car, alts3)
plotalt_parallel(Car, alts3, split = "v")
# Now with "mean" aggregation
plotalt_parallel(Car, alts3, split = "v", aggregate = "mean")
}