wrGraph (version 1.1.0)

legendHist: Add histogram to existing plot

Description

Add histogram at pleace of legend using colors from 'colorRamp'.

Usage

legendHist(
  x,
  colRamp = NULL,
  location = "bottomright",
  legTit = NULL,
  cex = 0.7,
  srt = 67,
  offS = NULL,
  border = TRUE,
  silent = FALSE,
  callFrom = NULL
)

Arguments

x

(numeric) main input/component of plot

colRamp

(character or integer) set of colors, default is rainbow-like

location

(character) for location of histogram inside existing plot (may be 'br','bl','tl','tr','bottomright', 'bottomleft','topleft','topright')

legTit

(character, length=1) optional title for histogram-insert

cex

(numeric) expansion factor (see also par)

srt

(numeric) angle for histogram text labels (90 will give vertical label) (see also par)

offS

(NULL or numeric, length=5) fine-tuning of where histogram-insert will be placed and how elements therein are ditributed (default c(xOff=0.2,yOff=0.25,leftOffS=0.05, upperBarEnd=1.05,txtOff=0.02), 1st and 2nd determine proportio of insert relative to entire plotting region, 3rd defines space left on bottom for text, 4th if bars hit ceiling of insert or proportion to leave, 5th for shifting text towards top when turned other than 90 degrees )

border

(logical) decide of draw gray rectangle or not around legend

silent

(logical) suppress messages

callFrom

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

Value

figure

Examples

Run this code
# NOT RUN {
dat <- rnorm(90); plot(dat)
legendHist(dat, col=1:5)
# }

Run the code above in your browser using DataCamp Workspace