mproc-methods: Methods for function 'plot' in package 'mproc'

Description Usage Arguments Methods Author(s) Examples

Description

Plot objects of class mproc.

Usage

1
2
## S4 method for signature 'mproc'
plot(x, period=NA, id=1, mks=NULL, palette=rainbow, cols=NULL, xlab="Time", ylab="",...)

Arguments

x

an object of class mproc.

period

if given, will wrap the data into periods, and plot each period on a horizontal line. See example.

id

the vector id to be plotted in periods. Ignored if period is not given.

mks

a vector or a list of vectors of marks. Points with the same mark will be shown in the same colour.

palette

a colour palette. Ignored if mks is NULL or cols is given.

cols

a vector or a list of vectors of colours for the points.

xlab

the label for the x-axis.

ylab

the label for the y-axis.

...

further arguments passed on to plot.

Methods

signature(x = "mproc")

Author(s)

Patrick Rubin-Delanchy <patrick.rubin-delanchy@bristol.ac.uk>

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
A = c(.1, .2, .3)
B = c(.1, .2, .3)
##Giving the last point in B a different colour from the rest
## Not run: plot(mp(list(A=A,B=B)), mks=list(c(1,1,1), c(1,1,2)))

#### A and B have a common daily pattern:
### their intensity is a sinusoidal curve lambda(t) = 1+sin(2*pi*t)
start=0; end=365 #A year
##the cumulative intensity is 
F=function(t){
    t%/%1+t%%1+(1-cos(2*pi*t%%1))/(2*pi)
}
##Dropping 365 A and B points according to F
A=sapply(runif(365), function(u){uniroot(function(x) F(x)/365-u, interval=c(0,365))$root})
B=sapply(runif(365), function(u){uniroot(function(x) F(x)/365-u, interval=c(0,365))$root})
##This plots A and B
## Not run: plot(mp(A,B, start=start, end=end), pch=".")

##This plots B, one day represented on each horizontal line
## Not run: plot(mp(A,B, start=start, end=end), period=1, id=2)

##Same as above, but now colouring the seventh day of every week differently:
## Not run: plot(mp(A,B, start=start, end=end), period=1, id=2,mks=round(B%%7)==6)
##Now A and B are in the same plot, different colour
lA=length(A); lB=length(B); 
## Not run: plot(mp(c(A,B),start=start,end=end),period=1,mks=c(rep(1,lA), rep(2,lB)))

mppa documentation built on May 2, 2019, 2:48 a.m.