~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to tests/plots/RKTestStandard.scatterplot.rkcommands.R

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2009-10-26 14:30:00 UTC
  • mfrom: (1.1.13 upstream) (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091026143000-wzwt6cryjnwce23k
Tags: 0.5.2-1
* new upstream release
  closes: #551306 (added support for the new dynamic help system)
* Add "DM-Upload-Allowed: yes" in control
* bump standards version to 3.8.3 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
local({
 
2
## Prepare
 
3
## Compute
 
4
 
 
5
Xvars <- list(women[["weight"]],swiss[["Education"]])
 
6
Yvars <- list(women[["height"]],swiss[["Catholic"]])
 
7
 
 
8
if (length(Xvars) != length(Yvars)) {
 
9
        stop("Unequal number of X and Y variables given")
 
10
}
 
11
 
 
12
# find range of X/Y values needed
 
13
Xrange <- range (c (Xvars), na.rm=TRUE)
 
14
Yrange <- range (c (Yvars), na.rm=TRUE)
 
15
 
 
16
type <- rep (c ('p'), length.out=length (Xvars));
 
17
col <- rep (c ('black', 'red'), length.out=length (Xvars));
 
18
cex <- rep (1, length.out=length (Xvars));
 
19
pch <- rep (1, length.out=length (Xvars));
 
20
## Print result
 
21
rk.header ("Scatterplot", parameters = list (
 
22
        "X variables"=paste (rk.get.description (women[["weight"]],swiss[["Education"]]), collapse=", "),
 
23
        "Y variables"=paste (rk.get.description (women[["height"]],swiss[["Catholic"]]), collapse=", ")))
 
24
 
 
25
rk.graph.on()
 
26
 
 
27
try ({
 
28
        # make frame and axes
 
29
        plot(Xrange, Yrange, type="n")
 
30
        
 
31
        # plot variables one X/Y pair at a time
 
32
        for (i in 1:length(Xvars)) {
 
33
                points (
 
34
                        Xvars[[i]],
 
35
                        Yvars[[i]],
 
36
                        type = type[[i]],
 
37
                        col = col[[i]],
 
38
                        cex = cex[[i]],
 
39
                        pch = pch[[i]]
 
40
                )
 
41
        }
 
42
})
 
43
 
 
44
rk.graph.off()
 
45
})
 
46
.rk.rerun.plugin.link(plugin="rkward::scatterplot", settings="cex.text=1\ncol.text=c ('black', 'red')\ncolor.string=each\nisCex.string=all\nisPch.string=all\npch.text=1\nplotoptions.add_grid.state=0\nplotoptions.asp.real=0.00\nplotoptions.main.text=\nplotoptions.pointcolor.color.string=\nplotoptions.pointtype.string=\nplotoptions.sub.text=\nplotoptions.xaxt.state=\nplotoptions.xlab.text=\nplotoptions.xlog.state=\nplotoptions.xmaxvalue.text=\nplotoptions.xminvalue.text=\nplotoptions.yaxt.state=\nplotoptions.ylab.text=\nplotoptions.ylog.state=\nplotoptions.ymaxvalue.text=\nplotoptions.yminvalue.text=\npointtype.string=p\ntype_mode.string=all\nx.available=women[[\\\"weight\\\"]]\\nswiss[[\\\"Education\\\"]]\ny.available=women[[\\\"height\\\"]]\\nswiss[[\\\"Catholic\\\"]]", label="Run again")
 
47
.rk.make.hr()