persp_jk: Plot 3d surfaces, similar to matlab surf function

Description Usage Arguments Examples

View source: R/persp_jk.R

Description

Plot 3d surfaces, similar to matlab surf function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
persp_jk(
  x = NULL,
  y = NULL,
  z,
  colormap = viridisLite::viridis(256),
  theta = -30,
  phi = 30,
  expand = 0.5,
  ticktype = "detailed",
  legend = T,
  ...
)

Arguments

x, y

locations of grid lines at which the values in z are measured. These must be in ascending order. By default, equally spaced values from 0 to 1 are used. If x is a list, its components x$x and x$y are used for x and y, respectively.

z

a matrix containing the values to be plotted (NAs are allowed).

colormap

colormap used for the z-values

theta, phi

angles defining the viewing direction. theta gives the azimuthal direction and phi the colatitude.

expand

a expansion factor applied to the z coordinates. Often used with 0 < expand < 1 to shrink the plotting box in the z direction.

ticktype

haracter: "simple" draws just an arrow parallel to the axis to indicate direction of increase; "detailed" draws normal ticks as per 2D plots.

legend

should the legend be drawn. The default is TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(ari)
persp_jk(z = ari)

## changing parameters
x <- seq(1,50,1)
y <- seq(1,20,1)
data(parula64)
persp_jk(x,y,ari,colormap = parula64,xlab = "t", ylab= "K neighbors",zlab = "Adjusted Rand Index",legend=F)

## changing border color
persp_jk(x,y,ari,colormap = viridisLite::viridis(64,option = "A"),xlab = "t", ylab= "K neighbors",zlab = "Adjusted Rand Index", border = "white")

## generating terrain
require(ambient)
require(scico)
set.seed(4425346)
terrain <- noise_simplex(c(100,100))
persp_jk(z = terrain, colormap = scico(256, palette = "vik"), border = "NA", legend = F)

ExabytE1337/Lori documentation built on Feb. 17, 2021, 1:18 a.m.