wrGraph (version 1.1.0)

histW: Histogram (version by WR)

Description

This function proposes a few special tweaks to the general hist function : In a number of settings data are treated and plotted as log-data. This function allows feeding directly data which are already log2 and displaying the x-axis (re-translated) in linear scale (see argument isLog). The default settings allow making (very) small histograms ('low resolution'), which may be used as a rough overview of bandwidth and distribution of values in dat. Similar to hist, by changing the parameters nBars and/or breaks very 'high resolution' histograms can be produced. By default it displays n per set of data (on the top of the figure). Note that the argument for (costom) title main is now called tit.

Usage

histW(
  dat,
  fileName = "histW",
  output = "screen",
  nBars = 8,
  breaks = NULL,
  tit = NULL,
  subTi = NULL,
  xLab = NULL,
  yLab = NULL,
  imgxSize = 900,
  useCol = NULL,
  useBord = NULL,
  isLog = TRUE,
  cexSubTi = NULL,
  cropHist = TRUE,
  parDefault = TRUE,
  callFrom = NULL,
  silent = FALSE
)

Arguments

dat

(matrix, list or data.frame) data to plot

fileName

(character) name of file for saving graphics

output

(character, length=1) options for output on 'screen' or saving image in various formats (set to 'jpg','png' or 'tif')

nBars

(integer) number of bars in histogram (default for 'low resolution' plot to give rough overview)

breaks

(integer) for (partial) compatibility with hist() : use only for number of breaks (or 'FD'), gets priority over 'nBars'

tit

(character) custom title

subTi

(character) may be FALSE for NOT displaying, or any text, otherwise range

xLab

(character) custom x-axes label

yLab

(character) custom y-axes label

imgxSize

(integer) width of image when saving to file, see also par

useCol

(character or integer) custom colors, see also par

useBord

(character) custom histogram elements border color, see also par

isLog

(logical) for lin scale signal intensity values where repesentation needs log, assume log2 if TRUE

cexSubTi

(numerical) subtitle size (expansion factor cex), see also par

cropHist

(logical) -not implemented yet- designed for cutting off bars with very low ('insignificant') values

parDefault

(logical) to automatic adjusting par(marg=,cex.axis=0.8), see also par

callFrom

(character) allow easier tracking of message(s) produced

silent

(logical) suppress messages

See Also

hist

Examples

Run this code
# NOT RUN {
set.seed(2016); dat1 <- round(c(rnorm(200,6,0.5),rlnorm(300,2,0.5),rnorm(100,17)),2)
dat1 <- dat1[which(dat1 <50 & dat1 > 0.2)]
histW(dat1,br="FD",isLog=FALSE)
histW(log2(dat1),br="FD",isLog=TRUE)

## quick overview of distributions  
layout(partitionPlot(4))
for(i in 1:4) histW(iris[,i],isLog=FALSE,tit=colnames(iris)[i])
# }

Run the code above in your browser using DataCamp Workspace