This is the S3 method for plotting "norMmix"
objects.
# S3 method for norMmix
plot(x, y=NULL, ...)
# S3 method for norMmixMLE
plot(x, y = NULL,
show.x = TRUE,
main = sprintf(
"norMmixMLE(*, model=\"%s\") fit to n=%d observations in %d dim.",
nm$model, x$nobs, nm$dim
),
sub = paste0(
sprintf("log likelihood: %g; npar=%d", x$logLik, x$npar),
if (!is.null(opt <- x$optr)) paste("; optim() counts:", named2char(opt$counts))
),
cex.data = par("cex") / 4, pch.data = 4,
...)
# S3 method for fittednorMmix
plot(x, main = "unnamed", plotbest = FALSE, ...)plot2d (nMm, data = NULL,
add = FALSE,
main = NULL,
sub = NULL,
type = "l", lty = 2, lwd = if (!is.null(data)) 2 else 1,
xlim = NULL, ylim = NULL, f.lim = 0.05,
npoints = 250, lab = FALSE,
col = Trubetskoy10[1],
col.data = adjustcolor(par("col"), 1/2),
cex.data = par("cex"), pch.data = par("pch"),
fill = TRUE, fillcolor = col, border = NA,
...)
plotnd(nMm, data = NULL,
main = NULL,
diag.panel = NULL,
...)
Trubetskoy10
plot.norMmix
In the 2 dimensional case, returns invisibly coordinates
of bounding ellipses of distribution.
an R object inheriting from "norMmix"
.
further data matrix, first 2 columns will be plotted by
"points"
further arguments to be passed to another plotting function.
Option for plot.norMmixMLE
. Plot data points along with estimated model.
Defaults to TRUE
.
Data points to plot.
This argument is used in the internal function, plot2d
, to control whether
to create a new plot or add to an existing one. Should not be set by the user.
Defaults to FALSE
Set main title. See Usage
section for default values.
Set subtitle. See Usage
section for default values.
Graphing type for ellipses border. Defaults to "l".
Line type to go with the type
. See "par"
.
Line width as in lty
.
Set explicit x limits for 2d plots.
As xlim
.
Percentage value for how much to extend xlim
and ylim
.
As in the f
argument to "extendrange"
.
How many points to use in the drawn ellipses. Larger values make them prettier but might affect plot times.
Whether to print labels for mixture components. Will print "comp
Fill color for ellipses. Default is "#4363d8".
Color to be used for data points.
See "par"
.
See "par"
.
Leave ellipses blank with outline or fill them in.
Color for infill of ellipses.
Argument to be passed to polygon
.
Function to plot 2d projections of a higher-dimensional mixture model.
Used by plotnd
.
Requires function with signature function(x, y, data = NULL, ...)
Should not be set by the user.
Used by fittednorMmix
. Plot best fitting model using plot.norMmix
.
The plot method calls one of two auxiliary functions, one for dim=2,
another for higher dimensions. The method for 2 dimensional plots also takes a
add
parameter (FALSE
by default), which allows for the ellipses
to be drawn over an existing plot.
The higher dimensional plot method relies on the pairs.default
function
to draw a lattice plot, where the panels are built using the 2 dimensional method.
Trubetskoy10
: A vector of colors for these plots,
chosen to be distinguishable and accessible for the colorblind, according to
https://sashamaps.net/2017/01/11/list-of-20-simple-distinct-colors/,
slightly rearranged, so that the first five colors stand out well on white background.
plot(MW212) ## and add a finite sample realization:
points(rnorMmix(n=500, MW212))
## or:
x <- points(rnorMmix(n=500, MW212))
plot(MW212, x)
## Example of dim. = p > 2 :
plot(MW34)
Run the code above in your browser using DataLab