-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTODO
105 lines (79 loc) · 3 KB
/
TODO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
* Bouts
** TODO Work on MLE (or better) method for modelling mixtures of 3 Poisson
processes
* Plotting
** DONE Colors should be constant in plotTDR()
CLOSED: [2016-03-03 Thu 22:17]
Each color should always represent one type of behaviour, regardless of the
number of behaviours shown in each plot. Whenever panning or zooming, the
number of behaviours shown may be different, so the colors chosen for each
behaviour also change. This is wrong and confusing to users.
** TODO Embed R graphics in a single widget for plotTDR()
*** Using RGtk2
From the Lawrence and Temple (2010) JSS paper:
#+BEGIN_SRC R
library(RGtk2)
n <- 5000; backbone <- rnorm(n)
ma_data <- cbind(backbone + c(rnorm(3 * (n / 4), sd=0.1),
rt(n / 4, 80)),
backbone + c(rnorm(3 * (n / 4), sd=0.1),
rt(n / 4, 80)))
ma_data <- apply(ma_data, 2, function(col) col - min(col))
win <- gtkWindow(show=FALSE)
graphics <- gtkDrawingArea()
slider <- gtkHScale(min=0.1, max=1.0, step=0.1)
scale_cb <- function(range) {
par(pty="s")
plot(ma_data[, 1], ma_data[, 2],
col=rgb(0, 0, 0, alpha=range$getValue()),
xlab="Replicate 1", ylab="Replicate 2",
main="Mock expression data", pch=19)
}
gSignalConnect(slider, "value-changed", scale_cb)
vbox <- gtkVBox()
vbox$packStart(graphics, expand=TRUE, fill=TRUE, padding=0)
vbox$packStart(slider, expand=TRUE, fill=TRUE, padding=0)
win$add(vbox)
win$setDefaultSize(400, 400)
win$showAll()
require(cairoDevice)
asCairoDevice(graphics)
slider$setValue(0.7)
#+END_SRC
*** Using playwith
Felix Andrews demonstrated a bit:
#+BEGIN_SRC R
library(playwith)
library(diveMove)
## A tool to select a range and store it in a global var.
## This "callback" is run when the action is activated
## (from toolbar, menu, or keyboard shortcut).
findRange_handler <- function(widget, playState) {
## draw rect at drag locations
rgInfo <- playRectInput(playState)
if (is.null(rgInfo)) return()
if (isTRUE(rgInfo$is.click)) return()
## store range
assign("RANGE", rgInfo$coords, globalenv())
## annotation call to draw a rect
rectExpr <- with(rgInfo$coords,
call("panel.rect",
x[1], y[1], x[2], y[2]))
playAnnotate(playState, rectExpr, space=rgInfo$space)
gmessage("Selected range has been stored in object RANGE.")
}
findRangeTool <- list("FindRange", "gtk-zoom-fit", "Find range",
callback=findRange_handler)
utils::example("calibrateDepth", package="diveMove",
ask=FALSE, echo=FALSE)
playwith(plotTDR(getTime(divesTDR), getDepth(divesTDR), interact=FALSE),
tools=list(findRangeTool))
#+END_SRC
** DONE Include a control for zoom level in plotTDR()
CLOSED: [2016-03-03 Thu 22:18]
* Emacs local variables
#+STARTUP: content
#+PROPERTY: results silent
# Local Variables:
# mode: org
# End: