View source: R/hdrscatterplot.R

hdrscatterplot | R Documentation |

Produces a scatterplot where the points are coloured according to the bivariate HDRs in which they fall.

hdrscatterplot( x, y, levels = c(1, 50, 99), kde.package = c("ash", "ks"), noutliers = NULL, label = NULL )

`x` |
Numeric vector or matrix with 2 columns. |

`y` |
Numeric vector of same length as |

`levels` |
Percentage coverage for HDRs |

`kde.package` |
Package to be used in calculating the kernel density
estimate when |

`noutliers` |
Number of outliers to be labelled. By default, all points outside the largest HDR are labelled. |

`label` |
Label of outliers of same length as |

The bivariate density is estimated using kernel density estimation. Either
`ash2`

or `kde`

is used to do the
calculations. Then Hyndman's (1996) density quantile algorithm is used to
compute the HDRs. The scatterplot of (x,y) is created where the points are
coloured according to which HDR they fall. A ggplot object is returned.

Rob J Hyndman

`hdr.boxplot.2d`

x <- c(rnorm(200, 0, 1), rnorm(200, 4, 1)) y <- c(rnorm(200, 0, 1), rnorm(200, 4, 1)) hdrscatterplot(x, y) hdrscatterplot(x, y, label = paste0("p", 1:length(x)))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.