Skip to contents

twodens function for 2D density calculations of one or two components

Usage

twodens(.IC, .x, .y, ..., .flag)

Arguments

.IC

A tibble containing ion count data.

.x

The variable plotted on the x-axis.

.y

The variable plotted on the y-axis.

...

Variables for grouping.

.flag

Variable identifying two components in the data.

Value

A tibble::tibble() with the 2D density of x and y named dens_z.

Details

This function is inspired by code in the blog-post by Thomas Mock, which deals with over-plotting of very dens data. This is just the problem that occurs when dealing with SIMS ion count data, which usually entails thousands of data-points (measurements) for just one analysis. The function provided here can deal with density of one or two components, where in the latter case the difference of two 2D density matrices is used to show the area on the plot with a maximum difference.