PlotRasterFromSweeps: Make a raster plot from a set of Nclamp sweeps recording...

Description Usage Arguments Details Author(s) See Also Examples

Description

This overloads base R's plot and calls PlotRasterFromSweeps

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
PlotRasterFromSweeps(sweepdir, sweeps, subdir = "", subset = NULL,
  xlim = NULL, xaxis = TRUE, yaxis = TRUE, frame.plot = TRUE,
  xaxs = "i", yaxs = "i", main, sub, xlab = "Time/ms",
  ylab = "Odour", pch = 22, dotcolour = "black", dotsize = 0.5,
  dotwidth = 20, spikeheight = 0.8, odourRange = NULL,
  odourCol = rgb(1, 0.8, 0.8, 1), relabelfun = identity,
  fixChannels = NULL, IncludeChannels = FALSE, PlotSpikes = TRUE,
  PlotDividers = TRUE, DividerCol = "black", DividerLwd = 0.5,
  panel.first = NULL, panel.last = NULL, ...)

## S3 method for class 'spiketimes'
plot(x, ...)

Arguments

sweepdir

directory containing Nclamp pxp sweep files

sweeps

Vector of sweeps to include (e.g. 1:7) or character regex which sweeps must match.

subdir

subdirectory containing group of spike times txt files

subset

Numeric vector of channels or character vector of odours

xlim

x axis range of plot

xaxis

(default TRUE)

yaxis

(default TRUE)

frame.plot

Plot a box around the whole plot (default TRUE)

xaxs, yaxs

Whether to extend xlim,ylim by 4 percent (see ?par, default FALSE)

main

main title of plot (see title)

sub

subtitle of plot

xlab

axis label (default Time/ms)

ylab

axis label (default odour)

pch

plotting character (default 22 is a square, see details for rect)

dotcolour

colour of dots in raster plot (default black)

dotsize

size of dots in raster plot (default 0.5)

dotwidth

Width in ms of rectangle when pch='rect'

spikeheight

Relative height of spike when pch='rect' (default 0.8)

odourRange

time window of odour delivery

odourCol

colour of odour window (default pale red)

relabelfun

function to apply to odour labels (default no relabelling)

fixChannels

Optional named integer vector that remaps some bad numeric channels to correct odours. FIXME shouldn't we fix channels as well.

IncludeChannels

include numeric id of odour channel (e.g. for blanks)

PlotSpikes

Whether to plot the spikes (default TRUE)

PlotDividers

Plot the dividing lines between odours (default TRUE)

DividerCol

the colour with which to plot dividing lines between odours (default black)

DividerLwd

the width of the lines between odours (default 0.5)

panel.first

An expression to be evaluated after the plot axes are set up but before any plotting takes place

panel.last

An expression to be evaluated after spikes have been plotted

...

Additional parameters passed to plot

x

A spiketimes object

Details

Note that can also give a spiketimes list from CollectSpikesFromSweeps By default the odour stimulus is represented by a pale red rectangle in a layer behind the spikes. If pch takes the special value "rect" then rectangles of width dotwidth are drawn. spikewidth will then specify the relative size of the spikes with 1 resulting in the top of spikes from one line at the same height as the base of spikes in the line above. If more than one stimulus is required, odourRange can be specified as a vector of successive start,stop times e.g. c(start1,stop1,start2,stop2).

Author(s)

jefferis

See Also

CollectSpikesFromSweeps, AddLinesToRasterPlot,fix.odd and plot.default for graphical parameters

PlotRasterFromSweeps, spiketimes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Plot time range 2-4s with odour pulse 2-3s for sweeps 0,1,3
PlotRasterFromSweeps(
  system.file('igor','spikes','nm20110811c0',package='gphys'),
  c(0,1,3),xlim=c(2000,4000),odourRange=c(2000,3000))
# Use rectangles for spikes instead
PlotRasterFromSweeps(
  system.file('igor','spikes','nm20110811c0',package='gphys'),
  c(0,1,3),xlim=c(0,4000),odourRange=c(2000,3000),dotwidth=20,pch='rect')
## Fix a bad label, first define a function 
relabel=function(labels) {labels[labels=="fly"]="empty";labels}
## and then use it
PlotRasterFromSweeps(
  system.file('igor','spikes','nm20110811c0',package='gphys'),
  c(0,1,3),relabelfun=relabel)
## Example with block based organisation 
## i.e. spike files sorted into different subdirs for each stimulus protocol
PlotRasterFromSweeps(
  system.file('igor','spikes','nm20120514c2',package='gphys'),
  subdir='BLOCKA',odourRange=c(2000,2500),xlim=c(0,5000))
## Example of fixing one of Jonny's traces when channels were mixed up
fixVec=c(empty=31,IAA=30,cVA=29,PAA=27,`4ol`=26,ctr=25)
PlotRasterFromSweeps(
  system.file('igor','spikes','nm20110907c3',package='gphys'),
  subdir='BLOCKI',odourRange=c(2000,2500),xlim=c(0,5000),fixChannels=fixVec)
## Imagine a double odour stimulation
PlotRasterFromSweeps(
  system.file('igor','spikes','nm20110907c3',package='gphys'),
  subdir='BLOCKI',odourRange=c(2000,2500,3000,3250),xlim=c(0,5000),
  fixChannels=fixVec)
options(gphys.datadir=system.file('igor','spikes',package='gphys'))
spikes=CollectSpikesFromSweeps('nm20120514c2',subdir='BLOCKB')
plot(spikes)

jefferis/gphys documentation built on June 5, 2019, 9:45 p.m.