Skip to contents

categoryplot generates a bubble plot of the contents of a matrix in an effort to visualize 2-D trends in the data. It must have the numeric year variable in the columns. So if using table or tapply to generate the matrix put year last in the list of variables.

Usage

categoryplot(
  x,
  xlab = "",
  ylab = "",
  mult = 0.1,
  gridx = FALSE,
  addtotal = FALSE,
  addlines = 3,
  textcex = 1
)

Arguments

x

the matrix of values to be plotted

xlab

the label for the x-axis, default=''

ylab

the label for the y-axis, default=''

mult

the multiplier for the values. Should be selected so that the circles produce a visual representation of the variation in the data

gridx

should grey grid-lines be added for each year. default=FALSE

addtotal

should the sum of the year columns be printed at the top of the diagram. default=FALSE. If TRUE it prints the column totals sequentially addlines-2 lines and then addlines-1 lines above the circles

addlines

if addtotal is TRUE then a number of lines are added at the top of the plot to contain the column totals. This argument determines the number of extra lines. default=3, but if only a few then a smaller number would be more appropriate. If addtotal = FALSE, then addlines is ignored

textcex

the totals at the top of the plot can be too large with the default=1 so change the value here if required.

Value

nothing but it does generate a plot

Examples

xmat <- matrix(rnorm(25,5,2),nrow=5,ncol=5,dimnames=list(1:5,1:5))
categoryplot(xmat,mult=0.03,ylab="Random Numbers",addtotal=TRUE,addline=2)