Function to make nice surfaces using ggplot

ggSurface(
  GAM,
  data,
  XYZ = NA,
  predict_val = NA,
  surf_min = NA,
  surf_max = NA,
  x.limits = NA,
  y.limits = NA,
  z.val = NA,
  exclude = NA,
  subtitle = "",
  lab_size = 3,
  nlevels = 5,
  contour_at = NA,
  skip = 0,
  axis_size = 15,
  axis_lab_size = 15
)

Arguments

GAM

A gam function for prediction

data

A dataframe contain all observed data

XYZ

XY axis used for plot, Z axis will be used as median, can be multiple Z.

predict_val

set additional predict parameters for gam fitting. e.g. predict_val = data.frame(Meta2 = "control")

surf_min

minimal value of the fitted surface. If it is NA, the minimal value is determined by fitted value.

surf_max

maximal value of the fitted surface. If it is NA, the maximal value is determined by fitted value.

x.limits

Limits of x axis. If it is NA, the limits is determined by input data.

y.limits

Limits of y axis. If it is NA, the limits is determined by input data.

z.val

Value of z to be plotted. Plot will condition on z.val and fit f(x,y,z=z.val).

exclude

Point exclude from prediction used in predict.gam. By default is NA.

subtitle

Subtitle of the figure.

lab_size

label size in contour.

nlevels

Number of levels in contour. By default is 5.

contour_at

A vector indicates where to draw the contour.

skip

Number of contours to skip.

axis_size

axis.text size.

axis_lab_size

axis.title size.

Value

A ggplot type object of NGF.