plot_stpp: Plot a spatio-temporal point pattern

View source: R/plot_stpp.R

plot_stppR Documentation

Plot a spatio-temporal point pattern

Description

Provides flexible visualization tools for spatio-temporal point patterns. Depending on the chosen display type, the function produces one of three plots:

  • A 3D scatterplot showing event locations in space–time ("3D");

  • A 2D spatial projection of points in the spatial plane ("space");

  • A temporal histogram with an overlaid kernel density curve ("time").

The input dataset must contain three columns corresponding to the spatial (x, y) and temporal (t) coordinates of events.

Usage

plot_stpp(data, type = c("3D", "space", "time"), time_bins = 30, title = NULL)

Arguments

data

A numeric matrix or data frame with at least three columns representing event coordinates. If data is a matrix, the first three columns are interpreted as x, y, and t. If data is a data frame, the function uses columns named x, y, t when present; otherwise it uses the first three columns.

type

Character string specifying the type of visualization to produce: "3D" for a three-dimensional scatterplot; "space" for a 2D spatial plot of x versus y; or "time" for a histogram of event times with a smoothed density overlay.

time_bins

Integer specifying the number of bins in the histogram when type = "time". Default is 30.

title

Optional character string giving a plot title. If NULL, a default title is used.

Details

The function serves as an exploratory tool for investigating the spatial, temporal, or joint space–time structure of point pattern data. Such visualization is often a first step before conducting statistical analyses of separability or intensity modeling (see Ghorbani et al., 2021).

3D mode

Displays events in a 3D coordinate system using the scatterplot3d package, allowing a quick assessment of clustering and temporal trends in space–time.

Spatial mode

Projects points onto the spatial plane (xy), showing spatial structure independent of time.

Temporal mode

Displays the marginal temporal distribution of events as a histogram with a kernel density overlay, facilitating the visual detection of temporal nonstationarity.

Visualization is particularly useful for validating the realism of simulated data (e.g. from rstpoispp or Gauss.st.F) and for preliminary inspection prior to applying tests such as chi2.test, global.envelope.test, or dHS.test.

Value

Produces a plot as a side effect. Nothing is returned.

Note

The 3D visualization requires the scatterplot3d package.

Author(s)

Nafiseh Vafaei nafiseh.vafaei@slu.se

References

Ghorbani M., Vafaei N., Dvořák J., Myllymäki M. (2021). Testing the first-order separability hypothesis for spatio-temporal point patterns. Computational Statistics & Data Analysis, 161, 107245.

See Also

rstpoispp, estimate.st.intensity, plot_stlgcp, chi2.test, dHS.test

Examples



set.seed(123)
X <- cbind(runif(100), runif(100), runif(100, 0, 10))

# Visualize point pattern in 3D space–time
plot_stpp(X, type = "3D")

# View spatial projection
plot_stpp(X, type = "space")

# Inspect temporal distribution
plot_stpp(X, type = "time", time_bins = 20)



SepTest documentation built on Feb. 3, 2026, 5:07 p.m.

Related to plot_stpp in SepTest...