htbPlotHis: Drawer of raster/histograms

View source: R/htbPlotHis.R

htbPlotHisR Documentation

Drawer of raster/histograms

Description

Draws a raster/histogram from htbRas and/or htbHis objects.

Usage

htbPlotHis(
  his = NULL,
  ras = NULL,
  index = NULL,
  prop = c(0.8, 0.4, 50),
  xlim = NULL,
  ylim = NULL,
  histy = "l",
  hiscol = NULL,
  hislty = "solid",
  hislwd = 2,
  hispch = 15,
  hisname = NULL,
  hiscex = 0.5,
  hisbty = "o",
  hisleg = "bottomright",
  sdty = "n",
  sdcol = NULL,
  sdlty = "22",
  sdlwd = 1,
  rasty = "p",
  rascol = NULL,
  raspch = ".",
  rassp = 2,
  nlines = NULL,
  evcol = NULL,
  evpch = 15,
  evname = NULL,
  evcex = 0.5,
  evbty = "o",
  evleg = "topright",
  sqlim = NULL,
  sqpanel = c(1, 1),
  sqcol = "gray90",
  vlat = NULL,
  vlcol = "gray30",
  vllty = "solid",
  xlab = "Time [ms]",
  ylab = NULL,
  bty = "l",
  las = 1,
  ...
)

Arguments

his

A list of htbHis object(s).

ras

A list of htbRas object(s).

index

Integers. Indices of conditions to be plotted.

prop

Numeric vector of length three. The three values respectively determine

  1. the proportion of height (from the top) occupied by rastergrams,

  2. the proportion of height (from the bottom) occupied by histograms, and 3) approximate number of raster lines. These parameters are then used to automatically set the magnification of vertical axis for plotting.

xlim

A list of numeric vectors all of which are length two. Each element determines the xlim (c(from, to)) of the corresponding panel included in the plot. If not provided, original temporal limits used when creating htbRas object (and further htbHis object) are used.

ylim

A numeric vector of length two. Since the vertical axis is kept unchanged for the panels drawn in one htbPlotHis() call, only a pair of two values (c(from, to)) is needed for ylim (unlike the case of xlim). Normally you don't need to explicitly designate this argument so that the function automatically set an appropriate range.

histy

A string. The type of the histogram drawing. Default l draws histograms as lines, which will suit the case when you have two or more conditions to be drawn altogether in a same graph. On the other hand, h will draw traditional building-like filled histograms (that surely overlap with each other and deteriorate the readability).

hiscol

Strings. The colors of the histograms. If not provided, the same set of colors were inherited from rascol. If neither hiscol nor rascol is provided, colors are automatically generated by htb.colors().

hislty

Strings. The line types of the histograms.

hislwd

Numerics. The line widths of the histograms.

hispch

Either integers or strings. The pointing characters used in the histogram legend.

hisname

Strings. The names of the histograms used in the histogram legend.

hiscex

Numerics. The magnification of points used in the histogram legend.

hisbty

A string. The box type of the histogram legend.

hisleg

A string. The keyword to locate the histogram legend used as legend argument in graphics::legend(). If NULL, the histogram legend will not be drawn.

sdty

A string. The type of the SD (or SE) ranges to draw when plotting population histograms. Default n omits SD information. On the other hand, l draws it as upper and lower limits (mean +/- SD) using parallelling lines using graphics::lines(). Also, p draws it by graphics::polygon() , resulting in belts with some widths. Another option b results in a similar plot but draws it by repetitive vertical lines with graphics::segments() (like, so to say, centipede graphs, but be careful not to search this word directly if you have acaraphobia.) which will suit the case when you have two or more conditions to be drawn altogether in a same graph. On the other hand, h will draw traditional building-like filled histograms (that surely overlap with each other and deteriorate the readability).

sdcol

Strings. The colors of the SD ranges. If not provided, automatically generated by htb.colors().

sdlty

Strings. The line types of the SD lines.

sdlwd

Numerics. The line widths of the SD lines.

rasty

A string. The type of the rastergrams. Default p plots rasters by symbols pointed by graphics::points(). On the other hand, l draws them as vertical ticks drawn by graphics::segments().

rascol

Strings. The colors of the rastergrams. If not provided, the same set of colors were inherited from hiscol. If neither hiscol nor rascol is provided, colors are automatically generated by htb.colors().

raspch

A string. The point types of the rastergrams.

rassp

A numeric. Amount of blank space inserted between rastergrams of different conditions. The value is treated as a number of blank lines (i.e., multiplied by the height of one line in the rastergram).

nlines

Numerics. Number of raster lines.

evcol

Strings. The colors of the rastergrams. If not provided, colors are automatically generated by grDevices::rainbow().

evpch

A numeric or string. The point types of the event dot designated in the same code to the standard graphics::points().

evname

Strings. The names of the task eventss used in the event legend.

evcex

A numeric. The magnification of event points.

evbty

A string. The box type of the event legend.

evleg

A string. The keyword to locate the event legend used as legend argument in graphics::legend(). If NULL, the event legend will not be drawn.

sqlim

A numeric vector of length two. When not NULL, a square shading is drawn at designated xlim range (c(from, to)).

sqpanel

An integer vector of length two that indicates the panels from/to which the shading is drawn.

sqcol

A string. The color of the shading area.

vlat

A numeric. Location to which a vertical line is drawn in EACH of the existing panels (normally used to denote horizontal origins of each panel).

vlcol

A string. The color of the vertical line(s).

vllty

A string. The line types of the vertical line(s).

xlab

A string. The label on the horizontal axis.

ylab

A string. The label on the vertical axis.

bty

A string. The box type of the whole plot.

las

An integer. The direction of the axis labelling used in graphics::par().

...

Other arguments passed to htbPlotWindow().

Details

htbPlotHis() plots rastergrams and histograms from provided htbRas and/or htbHis objects. Multiple set of objects can be provided to his and ras arguments as lists of htbHis and htbRas objects, respectively, which are then plotted as panels horizontally aligned in the same one plot. Since this function has become somewhat hypertrophic, a decomposition of the function is intended in the near future.

Value

Numerics. Amout of horizontal shifts of the panels that can be used in additional graphical drawings.

Examples

alignment <- list(CUEON_L = c(-1500, 2000), CUEON_R = c(-1500, 2000))
incld <- list(TRIALSTART = c(-2000, 0), TRIALEND = c(0, 2000))
excld <- list(ERROR = c(0, 2000))

## Not run: 
db_sp <- htbGetDb("spike.htb")
db_ev <- htbGetDb("event.htb")
ras <- htbGetRas(db_sp, db_ev, alignment,
  incld = incld, excld = excld)
his <- htbGetHis(ras)
htbPlotHis(his)

## End(Not run)


keimochizuki/htb documentation built on June 9, 2025, 10:03 p.m.