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)
}
Run the code above in your browser using DataLab