plot2D.mat: Plots a matrix from x-values, y-values and z-vales

View source: R/plot2D.mat.R

plot2D.matR Documentation

Plots a matrix from x-values, y-values and z-vales

Description

The function plots a grayscale image matrix from vectors x and y and matrix Z

Usage

plot2D.mat <- function(X, Y, Z, gray.dens = 10^5, x.lab = NULL, y.lab = NULL)
plot2D.mat <- function(X, Y, Z)

Arguments

X

Vector describing the x-axis

Y

Vector describing the y-axis

Z

Matrix describing the Z values.
Should have dimensions length(Y)*length(X)

gray.dens

Numeric value used to describe the grayscale density.
Default value set to 10^5.

x.lab

Sets the label of the x-axis.
Character vector of length 1 needed.
Default value set to NULL.

y.lab

Sets the label of the y-axis.
Character vector of length 1 needed.
Default value set to NULL.

Details

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).

Value

This function returns a NULL value

Author(s)

Chitran Ghosal

Examples

#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)

Chitran1987/StatsChitran documentation built on Feb. 23, 2025, 8:30 p.m.