Produces a multi-layer ggplot object representing the output of objects produced by metaMDS.

# S3 method for metaMDS
autoplot(
  object,
  axes = c(1, 2),
  geom = c("point", "text"),
  layers = c("species", "sites"),
  legend.position = "right",
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  ylab,
  xlab,
  ...
)

Arguments

object

an object of class "metaMDS", the result of a call to metaMDS.

axes

numeric; which axes to plot, given as a vector of length 2.

geom

character; which geoms to use for the layers. Can be a vector of length equal to length(display), in which case the ith element of type refers to the ith element of display.

layers

character; which scores to plot as layers

legend.position

character or two-element numeric vector; where to position the legend. See theme for details. Use "none" to not draw the legend.

title

character; subtitle for the plot

subtitle

character; subtitle for the plot

caption

character; caption for the plot

ylab

character; label for the y-axis

xlab

character; label for the x-axis

...

Additional arguments passed to fortify.metaMDS.

Value

Returns a ggplot object.

Details

TODO

Author

Gavin L. Simpson

Examples

## load example data
data(dune)

sol <- metaMDS(dune)
#> Run 0 stress 0.1192678 
#> Run 1 stress 0.1183186 
#> ... New best solution
#> ... Procrustes: rmse 0.02027077  max resid 0.06496206 
#> Run 2 stress 0.1183186 
#> ... Procrustes: rmse 1.489105e-05  max resid 4.165231e-05 
#> ... Similar to previous best
#> Run 3 stress 0.2034375 
#> Run 4 stress 0.1183186 
#> ... New best solution
#> ... Procrustes: rmse 1.540963e-06  max resid 4.003579e-06 
#> ... Similar to previous best
#> Run 5 stress 0.1192679 
#> Run 6 stress 0.2791931 
#> Run 7 stress 0.1192679 
#> Run 8 stress 0.1886532 
#> Run 9 stress 0.1192678 
#> Run 10 stress 0.2014894 
#> Run 11 stress 0.1192678 
#> Run 12 stress 0.1183186 
#> ... Procrustes: rmse 5.225286e-06  max resid 1.850869e-05 
#> ... Similar to previous best
#> Run 13 stress 0.1192678 
#> Run 14 stress 0.1183186 
#> ... Procrustes: rmse 6.566983e-06  max resid 2.278414e-05 
#> ... Similar to previous best
#> Run 15 stress 0.1809577 
#> Run 16 stress 0.1192678 
#> Run 17 stress 0.1192679 
#> Run 18 stress 0.1812932 
#> Run 19 stress 0.1192679 
#> Run 20 stress 0.1192678 
#> *** Best solution repeated 3 times
autoplot(sol)