qt.plot {plotrix} | R Documentation |
Display the counts of numeric quantities against the intervals between quantities that are equal when rounded to integers.
qt.plot(qnt,qtime=NA,col=NULL,border="lightgray", main="Quantity x interval",xlab="Interval",ylab="Quantity", mar=c(5,4,4,4),...)
qnt |
Numeric vector |
qtime |
Numeric vector - may be a date as an integer. |
col |
The colors to fill the strips. NA for none. |
border |
border color for the polygons |
main |
The title of the plot. |
xlab,ylab |
Axis labels. |
mar |
margins for the plot - defaults to leave space for scale |
... |
additional arguments passed to plot . |
The intervals calculated from qtime
are the x values and the counts
of values of qnt
are the y values of the plot displayed as the widths
of sections of polygons running across the time intervals. This plot was
devised to display the distribution of drinking, but may be useful for any
situation in which it is desired to display the distribution of numerically
coded quantities against the intervals between their occurrence.
qt.plot
assumes that the values in qtime
represent interpretable
intervals like seconds or days. The default is to assume sequential time
intervals. If qtime
contains dates, they must be translated to
numeric format. These values will be sorted by the function. If qtime
is NA,
it will be assigned 1:length(qnt)
.
nil
Jim Lemon
# first a moderate drinker with infrequent big sessions qnt<-rpois(365,2) qtdates<-seq(as.Date("2007-01-01"),as.Date("2007-12-31"),by=1) qt.plot(qnt,as.numeric(qtdates),xlab="Number of days interval", ylab="Standard drinks per session") # now add monthly big sessions qnt[c(30,60,90,120,150,180,210,240,270,300,330,360)]<-rep(8,length.out=12) qt.plot(qnt,as.numeric(qtdates),xlab="Number of days interval", ylab="Standard drinks per session")