plot.FEM.time: Plot a 'FEM.time' object at a given time

View source: R/plot.R

plot.FEM.timeR Documentation

Plot a FEM.time object at a given time

Description

Plot of a FEM.time object, generated by FEM.time or returned by smooth.FEM.time. time_locations and locations must not be both provided. If time_locations is provided, the spatial field is plotted for the provided temporal instnts. If locations is provided, the temporal evolution in the provided space locations is plotted. If both time_locations and locations are NULL a default plot is provided. If the mesh of the FEMbasis component is of class mesh.2D both the 3rd axis and the color represent the value of the coefficients for the Finite Element basis expansion (coeff component of the FEM.time object). If the mesh is of class mesh.3D, the color of each triangle or tetrahedron represent the mean value of the coefficients for the Finite Element basis expansion (coeff).

Usage

## S3 method for class 'FEM.time'
plot(x, time_locations = NULL, locations = NULL,
                lambdaS = NULL, lambdaT = NULL, num_refinements = NULL, Nt = 100,
                add = FALSE, main = NULL, col = "red", ...)

Arguments

x

A FEM.time object.

time_locations

A vector with the instants in which plot the spatial field

locations

A 2-column matrix when x$FEMbasis$mesh is of class mesh.2D or a 3-column matrix otherwise with the spatial locations for which plot the temporal evolution

lambdaS

Index of the space penalization parameter to use for the plot, useful when FEM.time returned by smooth.FEM.time using GCV

lambdaT

Index of the time penalization parameter to use for the plot, useful when FEM.time returned by smooth.FEM.time using GCV

num_refinements

A natural number specifying how many bisections should be applied to each triangular element for plotting purposes. This functionality is useful where a discretization with 2nd order Finite Element is applied. This parameter can be specified only when a FEM object defined over a 2D mesh is plotted.

Nt

The number of instants to plot when locations is not NULL

add

Boolean, used only when locations is not NULL, if TURE it performs the graphic over the last plot

main

The title of the plot when locations is not NULL

col

The color of the plot when locations is not NULL. May be a single color or a vector of colors

...

Arguments representing graphical options to be passed to plot3d.

Value

No return value

See Also

FEM.time, image.FEM.time

Examples

library(fdaPDE)
## Upload the horseshoe2D data
data(horseshoe2D)
boundary_nodes = horseshoe2D$boundary_nodes
boundary_segments = horseshoe2D$boundary_segments
locations = horseshoe2D$locations

## Create the 2D mesh
mesh = create.mesh.2D(nodes = rbind(boundary_nodes, locations), segments = boundary_segments)
## Create the FEM basis
FEMbasis = create.FEM.basis(mesh)
## Compute the coeff vector evaluating the desired function at the mesh nodes
## In this case we consider the fs.test() function introduced by Wood et al. 2008
time = 1:5
coeff = rep(fs.test(mesh$nodes[,1], mesh$nodes[,2]),5)*time
## Create the FEM.time object
FEM_time_function = FEM.time(coeff=coeff, time_mesh=1:5, FEMbasis=FEMbasis, FLAG_PARABOLIC=TRUE)

## Plot the FEM function
plot(FEM_time_function)

## plot spatial field in some instants
t = c(1.2,1.5,3.6,2.4,4.5)
plot(FEM_time_function, t)

## plot time evolution in some locations
plot(FEM_time_function, locations = locations[1:10,])

fdaPDE documentation built on March 7, 2023, 5:28 p.m.