Learn R Programming

DEXiR (version 1.0.2)

plotalt1: plotalt1

Description

Plot alternatives with respect to a single attribute.

Usage

plotalt1(
  model,
  attribute = model$first(),
  alternatives = NULL,
  colors = c("red", "black", "green"),
  pch = 20,
  size = 5,
  linetype = 2,
  margins = NULL,
  lm = NULL,
  ...
)

Value

Draws a chart.

Arguments

model

A DexiModel object. Required.

attribute

A single DexiAttribute selector. It may be an DexiAttribute object or an argument to model$attrib(). attribute$scale must be defined. Default: model$first().

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.

colors

character(3) representing colors corresponding to "bad", "neutral" and "good" scale values, respectively. Default: c("red", "black", "green").

pch

Plotting character, see graphics::points(). Default: 20.

size

numeric(1). Multiplication size factor for drawing individual points. Base point size depends on pch.

linetype

integer(). Line type for drawing chart grid. Default: 2.

margins

numeric(4). Chart margins, passed to graphics::par() prior to drawing.

lm

numeric(1). Left chart margin. May be used to adjust the display of alternatives' names.

...

Optional parameters passed to graphics::plot().

Details

Standard scatterplot base::plot is used.

Examples

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

# Plot all Car$alternatives with respect to "TECH.CHAR." attribute
plotalt1(Car, "TECH.CHAR.")

# Plot the first Car alternative with respect to "MAINT.PRICE" attribute
plotalt1(Car, "MAINT.PRICE", 1)

Run the code above in your browser using DataLab