-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawStats.R
67 lines (59 loc) · 2.56 KB
/
drawStats.R
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
drawStats <- function(stats, xmin, xmax, ymin, ymax, xTransition, xLinLogRatio, yTransition, yLinLogRatio)
{
statsColor = 'blue'
annotationsize = 1
n <- 0 # number of decimals to show FOR AVERAGES
n2 <- 2 # number of decimals to show FOR PERCENTS
# format(round(x, n), nsmall = n)
xmin = logicle(xmin, xTransition, xLinLogRatio)# * 5;
ymin = logicle(ymin, yTransition, yLinLogRatio)# * 1.5;
xmax = logicle(xmax, xTransition, xLinLogRatio)# * 0.2;
ymax = logicle(ymax, yTransition, yLinLogRatio)# * 0.66;
plusplus = NULL
minusminus = NULL
plusminus = NULL
minusplus = NULL
mean = stats$'XY meanX ++'
if(is.null(mean) || is.nan(mean))
{
plusplus = '';
}
else
{
plusplus = paste('avg=(', format(round(mean, n), nsmall = n), ',', format(round(stats$'XY meanY ++', n), nsmall = n), ')', sep='')
}
mean = stats$'XY meanX --'
if(is.null(mean) || is.nan(mean))
{
minusminus = '';
}
else
{
minusminus = paste('avg=(', format(round(mean, n), nsmall = n), ',', format(round(stats$'XY meanY --', n), nsmall = n), ')', sep='')
}
mean = stats$'XY meanX +-'
if(is.null(mean) || is.nan(mean))
{
plusminus = '';
}
else
{
plusminus = paste('avg=(', format(round(mean, n), nsmall = n), ',', format(round(stats$'XY meanY +-', n), nsmall = n), ')', sep='')
}
mean = stats$'XY meanX -+'
if(is.null(mean) || is.nan(mean))
{
minusplus = '';
}
else
{
minusplus = paste('avg=(', format(round(mean, n), nsmall = n), ',', format(round(stats$'XY meanY -+', n), nsmall = n), ')', sep='')
}
text(xmax, ymax, paste(plusplus, '\n[+,+] ', format(round(stats$"XY % ++", n2), nsmall = n2), '%', sep=''), col = 'goldenrod3', cex = annotationsize, adj = c(1,1))
text(xmin, ymin, paste(minusminus, '\n[-,-] ', format(round(stats$"XY % --", n2), nsmall = n2), '%', sep=''), col = 'black', cex = annotationsize, adj = c(0,0))
text(xmax, ymin, paste(plusminus, '\n[+,-] ', format(round(stats$"XY % +-", n2), nsmall = n2), '%', sep=''), col = 'darkgreen', cex = annotationsize, adj = c(1,0))
text(xmin, ymax, paste(minusplus, '\n[-,+] ', format(round(stats$"XY % -+", n2), nsmall = n2), '%', sep=''), col = 'darkred', cex = annotationsize, adj = c(0,1))
# Draw the population mean, blue cross-hair
print(paste('Hello There:', stats$'meanX', ':', stats$'meanY'))
points(logicle(stats$'meanX',xTransition,xLinLogRatio), logicle(stats$'meanY',yTransition,yLinLogRatio), col='gray70', pch=10, cex=3, lwd=4)
}