Thursday, April 28, 2011

Treemap / mosaic plot

mosaic plots:

assocplot (graphics)
Cohen-Friendly association plot indicating deviations from independence of rows and columns in a 2-dimensional contingency tables.

assocplot(x, col = c("black", "red"), space = 0.3,
main = NULL, xlab = NULL, ylab = NULL)

mosaicplot (graphics)
Plots a mosaic on the current graphics device.

mosaicplot(x, main = deparse(substitute(x)),
sub = NULL, xlab = NULL, ylab = NULL,
sort = NULL, off = NULL, dir = NULL,
color = NULL, shade = FALSE, margin = NULL,
cex.axis = 0.66, las = par("las"),
type = c("pearson", "deviance", "FT"), ...)

## S3 method for class 'formula':
mosaicplot(formula, data = NULL, ...,
main = deparse(substitute(data)), subset,
na.action = stats::na.omit)

mosaic (vcd)
Plots (extended) mosaic displays.

## Default S3 method:
mosaic(x, condvars = NULL,
split_vertical = NULL, direction = NULL, spacing = NULL,
spacing_args = list(), gp = NULL, expected = NULL, shade = NULL,
highlighting = NULL, highlighting_fill = grey.colors, highlighting_direction = NULL,
zero_size = 0.5, zero_split = FALSE, zero_shade = NULL,
zero_gp = gpar(col = 0), panel = NULL, main = NULL, sub = NULL, ...)

## S3 method for class 'formula'
mosaic(formula, data, highlighting = NULL,
..., main = NULL, sub = NULL, subset = NULL, na.action = NULL)

e.g. mosaic(Freq~Var3+Var2 | Var1, data=y, shade=T, zero_size=0, zero_shade=T, legend=T, labeling_args=list(set_varnames=c(Var1='Gruppe',Var2='aktiv', Var3='Gespräche'),set_labels=list(Var3=c('nein', 'ja'), Var1=c('WKG','IVG','keine')), rep=T))

An easy way to make a treemap

No comments :

Post a Comment