Learn R Programming

qualityTools (version 1.55)

contourPlot3: function to create a ternary plot (contour plot) for an object of class mixDesign

Description

This function creates a ternary plot (contour plot) for mixture designs (i.e. object of class mixDesign)

Usage

contourPlot3(x, y, z, response, data = NULL, main, xlab, ylab, zlab, border, form = "linear", col = 1, col.text, cex.axis, axes = TRUE, steps, factors)

Arguments

x
factor 1 of the mixDesign object.
y
factor 2 of the mixDesign object.
z
factor 3 of the mixDesign object.
response
the response of the mixDesign object.
data
the mixDesign object from which x,y,z and the response are taken.
main
giving an overall title for the plot: see title.
xlab
giving a title for the x axis : see title.
ylab
giving a title for the y axis : see title.
zlab
giving a title for the z axis : see title.
border
numeric or character (for example “red”) value specifying the color of the surroundimg the ternary plot. By default border is set to “white”
form
a character string or a formula with the syntax “y ~ A + B +C”. If form is a character string it has to be one out of the following:
  • “linear”
  • “quadratic”
  • “fullCubic”
  • “specialCubic”
How the form influences the output is described in the reference listed below. By default form is set as “linear”.
col
a predefined (1, 2, 3 or 4) or self defined colorRampPalette.
col.text
a numerical value or a character string (like “red”) giving the color oft the inscription of the axes. The default value for col.text is ‘1’.
cex.axis
numerical value giving the size of the inscription of the axes. The default value cex.axis is ‘1’.
axes
logical value specifying whether the axes should be plotted or not. By default axes is set to ‘TRUE’.
steps
resolution of the plot (number of rows for the square matrix), also number of grid points per factor. By default steps = 25.
factors
list of factors for categorizing with setting in case there are more than 3 factors (not yet implemented).

Value

contourPlot3 returns an invisible matrix containing the response values as NA's and numerics.

References

MYERS, Raymond H.; MONTGOMERY, Douglas C.; ANDERSON-COOK, Christine M.: Response Surface Methodology. New York: WILEY ,2009

See Also

wirePlot3 mixDesign colorRampPalette http://www.r-qualitytools.org/html/Improve.html

Examples

Run this code
#yarn example p.564 Response Surface Methodology
mdo = mixDesign(3,2, center = FALSE, axial = FALSE, randomize = FALSE, 
                replicates  = c(1,1,2,3))
names(mdo) = c("polyethylene", "polystyrene", "polypropylene")
units(mdo) = "percent"
elongation = c(11.0, 12.4, 15.0, 14.8, 16.1, 17.7, 16.4, 16.6, 8.8, 10.0, 10.0, 
               9.7, 11.8, 16.8, 16.0)
response(mdo) = elongation

dev.new(14,14); par(mfrow = c(2,2))
contourPlot3(A, B, C, elongation, data = mdo, form = "linear")
contourPlot3(A, B, C, elongation, data = mdo, form = "quadratic", col = 2)
contourPlot3(A, B, C, elongation, data = mdo, 
             form = "elongation ~ I(A^2) - B:A + I(C^2)", col = 3)
contourPlot3(A, B, C, elongation, data = mdo, form = "quadratic", 
             col = colorRampPalette(c("yellow", "white", "red")))

Run the code above in your browser using DataLab