Loon: An Interactive Statistical Visualization Toolkit


All of loon's displays have plot states. Plot states specify what is displayed, how it is displayed and if and how the plot is linked with other loon plots. loon's plot states are derived from Tk's configurable options. A large part of loon's framework revolves around modifying states, tracking state changes and the synchronization of plot states between plots.

For example, the plot states of the scatterplot display include x, y, color, size, selected, xlabel, ylabel, zoomX, zoomY, panX, panY, showScales and showGuides. The scatterplot display has more than 30 states.

To get a complete list of the plot states for a particular loon widget use the l_info_states function

p <- l_plot(iris[,1:2])

istates <- l_info_states(p)
# or together as

l_info_states(p, 'x')
# or

l_info_states(p, c('x', 'y', 'xTemp'))

When possible then the data structure for each state is either a scalar or a flat vector. One exception is the data state which contains a data.frame.

Query and Modify

To query a state, say showScales, of the plot p use either the accessor method [ or the l_cget function

l_cget(p, 'showScales')

To modify a single state, say showLabels, use one of

p['showLabels'] <- FALSE
l_configure(p, showLabels=FALSE)

to modify multiple states, say showLabels and showScales, use

l_configure(p, showScales=FALSE, showLabels=FALSE)

Note that you should never use the tkconfigure function (defined in the tcltk package) instead of the l_configure function! One reason is that the l_configure function is customized for loon plots and takes care of some R to Tcl data structure conversions that are otherwise not supported (e.g. data.frame and nested lists).

State Dimension

The dimension of a state is either explicit, i.e. a number, or abstract, i.e. a letter.