Learn R Programming

DEXiR (version 1.0.2)

plotalt2: plotalt2

Description

Draw a scatterpolot of alternatives with attribute1 and attribute2 on the \(x\) and \(y\) axis, respectively.

Usage

plotalt2(
  model,
  attribute1,
  attribute2,
  alternatives = NULL,
  colors = NULL,
  pch = 20,
  size = 5,
  margins = NULL,
  lm = NULL,
  pos = 4,
  offset = 1,
  ...
)

Value

Draws a chart.

Arguments

model

A DexiModel object. Required.

attribute1

First attribute. It may be an DexiAttribute object or an argument to model$attrib(). The attribute must be discrete.

attribute2

Second attribute. It may be an DexiAttribute object or an argument to model$attrib(). The attribute must be discrete.

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(). Colors for displaying subsequent alternatives.

pch

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

size

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

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 attribute2's values.

pos

A position specifier for legent text, see graphics::text(). Default: 4.

offset

When pos is specified, this value controls the distance of the text label from the specified coordinate in fractions of a character width. Default: 1.

...

Optional parameters passed to graphics::plot().

Details

Standard scatterplot graphics::plot() is used. Continuous attributes are not supported.

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 "PRICE" and "TECH.CHAR." attributes
plotalt2(Car, "PRICE", "TECH.CHAR.")

# Plot the first Car alternative with respect to "BUY.PRICE" and "MAINT.PRICE" attributes
plotalt2(Car, "BUY.PRICE", "MAINT.PRICE", 1)

Run the code above in your browser using DataLab