Plot the MAP partition, or add one to an existing plot


Plot the maximum a' posteriori (MAP) tree from a "tgp"-class object, or add one on top of an existing plot. Like plot.tgp, projections and slices of trees can be plotted as specified


mapT(out, proj = NULL, slice = NULL, add = FALSE, lwd = 2, ...)



"tgp"-class object which is the output of one the model functions with tree support (e.g. btgpllm)


1-or-2-Vector describing the dimensions to be shown in a projection. The argument is ignored for 1-d data, i.e., if x$d == 1. For 2-d data, no projection needs to be specified— the default argument (proj = NULL) will result in a 2-d plot. 1-d projections of 2-d or higher trees are are supported, e.g., proj = c(2) would show the second variable projection. For 3-d data or higher, proj=NULL defaults to proj = c(1,2) which plots a 2-d projection of the trees for the first two variables. Slices have priority over projections— see next argument (slice)— when non-null arguments are provided for both.


list object with x and z fields, which are vectors of equal length describing the slice to be plotted, i.e., which z-values of the treed partitions in the x$d - 2 inputs x$X and x$XX should be fixed to in order to obtain a 2-d visualization. For example, for 4-d data, slice = list(x=(2,4), z=c(0.2, 1.5) will result in a 2-d plot of the first and third dimensions which have the second and fourth slice fixed at 0.5 and 1.5. The default is NULL, yielding to the proj argument. Argument is ignored for 1-d data, i.e., if x$d == 1


Specify whether the to add partitions to an existing plot (add = TRUE) or to make a new plot showing the data out$X along with the partitions (default add = FALSE)


Plotting argument specifying the width of the lines used to depict the partitions


Additional arguments to plot used when add = FALSE


The only output of this function is a beautiful region-representation of the MAP tree.


For examples, see vignette("tgp") and the examples provided in the documentation for the function


Robert B. Gramacy,, and Matt Taddy,


See Also

plot.tgp, tgp.trees,, vignette("tgp")

Want to suggest features or report bugs for Use the GitHub issue tracker. Vote for new features on Trello.

comments powered by Disqus