The R Project SVN R

Rev

Rev 68948 | Rev 81192 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68948 Rev 77346
Line 1... Line 1...
1
% File src/library/graphics/man/contour.Rd
1
% File src/library/graphics/man/contour.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2014 R Core Team
3
% Copyright 1995-2019 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{contour}
6
\name{contour}
7
\alias{contour}
7
\alias{contour}
8
\alias{contour.default}
8
\alias{contour.default}
Line 57... Line 57...
57
    The default is \code{NULL} on graphics devices with high-quality
57
    The default is \code{NULL} on graphics devices with high-quality
58
    rotation of text and \code{c("sans serif", "plain")} otherwise.}
58
    rotation of text and \code{c("sans serif", "plain")} otherwise.}
59
  \item{xlim, ylim, zlim}{x-, y- and z-limits for the plot.}
59
  \item{xlim, ylim, zlim}{x-, y- and z-limits for the plot.}
60
  \item{axes, frame.plot}{logical indicating whether axes or a box
60
  \item{axes, frame.plot}{logical indicating whether axes or a box
61
    should be drawn, see \code{\link{plot.default}}.}
61
    should be drawn, see \code{\link{plot.default}}.}
62
  \item{col}{color for the lines drawn.}
62
  \item{col}{colour(s) for the lines drawn.}
63
  \item{lty}{line type for the lines drawn.}
63
  \item{lty}{line type(s) for the lines drawn.}
64
  \item{lwd}{line width for the lines drawn.}
64
  \item{lwd}{line width(s) for the lines drawn.}
65
  \item{add}{logical. If \code{TRUE}, add to a current plot.}
65
  \item{add}{logical. If \code{TRUE}, add to a current plot.}
66
  \item{\dots}{additional arguments to \code{\link{plot.window}},
66
  \item{\dots}{additional arguments to \code{\link{plot.window}},
67
    \code{\link{title}}, \code{\link{Axis}} and \code{\link{box}},
67
    \code{\link{title}}, \code{\link{Axis}} and \code{\link{box}},
68
    typically \link{graphical parameters} such as \code{cex.axis}.}
68
    typically \link{graphical parameters} such as \code{cex.axis}.}
69
}
69
}
Line 86... Line 86...
86
  \code{f(x[i], y[j])} values, so that the x axis corresponds to row
86
  \code{f(x[i], y[j])} values, so that the x axis corresponds to row
87
  number and the y axis to column number, with column 1 at the bottom,
87
  number and the y axis to column number, with column 1 at the bottom,
88
  i.e.\sspace{}a 90 degree counter-clockwise rotation of the conventional textual
88
  i.e.\sspace{}a 90 degree counter-clockwise rotation of the conventional textual
89
  layout.
89
  layout.
90
 
90
 
-
 
91
  Vector (of length \eqn{> 1}) \code{col}, \code{lty}, and \code{lwd} are
-
 
92
  applied along \code{levels} and recycled, see the Examples.
-
 
93
 
91
  Alternatively, use \code{\link[lattice:levelplot]{contourplot}} from the
94
  Alternatively, use \code{\link[lattice:levelplot]{contourplot}} from the
92
  \CRANpkg{lattice} package where the \code{\link{formula}} notation allows
95
  \CRANpkg{lattice} package where the \code{\link{formula}} notation allows
93
  to use vectors \code{x}, \code{y}, and \code{z} of the same length.
96
  to use vectors \code{x}, \code{y}, and \code{z} of the same length.
94
 
97
 
95
  There is limited control over the axes and frame as arguments
98
  There is limited control over the axes and frame as arguments
Line 126... Line 129...
126
        xlab = quote(x[1]), ylab = quote(x[2]))
129
        xlab = quote(x[1]), ylab = quote(x[2]))
127
contour(x, x, z, ylim = c(-6, 6), nlev = 20, lty = 2, method = "simple",
130
contour(x, x, z, ylim = c(-6, 6), nlev = 20, lty = 2, method = "simple",
128
        main = "20 levels; \"simple\" labelling method")
131
        main = "20 levels; \"simple\" labelling method")
129
par(op)
132
par(op)
130
 
133
 
-
 
134
## Passing multiple colours / lty / lwd :
-
 
135
op <- par(mfrow = c(1, 2))
-
 
136
z <- outer(-9:25, -9:25)
-
 
137
## Using default levels <- pretty(range(z, finite = TRUE), 10),
-
 
138
##  the first and last of which typically are *not* drawn:
-
 
139
(levs <- pretty(z, n=10)) # -300 -200 ... 600 700
-
 
140
contour(z, col = 1:4)
-
 
141
## Set levels explicitly; show that 'lwd' and 'lty' are recycled as well:
-
 
142
contour(z, levels=levs[-c(1,length(levs))], col = 1:5, lwd = 1:3 *1.5, lty = 1:3)
-
 
143
par(op)
-
 
144
 
131
## Persian Rug Art:
145
## Persian Rug Art:
132
x <- y <- seq(-4*pi, 4*pi, len = 27)
146
x <- y <- seq(-4*pi, 4*pi, len = 27)
133
r <- sqrt(outer(x^2, y^2, "+"))
147
r <- sqrt(outer(x^2, y^2, "+"))
134
opar <- par(mfrow = c(2, 2), mar = rep(0, 4))
148
opar <- par(mfrow = c(2, 2), mar = rep(0, 4))
135
for(f in pi^(0:3))
149
for(f in pi^(0:3))