Learn R Programming

ggplot2 (version 0.9.0)

ggfluctuation: Create a fluctuation plot.

Description

A fluctutation diagram is a graphical representation of a contingency table. This function only supports 2D contingency tables at present but extension to higher dimensions should be relatively straightforward.

Usage

ggfluctuation(table, type = "size", floor = 0,
    ceiling = max(table$freq, na.rm = TRUE))

Arguments

table
a table of values, or a data frame with three columns, the last column being frequency
type
"size", or "colour" to create traditional heatmap
floor
don't display cells smaller than this value
ceiling
round cells to at most this value
na.rm
If TRUE, silently remove missing values.

Details

With the default size fluctuation diagram, area is proportional to the count (length of sides proportional to sqrt(count)).

Examples

Run this code
ggfluctuation(table(movies$Action, movies$Comedy))
ggfluctuation(table(movies$Action, movies$mpaa))
ggfluctuation(table(movies$Action, movies$Comedy), type="colour")
ggfluctuation(table(warpbreaks$breaks, warpbreaks$tension))

Run the code above in your browser using DataLab