plot2D.mat | R Documentation |
The function plots a grayscale image matrix from vectors x and y and matrix Z
plot2D.mat <- function(X, Y, Z, gray.dens = 10^5, x.lab = NULL, y.lab = NULL)
plot2D.mat <- function(X, Y, Z)
X |
Vector describing the x-axis |
Y |
Vector describing the y-axis |
Z |
Matrix describing the Z values. |
gray.dens |
Numeric value used to describe the grayscale density. |
x.lab |
Sets the label of the x-axis. |
y.lab |
Sets the label of the y-axis. |
X and Y need to be numeric vectors.
Z needs to be a matrix.
for directly plotting the matrix from a function of X and Y, please see plot2D.
gray.dens has to be a whole number.
x.lab and y.lab have to be a single valued character vectors, if not NULL.
When building the matrix from a function, please use function_2D (and NOT outer).
This function returns a NULL value
Chitran Ghosal
#define the x-axis
X <- seq(0, 10, by = 0.01)
Y <- seq(0, 16, by = 0.01)
#define the function
patt <- function(x, y){
return(exp(-0.2*x - 0.1*y)*sin(3*x)*cos(4*y))
}
#build the Z matrix
Z <- function_2D(X, Y, patt)
#plot the matrix
plot2D.mat(X, Y, Z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.