Skip to content

Commit

Permalink
re-roxygenize
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Jun 29, 2012
1 parent ce56da6 commit 1cec789
Show file tree
Hide file tree
Showing 42 changed files with 341 additions and 406 deletions.
49 changes: 24 additions & 25 deletions NAMESPACE
@@ -1,25 +1,18 @@
export(axis_loc)
export("border_pal<-")
export("border_title<-")
export("border_var<-")
export("brush<-")
export("color_pal<-")
export("color_title<-")
export("color_var<-")
export("link_type<-")
export("link_var<-")
export("selected<-")
export("size_pal<-")
export("size_title<-")
export("size_var<-")
export("visible<-")
export(Common.meta)
export(axis_loc)
export(break_str)
export("brush<-")
export(brush)
export(cart_polygon)
export(check_data)
export("color_pal<-")
export("color_title<-")
export("color_var<-")
export(common_key_press)
export(common_key_release)
export(Common.meta)
export(common_mouse_move)
export(common_mouse_press)
export(common_mouse_release)
Expand All @@ -28,12 +21,13 @@ export(draw_identify)
export(extend_ranges)
export(fix_dimension)
export(identify_rect)
export(last_data)
export(lighter)
export(link_cat)
export(link_id)
export(link_knn)
export("link_type<-")
export(link_type)
export("link_var<-")
export(link_var)
export(manual_brush)
export(map_qdata)
Expand Down Expand Up @@ -67,32 +61,29 @@ export(record_selector)
export(remove_link)
export(reorder_var)
export(save_brush_history)
export("selected<-")
export(selected)
export(set_cursor)
export("size_pal<-")
export("size_title<-")
export("size_var<-")
export(switch_value)
export(sync_limits)
export(time_qdata)
export(update_brush_size)
export(var_names)
export(var_names.character)
export(var_names.default)
export(var_names.formula)
export(var_names.numeric)
export("visible<-")
export(visible)
import(objectProperties)
import(objectSignals)
import(plumbr)
import(qtpaint)
importFrom(SearchTrees,createTree)
importFrom(SearchTrees,rectLookup)
importFrom(methods,setRefClass)
importFrom(qtbase,Qt)
importFrom(qtbase,qconnect)
importFrom(qtbase,qdataFrameModel)
importFrom(qtbase,qfont)
importFrom(qtbase,qrect)
importFrom(qtbase,qsize)
importFrom(qtbase,Qt)
importFrom(qtbase,qtimer)
importFrom(SearchTrees,createTree)
importFrom(SearchTrees,rectLookup)
importFrom(tourr,basis_init)
importFrom(tourr,basis_random)
importFrom(tourr,cmass)
Expand All @@ -116,3 +107,11 @@ importFrom(tourr,paths_index)
importFrom(tourr,pda_pp)
importFrom(tourr,planned_tour)
importFrom(tourr,save_history)
import(objectProperties)
import(objectSignals)
import(plumbr)
import(qtpaint)
S3method(var_names,character)
S3method(var_names,default)
S3method(var_names,formula)
S3method(var_names,numeric)
78 changes: 54 additions & 24 deletions man/Common.meta.Rd
Expand Up @@ -2,9 +2,11 @@
\name{Common.meta}
\alias{Common.meta}
\title{Common meta data structure in cranvas}
\format{List of 21
\format{List of 24
$ alpha : chr "numeric"
$ main : chr "character"
$ xlim : chr "numeric"
$ ylim : chr "numeric"
$ xat : chr "numeric"
$ yat : chr "numeric"
$ xlab : chr "character"
Expand All @@ -20,6 +22,7 @@
$ active : chr "logical"
$ brush.move : chr "logical"
$ brush.size : chr "numeric"
$ brush.adj : chr "numeric"
$ manual.brush : chr "function"
$ minor : chr "character"
$ identified : chr "integer"
Expand Down Expand Up @@ -57,30 +60,58 @@ Common.meta
The common meta structure contains the following
components:

\describe{\item{alpha}{the alpha transparency}
\item{main}{the main title} \item{xat, yat}{the tickmarks
locations on the x and y axis} \item{xlat, ylab}{x and y
axis titles} \item{xlabels, ylabels}{the tickmarks
labels} \item{minor}{possible values are \code{''},
\code{'x'}, \code{'y'} and 'xy', indicating which axis to
draw minor grid lines} \item{limits}{the limits of the
main plot layer (it is often the case that some other
layers need to sync with the main plot layer in limits,
so this component is very important)} \item{color,
border, size}{the real color, border and size vectors
used to draw the graphical elements, which can be
different from the corresponding columns in the original
data} \item{start, pos}{the starting position and the
current position of the cursor}
\describe{

\item{alpha}{the alpha transparency}

\item{main}{the main title}

\item{xlim, ylim}{the real x- and y-axis limits
calculated from original data}

\item{xat, yat}{the tickmarks locations on the x and y
axis}

\item{xlat, ylab}{x and y axis titles}

\item{xlabels, ylabels}{the tickmarks labels}

\item{minor}{possible values are \code{''}, \code{'x'},
\code{'y'} and \code{'xy'}, indicating which axis to draw
minor grid lines}

\item{limits}{the limits of the main plot layer (it is
often the case that some other layers need to sync with
the main plot layer in limits, so this component is very
important)}

\item{color, border, size}{the real color, border and
size vectors used to draw the graphical elements, which
can be different from the corresponding columns in the
original data}

\item{start, pos}{the starting position and the current
position of the cursor}

\item{brush.move}{indicating if the brush is in the move
mode (if not, the brush will be resized when mouse moves}

\item{brush.size}{the size of the brush rectangle (a
numeric vector of length 2)} \item{manual.brush}{a
function to manually brush the plot given the mouse
position} \item{identified, identify.labels}{the
identified indices and the text label to draw in the plot
for the identified cases} \item{active}{logical: if the
current plot window is active}}
numeric vector of length 2)}

\item{brush.adj}{the amount of x and y adjustment for the
brush rectangle to capture a graphical element without
having to cover its center}

\item{manual.brush}{a function to manually brush the plot
given the mouse position}

\item{identified, identify.labels}{the identified indices
and the text label to draw in the plot for the identified
cases}

\item{active}{logical: if the current plot window is
active}}
}
\examples{
library(objectSignals)
Expand All @@ -97,8 +128,7 @@ meta2$xat <- 2:6
meta$xat # meta is changed too

meta$posChanged$connect(function() {
message("the mouse position is (", paste(meta$pos, collapse = ","),
") now")
message("the mouse position is (", paste(meta$pos, collapse = ","), ") now")
})
meta$pos <- c(2, 0)

Expand Down
3 changes: 0 additions & 3 deletions man/ameshousing.Rd
Expand Up @@ -6,9 +6,6 @@
\source{
\url{http://www.cityofames.org/Assessor/index.htm}
}
\usage{
data(ameshousing)
}
\description{
This data contains statistics for the housing market in
Ames, Iowa from January 2008 to September 2012
Expand Down
3 changes: 1 addition & 2 deletions man/break_str.Rd
Expand Up @@ -24,8 +24,7 @@ break_str(x, split = "[^[:alnum:]]", ...)
plots.
}
\examples{
break_str(c("long label1.1", "long label1.2", "long label1.3"),
split = " ")
break_str(c("long label1.1", "long label1.2", "long label1.3"), split = " ")
break_str(names(iris))
}
\author{
Expand Down
3 changes: 0 additions & 3 deletions man/brfss.Rd
Expand Up @@ -6,9 +6,6 @@
\source{
\url{http://www.cdc.gov/BRFSS/}
}
\usage{
data(brfss)
}
\description{
Part of the largest, on-going telephone health survey
system, tracking health conditions and risk behaviors in
Expand Down
83 changes: 51 additions & 32 deletions man/brush.Rd
Expand Up @@ -12,7 +12,7 @@ brush(data, attr) <- value
with an attribute \code{Brush}}

\item{attr}{the name of the brush attribute (a character
scalar), e.g. \code{style} (the color, linewidth and
scalar), e.g. \code{style} (the color, linewidth and
linetype of the brush), \code{color} (the color of the
objects selected by the brush), \code{size} (the size of
the selected objects, e.g. line width or size of points);
Expand All @@ -37,43 +37,65 @@ brush(data, attr) <- value
The list of attributes in the brush (they can be accessed
by the \code{$} method):

\describe{\item{style}{a list containing \code{color},
\describe{

\item{style}{a list containing \code{color},
\code{linewidth} and \code{linetype} defining the style
of the brush (rectangle) -- not to be confused with the
color of the brushed elements} \item{color, size}{the
color and size of the brushed elements} \item{mode}{the
brush mode: can be \code{'none'} (default), \code{'and'},
\code{'or'}, \code{'xor'}, \code{'not'} or
\code{'complement'}; see \code{\link{mode_selection}} for
details} \item{identify}{logical: \code{TRUE} (turn on
the identify mode) or \code{FALSE} (the brush mode)}
color of the brushed elements}

\item{color, size}{the color and size of the brushed
elements}

\item{mode}{the brush mode: can be \code{'none'}
(default), \code{'and'}, \code{'or'}, \code{'xor'},
\code{'not'} or \code{'complement'}; see
\code{\link{mode_selection}} for details}

\item{identify}{logical: \code{TRUE} (turn on the
identify mode) or \code{FALSE} (the brush mode)}

\item{label.gen}{a function to be used to generate the
labels (based on the identified data) to show in the
identify mode; the default function just prints the
identified data as a character string}

\item{label.color}{the color for the label in the
identify mode} \item{history.size}{the size of brush
history, i.e. how many brushing operations to be
recorded; default to be 30} \item{history.list}{the list
of indices of the brushed elements; we can go back and
forth in the brush history according to this list}
identify mode}

\item{history.size}{the size of brush history, i.e. how
many brushing operations to be recorded; default to be
30}

\item{history.list}{the list of indices of the brushed
elements; we can go back and forth in the brush history
according to this list}

\item{history.index}{the current index of the brush
history} \item{persistent}{persistent (\code{TRUE}) or
transient (\code{FALSE}) brushing; in the persistent
brushing mode, the attributes of the brushed elements
will be changed permanently} \item{persistent.color}{a
color vector to store the colors of persistently brushed
elements} \item{persistent.list}{the persistent brushing
history (a list of indices of the brushed elements)}
history}

\item{persistent}{persistent (\code{TRUE}) or transient
(\code{FALSE}) brushing; in the persistent brushing mode,
the attributes of the brushed elements will be changed
permanently}

\item{persistent.color}{a color vector to store the
colors of persistently brushed elements}

\item{persistent.list}{the persistent brushing history (a
list of indices of the brushed elements)}

\item{select.only}{is the mouse used to brush graphical
elements ((\code{FALSE})) or select elements only
(\code{TRUE}); the subtle difference here is whether the
brush should stay on the plot or not when the mouse is
released} \item{draw.brush}{whether to draw the brush
(when the mouse is released and \code{select.only} is
\code{TRUE}, then \code{draw.brush} will be \code{FALSE}
so the brush will go away)} \item{cursor}{the cursor type
(an integer; see \code{\link{set_cursor}})}}
released}

\item{draw.brush}{whether to draw the brush (when the
mouse is released and \code{select.only} is \code{TRUE},
then \code{draw.brush} will be \code{FALSE} so the brush
will go away)} \item{cursor}{the cursor type (an integer;
see \code{\link{set_cursor}})}}
}
\examples{
library(cranvas)
Expand All @@ -85,11 +107,9 @@ brush(qiris, "color") <- "green" # set brush color to green
## attach events on the brush
b <- brush(qiris)

# idx is the index of the event; it can be used to stop the
# listening
# idx is the index of the event; it can be used to stop the listening
idx <- b$colorChanged$connect(function() {
message("the color of brushed elements was changed to ",
b$color)
message("the color of brushed elements was changed to ", b$color)
})
b$color <- "brown"
b$color <- "gold"
Expand All @@ -110,8 +130,7 @@ b$identify <- FALSE # turn off; i.e. in brushing mode now

b$persistent <- TRUE # turn on persistent brushing

## redefine label generating function: show row names in
# the identify mode
## redefine label generating function: show row names in the identify mode
b$label.gen <- function(x) {
paste(rownames(x), collapse = ", ")
}
Expand Down
9 changes: 4 additions & 5 deletions man/cart_polygon.Rd
Expand Up @@ -2,7 +2,8 @@
\alias{cart_polygon}
\title{Calculate coordinates of transformed polygons to make cartograms}
\usage{
cart_polygon(x, y, size, nrow = 100, ncol = 100, ...)
cart_polygon(x, y, name, size, diffuse, nrow = 100, ncol = 100, blank.init = 0.8,
...)
}
\arguments{
\item{x,y}{the x and y coordinates of original polygons
Expand Down Expand Up @@ -32,13 +33,11 @@ cart_polygon(x, y, size, nrow = 100, ncol = 100, ...)
\examples{
library(cranvas)

## a simple example: two polygons of size 1 and 5
# respectively
## a simple example: two polygons of size 1 and 5 respectively
theta <- seq(0, 2 * pi, length = 100)
x <- c(cos(theta), NA, cos(theta) + 2)
y <- c(sin(theta), NA, sin(theta) + 1)
plot(x, y, type = "n", xlim = c(-2, 5), ylim = c(-2,
3))
plot(x, y, type = "n", xlim = c(-2, 5), ylim = c(-2, 3))
polygon(x, y)
text(c(0, 2), c(0, 1), c(1, 5)) # original polygons

Expand Down

0 comments on commit 1cec789

Please sign in to comment.