autoplot.inla.mesh: An autoplot (ggplot2) method for INLA mesh objects.

View source: R/autoplot_mesh.R

autoplot.inla.meshR Documentation

An autoplot (ggplot2) method for INLA mesh objects.

Description

An autoplot (ggplot2) method for INLA mesh objects.

Usage

## S3 method for class 'inla.mesh'
autoplot(
  object,
  ...,
  col = "blue",
  lwd = 0.5,
  linecol = "darkgrey",
  size = 1.2
)

Arguments

object

An inla.mesh object

...

Other arguments passed to specific methods

col

Colour for data points

lwd

Line width

linecol

The colour for the mesh edges

size

size Size of data points

Examples

## Not run: 
library(INLA)
m = 100
points = matrix(runif(m*2),m,2)
mesh = inla.mesh.create.helper(
  points=points,
  cutoff=0.05,
  offset=c(0.1,0.4),
  max.edge=c(0.05,0.5) )

autoplot(mesh)
p <- autoplot(mesh)

# As a ggplot2 object, the plot can be altered.
p + theme_dark()

# The size and colour of all objects can be controlled.
#   The order of the values is 
#   1: data points
#   2: edges
#   3: outer domain
#   4: inner domain
#   5: non data vertices
p + scale_colour_manual(values = c('red', 'grey', 'darkblue', 'steelblue', 'yellow'))

# The name of the variable that defines the different objects is 'type'
p + facet_grid(. ~ type)

# Plot projections with ggalt

library(ggalt)
p + ggalt::coord_proj("+proj=wintri")

## End(Not run)

timcdlucas/INLAutils documentation built on Nov. 29, 2022, 5:41 a.m.