Given ordered class labels, make a row of colors grouped by the categories of class. This is the first plot in makepanel. All subsequent panelets should follow this ordering of class labels.

panelet_group(gr, gr.col,gr.name="group",border=FALSE,
border.col="black", legend=FALSE, ...)

Arguments

gr

a vector, of class labels in the form of character or integer

gr.col

a vector of colors specified for each class in gr. Also accepts vector from RcolorBrewer

gr.name

a string, name of your group labels

border

logical. default is FALSE. If TRUE a border in black color is drawn across the color vector.

border.col

default is "black", if border=TRUE, you can specify the color of the border to be plotted. Plots outside the panelet and class boundaries

legend

logical. default is FALSE. if TRUE it returns a key specifying each color assigned to the class labels. Only displays in the plot with makepanel

...

pass optional arguments here

Details

... can pass other parameters. Use it for controlling names and colors of panelets via cex, col. border line type and thickness can be controlled via lty and lwd respectively.

Value

A colored panelet ordered by class labels is plotted.

key

if legend = TRUE, returns a key mapping the group labels to specific color

See also

makepanel

Examples

#adjust margins and number of panelet values par(mfrow=c(6,1),mar=c(0,8,0,14)) #sort the entire data frame according to the group solution you are interested in mtcars.sort = mtcars[order(mtcars$cyl),] #plot group tt=panelet_group(gr=mtcars.sort$cyl, gr.col=c("red","blue","green"), gr.name="cyl",cex=1, border=FALSE, legend=FALSE)