plot_spotoroo: Plotting spatiotemporal clustering result

View source: R/plot_spotoroo.R

plot_spotorooR Documentation

Plotting spatiotemporal clustering result

Description

This function takes a spotoroo object to produce a plot of the clustering results. It can be called by plot.spotoroo().

Usage

plot_spotoroo(
  result,
  type = "def",
  cluster = "all",
  hotspot = TRUE,
  noise = FALSE,
  ignition = TRUE,
  from = NULL,
  to = NULL,
  step = 1,
  mainBreak = NULL,
  minorBreak = NULL,
  dateLabel = NULL,
  bg = NULL
)

Arguments

result

spotoroo object. A result of a call to hotspot_cluster().

type

Character. Type of the plot. One of "def" (default), "timeline" (timeline) and "mov" (fire movement).

cluster

Character/Integer. If "all", plot all clusters. If an integer vector is given, plot corresponding clusters. Unavailable in plot_timeline().

hotspot

Logical. If TRUE, plot the hot spots. Unavailable in plot_timeline().

noise

Logical. If TRUE, plot the noise. Only used in plot_def().

ignition

Logical. If TRUE, plot the ignition points. Only used in plot_def().

from

OPTIONAL. Date/Datetime/Numeric. Start time. The data type needs to be the same as the provided observed time.

to

OPTIONAL. Date/Datetime/Numeric. End time. The data type needs to be the same as the provided observed time.

step

Integer (>=0). Step size used in the calculation of the fire movement. Only used in plot_fire_mov().

mainBreak

OPTIONAL. Character/Numeric. A string/value giving the difference between major breaks. If the observed time is in date/datetime format, this value will be passed to ggplot2::scale_x_date() or ggplot2::scale_x_datetime() as date_breaks. Only used in plot_timeline().

minorBreak

OPTIONAL. Character/Numeric. A string/value giving the difference between minor breaks. If the observed time is in date/datetime format, this value will be passed to ggplot2::scale_x_date() or ggplot2::scale_x_datetime() as date_minor_breaks. Only used in plot_timeline().

dateLabel

OPTIONAL. Character. A string giving the formatting specification for the labels. If the observed time is in date/datetime format, this value will be passed to ggplot2::scale_x_date() or ggplot2::scale_x_datetime() as date_labels. Unavailable if the observed time is in numeric format. Only used in plot_timeline().

bg

OPTIONAL. ggplot object. If specified, plot onto this object. Unavailable in plot_timeline().

Details

if type is "def", the clustering results will be plotted spatially. See also plot_def(). Available arguments:

  • result

  • type

  • cluster

  • ignition

  • hotspot

  • noise

  • from (OPTIONAL)

  • to (OPTIONAL)

  • bg (OPTIONAL)

if type is "mov", plot of the fire movement will be made. See also plot_fire_mov(). Available arguments:

  • result

  • type

  • cluster

  • hotspot

  • from (OPTIONAL)

  • to (OPTIONAL)

  • step

  • bg (OPTIONAL)

if type is "timeline", plot of the timeline will be made. See also plot_timeline(). Available arguments:

  • result

  • type

  • from (OPTIONAL)

  • to (OPTIONAL)

  • mainBreak (OPTIONAL)

  • minorBreak (OPTIONAL)

  • dateLabel (OPTIONAL)

Value

A ggplot object. The plot of the clustering results.

Examples



  # Time consuming functions (>5 seconds)


  # Get clustering result
  result <- hotspot_cluster(hotspots,
                          lon = "lon",
                          lat = "lat",
                          obsTime = "obsTime",
                          activeTime = 24,
                          adjDist = 3000,
                          minPts = 4,
                          minTime = 3,
                          ignitionCenter = "mean",
                          timeUnit = "h",
                          timeStep = 1)

  # Different types of plots

  # Default plot
  plot_spotoroo(result, "def", bg = plot_vic_map())


  # Fire movement plot
  plot_spotoroo(result, "mov", cluster = 1:3, step = 3,
                bg = plot_vic_map())




spotoroo documentation built on Aug. 21, 2023, 9:10 a.m.