Learn R Programming

r6qualitytools (version 1.0.1)

contourPlot: contourPlot: Contour Plot

Description

Creates a contour diagram for an object of class facDesign.c.

Usage

contourPlot(
  x,
  y,
  z,
  data = NULL,
  xlim,
  ylim,
  main,
  xlab,
  ylab,
  form = "fit",
  col = 1,
  steps,
  fun,
  plot = TRUE,
  show.scale = TRUE
)

Value

The function contourPlot returns an invisible list containing:

  • x - locations of grid lines for x at which the values in z are measured.

  • y - locations of grid lines for y at which the values in z are measured.

  • z - a matrix containing the values of z to be plotted.

  • plot - The generated plot.

Arguments

x

Name providing the Factor A for the plot.

y

Name providing the Factor B for the plot.

z

Name giving the Response variable.

data

Needs to be an object of class facDesign.c and contains the names of x, y, z.

xlim

Vector giving the range of the x-axis.

ylim

Vector giving the range of the y-axis.

main

Character string: title of the plot.

xlab

Character string: label for the x-axis.

ylab

Character string: label for the y-axis.

form

A character string or a formula with the syntax `y~ x+y + x*y`. If form is a character it has to be one out of the following:

  • `quadratic`

  • `full`

  • `interaction`

  • `linear`

  • `fit`

`fit` takes the formula from the fit in the facDesign.c object fdo. Quadratic or higher orders should be given as I(Variable^2). By default form is set as `fit`.

col

A predefined (1, 2, 3 or 4) or self defined colorRampPalette or color to be used (i.e. `red`).

steps

Number of grid points per factor. By default steps = 25.

fun

Function to be applied to z desirability.

plot

Logical value indicating whether to display the plot. Default is TRUE.

show.scale

Logical value indicating whether to display the color scale on the plot. Default is TRUE.

See Also

wirePlot, paretoChart

Examples

Run this code
fdo = rsmDesign(k = 3, blocks = 2)
fdo$.response(data.frame(y = rnorm(fdo$nrow())))

#I - display linear fit
contourPlot(A,B,y, data = fdo, form = "linear")
#II - display full fit (i.e. effect, interactions and quadratic effects
contourPlot(A,B,y, data = fdo, form = "full")
#III - display a fit specified before
fdo$set.fits(fdo$lm(y ~ B + I(A^2)))
contourPlot(A,B,y, data = fdo, form = "fit")
#IV - display a fit given directly
contourPlot(A,B,y, data = fdo, form = "y ~ A*B + I(A^2)")
#V - display a fit using a different colorRamp
contourPlot(A,B,y, data = fdo, form = "full", col = 2)
#VI - display a fit using a self defined colorRamp
myColour = colorRampPalette(c("green", "gray","blue"))
contourPlot(A,B,y, data = fdo, form = "full", col = myColour)

Run the code above in your browser using DataLab