Learn R Programming

mlr3spatiotempcv (version 2.0.3)

autoplot.ResamplingSptCVCluto: Visualization Functions for SptCV Cluto Methods.

Description

Generic S3 plot() and autoplot() (ggplot2) methods to visualize mlr3 spatiotemporal resampling objects.

Usage

# S3 method for ResamplingSptCVCluto
autoplot(
  object,
  task,
  fold_id = NULL,
  plot_as_grid = TRUE,
  train_color = "#0072B5",
  test_color = "#E18727",
  tickformat_date = "%Y-%m",
  nticks_x = 3,
  nticks_y = 3,
  point_size = 3,
  axis_label_fontsize = 11,
  sample_fold_n = NULL,
  ...
)

# S3 method for ResamplingRepeatedSptCVCluto autoplot( object, task, fold_id = NULL, repeats_id = 1, plot_as_grid = TRUE, train_color = "#0072B5", test_color = "#E18727", sample_fold_n = NULL, ... )

# S3 method for ResamplingSptCVCluto plot(x, ...)

# S3 method for ResamplingRepeatedSptCVCluto plot(x, ...)

Arguments

object

[Resampling]
mlr3 spatial resampling object of class ResamplingSptCVCluto or ResamplingRepeatedSptCVCluto.

task

[TaskClassifST]/[TaskRegrST]
mlr3 task object.

fold_id

[numeric]
Fold IDs to plot.

plot_as_grid

[logical(1)]
Should a gridded plot using via patchwork be created? If FALSE a list with of ggplot2 objects is returned. Only applies if a numeric vector is passed to argument fold_id.

train_color

[character(1)]
The color to use for the training set observations.

test_color

[character(1)]
The color to use for the test set observations.

tickformat_date

[character]
Date format for z-axis.

nticks_x

[integer]
Number of x axis breaks. Only applies to SptCVCluto.

nticks_y

[integer]
Number of y axis breaks. Only applies to SptCVCluto.

point_size

[numeric]
Point size of markers.

axis_label_fontsize

[integer]
Font size of axis labels.

sample_fold_n

[integer]
Number of points in a random sample stratified over partitions. This argument aims to keep file sizes of resulting plots reasonable and reduce overplotting in dense datasets.

...

Passed to geom_sf(). Helpful for adjusting point sizes and shapes.

repeats_id

[numeric]
Repetition ID to plot.

x

[Resampling]
mlr3 spatial resampling object of class ResamplingSptCVCluto or ResamplingRepeatedSptCVCluto.

See Also

  • mlr3book chapter on "Spatiotemporal Visualization"

  • Vignette Spatiotemporal Visualization.

  • autoplot.ResamplingSpCVBlock()

  • autoplot.ResamplingSpCVBuffer()

  • autoplot.ResamplingSpCVCoords()

  • autoplot.ResamplingSpCVEnv()

  • autoplot.ResamplingSpCVDisc()

  • autoplot.ResamplingSpCVTiles()

  • autoplot.ResamplingCV()

  • autoplot.ResamplingSptCVCstf()

Examples

Run this code
if (FALSE) {
if (mlr3misc::require_namespaces(c("sf", "skmeans", "plotly"), quietly = TRUE)) {
  library(mlr3)
  library(mlr3spatiotempcv)
  task_st = tsk("cookfarm_mlr3")
  resampling = rsmp("sptcv_cluto", folds = 5)
  resampling$instantiate(task_st)

  # plot
  autoplot(resampling, task_st)
  autoplot(resampling, task_st, fold_id = 1)
  autoplot(resampling, task_st, fold_id = c(1, 2))
}
}

Run the code above in your browser using DataLab