Learn R Programming

deform (version 1.0.0)

plot.deform: Plot a fitted deform object

Description

Plot a fitted deform object

Usage

# S3 method for deform
plot(
  x,
  start = 1,
  graphics = "base",
  breaks = NULL,
  pal = function(n) hcl.colors(n, "YlOrRd", rev = TRUE),
  onepage = FALSE,
  nx = 10,
  ny = 10,
  xp = NULL,
  yp = NULL,
  xlab = NULL,
  ylab = NULL,
  ...
)

Value

Plots representing all one- or two-dimensional smooths

Arguments

x

a fitted deform object

start

an integer giving the starting dimension of plots of dimension expansion models; defaults to 1

graphics

a character string that is either "graphics" or "lattice" and states the graphics package to use for plots; defaults to "graphics"

breaks

an integer, vector or list; see Details

pal

a function specifying the colour palette to use for plots; defaults to hcl.colors(..., 'YlOrRd', rev = TRUE)

onepage

a logical specifying whether all plots should be put on one page; defaults to FALSE, which makes use of the current graphics state

nx

number of x points to use for plotting grid

ny

number of y points to use for plotting grid

xp

x points to use for plotting grid

yp

y points to use for plotting grid

xlab

x-axis label

ylab

y-axis label

...

extra arguments to pass to plot()

Details

If breaks is an integer then it specifies the number of breaks to use for colour scales; if it's a vector, then it's the breaks themselves; and if it's a list then it's different breaks for each dimension.

Examples

Run this code

# \donttest{

# deformations
data(solar)
m0 <- deform(solar$x, solar$z, solar$n)

# plot representation of deformation
plot(m0)

# as above with specified x and y grid
xvals <- seq(-123.3, -122.25, by = .05)
yvals <- seq(49, 49.4, by = .05)
plot(m0, xp = xvals, yp = yvals)

# }

# one-dimensional expansion
data(solar)
m1 <- expand(solar$x, solar$z, solar$n)

# plot its three dimensions
op <- par(mfrow = c(1, 3))
plot(m1)
par(op)

# or plot using lattice::levelplot
plot(m1, graphics = 'lattice')
# or as above, but on one page
plot(m1, graphics = 'lattice', onepage = TRUE)

# \donttest{

# two-dimensional expansion
m2 <- expand(solar$x, solar$z, solar$n, c(8, 5)) 
# plot of its third and fourth dimensions for given x and y values
op <- par(mfrow = c(1, 2))
plot(m2, start = 3, xp = xvals, yp = yvals)
par(op)

# using lattice::levelplot with common breaks across dimensions with
# a palette that gives latent dimensions in white where near zero
plot(m2, onepage = TRUE, graphics = 'lattice', breaks = seq(-0.35, 0.35, by = 0.1), 
     pal = function(n) hcl.colors(n, 'Blue-Red 3'))
     
# }

Run the code above in your browser using DataLab