plotalt_radar {DEXiR} | R Documentation |
plotalt_radar
Description
Plots DEXi alternatives on a radar chart.
Generally, axes are uniformly scaled to the [0,1]
interval.
Usage
plotalt_radar(
model,
alternatives = NULL,
attids = NULL,
aggregate = c("minmax", "min", "max", "mean", "none"),
name = "name",
shift = 0.01,
linewidth = 2,
ptype = 16,
colors = NULL,
unicolors = NULL,
fillcolors = NULL,
transparency = 85,
circular = FALSE,
split = FALSE,
fill = FALSE,
...
)
Arguments
model |
A DexiModel object. Required. |
alternatives |
A |
attids |
|
aggregate |
One of |
name |
|
shift |
|
linewidth |
|
ptype |
A vector to specify point symbol: Default |
colors |
Colors to be used (repeatably) for data series. Default |
unicolors |
A vector of one or two colors to be used for displaying the
minimum and maximum data series, respectively. Applies only when |
fillcolors |
A vector of color codes for filling polygons. Applies only when |
transparency |
A number between |
circular |
|
split |
|
fill |
|
... |
Optional parameters passed to |
Details
Uses fmsb::radarchart()
and requires package "fmsb" to be installed.
Data presented in the chart is prepared by scale_alternatives()
.
Value
Draws a chart or, when split = TRUE
a series of charts corresponding to individual alternatives.
See Also
scale_alternatives()
, fmsb::radarchart()
Examples
if (requireNamespace("fmsb", 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_radar(Car)
# Use different colors and fill polygons
plotalt_radar(Car, colors = c("blue", "brown"), fill = TRUE)
plotalt_radar(Car, colors = c("blue", "brown"), fillcolors = c("green", "red"), fill = TRUE)
# Draw separate charts
plotalt_radar(Car, split = TRUE)
# Draw separate charts, using the same color settings on all charts
plotalt_radar(Car, split = TRUE, unicolors = c("green", "red"))
plotalt_radar(Car, split = TRUE, unicolors = c("green", "red"), circular = TRUE)
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"
)
# The same chart types as above, but using more varied alternatives data
# Plot all Car$alternatives with points and lines
plotalt_radar(Car, alts3)
# Use different colors and fill polygons
plotalt_radar(Car, alts3, colors = c("blue", "brown", "purple"), fill = TRUE)
plotalt_radar(Car, alts3, colors = c("blue", "brown", "purple"),
fillcolors = c("green", "red", "yellow"), fill = TRUE)
# Draw separate charts
plotalt_radar(Car, alts3, split = TRUE)
plotalt_radar(Car, alts3, split = TRUE, fill = TRUE)
# Draw separate charts, using the same color settings on all charts
plotalt_radar(Car, alts3, split = TRUE, unicolors = c("red", "green"))
plotalt_radar(Car, alts3, split = TRUE, unicolors = c("green", "darkgreen"), fill = TRUE)
plotalt_radar(Car, alts3, split = TRUE, unicolors = c("red", "green"), circular = TRUE)
}