Skip to contents

This function plots the timeline of the fires and the noise points.

Usage

plot_timeline(
  result,
  from = NULL,
  to = NULL,
  mainBreak = NULL,
  minorBreak = NULL,
  dateLabel = NULL
)

Arguments

result

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

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.

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.

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.

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.

Value

A ggplot object. The plot of the timeline.

Examples

# \donttest{

  # Time consuming functions (>5 seconds)


  # Get clustering results
  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
#> 
#> ────────────────────────────────────────────────────────────────────────────────

  # Plot timeline
  plot_timeline(result,
              mainBreak = "1 week",
              minorBreak = "1 day",
              dateLabel = "%b %d")

# }