plot.Hypervolume: Plot a hypervolume or list of hypervolumes

View source: R/hypervolume_plot.R

plot.HypervolumeListR Documentation

Plot a hypervolume or list of hypervolumes

Description

Plots a single hypervolume or multiple hypervolumes as either a pairs plot (all axes) or a 3D plot (a subset of axes). The hypervolume is drawn as a uniformly random set of points guaranteed to be in the hypervolume.

Usage

## S3 method for class 'HypervolumeList'
plot(x, 
   show.3d=FALSE,plot.3d.axes.id=NULL,
   show.axes=TRUE, show.frame=TRUE,
   show.random=TRUE, show.density=TRUE,show.data=TRUE,
   names=NULL, show.legend=TRUE, limits=NULL, 
   show.contour=TRUE, contour.lwd=1.5, 
    contour.type='kde', 
    contour.alphahull.alpha=0.25,
    contour.ball.radius.factor=1, 
    contour.kde.level=1e-04,
    contour.raster.resolution=20,
   show.centroid=TRUE, cex.centroid=2,
   colors=rainbow(floor(length(x@HVList)*1.5),alpha=0.8), 
   point.alpha.min=0.2, point.dark.factor=0.5,
   cex.random=0.5,cex.data=0.75,cex.axis=0.75,cex.names=1.0,cex.legend=0.75,
   num.points.max.data = 1000, num.points.max.random = 2000, reshuffle=TRUE,
   plot.function.additional=NULL,
   verbose=FALSE,
   ...)

Arguments

x

A Hypervolume or HypervolumeList object. The objects to be plotted.

show.3d

If TRUE, makes a three-dimensional plot of a subset of axes determined by plot.3d.axes.id; otherwise, a pairs plot of all axes. Requires that the rgl library is installed.

plot.3d.axes.id

Numeric identities of axes to plot in three dimensions. Defaults to 1:3 if set to NULL.

show.axes

If TRUE, draws axes on the plot.

show.frame

If TRUE, frames the plot with a box.

show.random

If TRUE, shows random points from the hypervolume.

show.density

If TRUE, draws random points with alpha level proportional to their unit-scaled probability density. Note that this has no effect when probability density is not relevant, i.e. for hypervolumes that are the output of set operations.

show.data

If TRUE, draws data points from the hypervolume. Note that this has no effect if the hypervolume is not associated with data points, e.g. for those that are the output of set operations.

names

A vector of strings in the same order as the input hypervolumes. Used to draw the axes labels.

show.legend

If TRUE, draws a color legend.

limits

A list of two-element vectors corresponding to the axes limits for each dimension. If a single two-element vector is provided it is re-used for all axes.

show.contour

If TRUE, draws a boundary line saround each two-dimensional projection. Ignored if show.3d=TRUE.

contour.lwd

Line width used for contour lines. Ignored if show.contour=FALSE.

contour.type

Type of contour boundary: any of "alphahull" (alpha hull), "ball" (experimental ball covering), "kde" (2D KDE smoothing), or "raster" (grid-based rasterization).

contour.alphahull.alpha

Value of the alpha parameter for a "alphahull" contour. Can be increased to provide smoother contours.

contour.ball.radius.factor

Factor used to multiply radius of ball surrounding each random point for a "ball" contour.

contour.kde.level

Probability level used to delineate edges for a "kde" contour.

contour.raster.resolution

Grid resolution for a "raster" contour.

show.centroid

If TRUE, draws a colored point indicating the centroid for each hypervolume.

cex.centroid

Expansion factor for the centroid symbol.

colors

A vector of colors to be used to plot each hypervolume, in the same order as the input hypervolumes.

point.alpha.min

Fractional value corresponding to the most transparent value for plotting random points. 0 corresponds to full transparency.

point.dark.factor

Fractional value corresponding to the darkening factor for plotting data points. 0 corresponds to fully black.

cex.random

cex value for uniformly random points.

cex.data

cex value for data points.

cex.axis

cex value for axes, if pair=T.

cex.names

cex value for variable names printed on the diagonal, if pair=T.

cex.legend

cex value for the legend text

num.points.max.data

An integer indicating the maximum number of data points to be sampled from each hypervolume. Lower values result in faster plotting and smaller file sizes but less accuracy.

num.points.max.random

An integer indicating the maximum number of random points to be sampled from each hypervolume. Lower values result in faster plotting and smaller file sizes but less accuracy.

reshuffle

A logical value relevant when pair=TRUE. If false, each hypervolume is drawn on top of the previous hypervolume; if true, all points of all hypervolumes are randomly shuffled so no hypervolume is given visual preference during plotting.

plot.function.additional

Any function(i,j) that will add additional plotting commands for column i and row j of the pairs plot. Should not create new plots or change par() settings. Has no effect if show.3d=TRUE.

verbose

If TRUE, prints diagnostic information about the number of points being plotted

...

Additional arguments to be passed to rgl::plot3d.

Value

None; used for the side-effect of producing a plot.

Note

Contour line plotting with alphahull requires the non-FOSS alphahull package to be installed. Please do so in order to use this functionality!

See Also

hypervolume_save_animated_gif

Examples

## Not run: 
# low parameter values for speed
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
penguins_adelie = penguins_no_na[penguins_no_na$species=="Adelie",
                    c("bill_length_mm","bill_depth_mm","flipper_length_mm")]

hv = hypervolume_gaussian(penguins_adelie,name='Adelie')

# 2d plot
plot(hv, show.3d=FALSE)

# 3d plot
if(interactive()) 
{
  plot(hv, show.3d=TRUE)
}

## End(Not run)

hypervolume documentation built on May 29, 2024, 8:19 a.m.