hist2D: 2D density plot

View source: R/general.purpuse.utilities.R

hist2DR Documentation

2D density plot

Description

Replacement of scatterplot to be used when number of points is to high and/or they highly overlap

Usage

hist2D(
  x,
  y,
  xbins = 100,
  ybins = 100,
  cols = c("white", "gray", "blue", "orange", "red"),
  zfun = identity,
  leg.title = "",
  num.leg.tic = NULL,
  legend = TRUE,
  trimZq = 0,
  xlim = NULL,
  ylim = NULL,
  zlim = NULL,
  new = TRUE,
  xlab = deparse(substitute(x)),
  ylab = deparse(substitute(y)),
  ...
)

Arguments

x, y

point coordinates

xbins, ybins

number of bins or bin borders. Everything outside of bins are removed

cols

colours to form gradient

zfun

transformation of frequency (try log1p, sqrt, etc). Identity by default

leg.title

legend title

num.leg.tic

desired number of tics in the legend

legend

logical, should legend be plotted

trimZq

frequencies outside of quantile(trimZq,1-trimZq) are set to the corresponding (closest) quantiles. Default is 0 (not trimming). See trimQ.

xlim, ylim, zlim, xlab, ylab

graphical parameters

new

create new plot (default) or add to existing

...

other arguments for plot function

Value

list bith bins and frequencies (invisible)


iaaka/visutils documentation built on June 13, 2025, 6:06 p.m.