Skip to contents

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().

Value

A ggplot object. The plot of the clustering results.

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)

Examples

# \donttest{

  # 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)
#> 
#> ──────────────────────────────── SPOTOROO 0.1.4 ────────────────────────────────
#> 
#> ── Calling Core Function : `hotspot_cluster()` ──
#> 
#> ── "1" time index = 1 hour 
#>  Transform observed timetime indexes
#>  970 time indexes found
#> 
#> ── activeTime = 24 time indexes | adjDist = 3000 meters 
#>  Cluster
#>  16 clusters found (including noise)
#> 
#> ── minPts = 4 hot spots | minTime = 3 time indexes 
#>  Handle noise
#>  6 clusters left
#>  noise proportion : 0.935 %
#> 
#> ── ignitionCenter = "mean" 
#>  Compute ignition points for clusters
#>  average hot spots : 176.7
#>  average duration : 131.9 hours
#> 
#> ── Time taken = 0 mins 1 sec for 1070 hot spots 
#>  0.001 secs per hot spot
#> 
#> ────────────────────────────────────────────────────────────────────────────────

  # 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())

# }