histW: Histogram (version by WR)

Description Usage Arguments See Also Examples

View source: R/histW.R

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 log2-data 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
histW(
  dat,
  fileName = "histW",
  output = "screen",
  nBars = 8,
  breaks = NULL,
  tit = NULL,
  subTi = NULL,
  xLab = NULL,
  yLab = NULL,
  las = NULL,
  xcex = 0.7,
  imgxSize = 900,
  useCol = NULL,
  useBord = NULL,
  isLog = TRUE,
  cexSubTi = NULL,
  cropHist = TRUE,
  parDefault = TRUE,
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

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

las

(integer) optional fixed text orientation of x-axis numbers : use 1 for horizontal and 2 for perpendicular, see also par

xcex

(numeric) cex-type expansion factor for x-axis numbers, see also par

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

silent

(logical) suppress messages

debug

(logical) additonal messagesfor debugging

callFrom

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

See Also

hist

Examples

1
2
3
4
5
6
7
8
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])

wrGraph documentation built on April 12, 2021, 1:07 a.m.