stat_chull: [+] A convex hull layer for 'ggplot2'

View source: R/stat_chull.R

stat_chullR Documentation

[+] A convex hull layer for ggplot2

Description

Create a layer of convex hull for ggplot2 plots.

Usage

stat_chull(
  mapping = NULL,
  data = NULL,
  geom = "polygon",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

mapping

Set of aesthetic mappings created by aes or aes_. If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping.

data

A layer specific dataset - only needed if you want to override the plot defaults.

geom

The geometric object to use display the data.

position

The position adjustment to use for overlapping points on this layer.

na.rm

If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders.

...

Other arguments passed on to layer. These are often aesthetics, used to set an aesthetic to a fixed value, like color = "red" or size = 3.

Value

Layer of convex hull for ggplot2 plots.

Author(s)

Hadley Wickham

Source

Source: vignette Extending ggplot2

See Also

Other spHelper plots: check_palette(), layer_spRangeMean(), plot_colors(), plot_hyPalette(), plot_spCompare(), plot_spDiff(), plot_spDistribution(), qplot_confusion(), qplot_crosstab(), qplot_infoDim(), qplot_kAmp(), qplot_kSp(), qplot_prediction(), qplot_spRangeCenter(), qplot_spRangeMedian(), qplot_spStat(), qplot_spc(), rmExpr(), rm_stripes()

Examples


ggplot(mpg, aes(displ, hwy)) +
             geom_point() +
             stat_chull(fill = NA, colour = "black")


ggplot(mpg, aes(displ, hwy, colour = drv)) +
             geom_point() +
             stat_chull(fill = NA)


ggplot(mpg, aes(displ, hwy)) +
             stat_chull(geom = "point", size = 4, colour = "red") +
             geom_point()


GegznaV/spHelper documentation built on April 16, 2023, 1:42 p.m.