~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/plugins/plots/histogram.php

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2008-04-20 21:30:00 UTC
  • mfrom: (1.2.2 upstream) (3.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080420213000-fs4i8efmfc793bnn
new upstream release
closes: #475175
closes: #463348
closes: #475982

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?
2
 
        function preprocess () {
3
 
        }
4
 
        
5
 
        function calculate () {
6
 
        }
7
 
        
8
 
        function printout () {
9
 
        $breaks = getRK_val ("breaks");
10
 
        $scale = getRK_val ("scale");
 
2
function preprocess () {
 
3
}
 
4
 
 
5
function calculate () {
 
6
}
 
7
 
 
8
function printout () {
 
9
        doPrintout (true);
 
10
}
 
11
 
 
12
function preview () {
 
13
        preprocess ();
 
14
        calculate ();
 
15
        doPrintout (false);     // only this one actually needed...
 
16
}
 
17
 
 
18
// internal helper functions
 
19
function doPrintout ($final) {
 
20
        $densityscaled = getRK_val ("densityscaled");
 
21
        $bw =  getRK_val ("bw");
 
22
        $adjust = getRK_val ("adjust");
 
23
        $narm = getRK_val ("narm");
 
24
        $n = getRK_val ("n"); //calls "resolution"
11
25
        $x = getRK_val ("x");
12
 
        if ($breaks == "int") {
13
 
                $breaksopt = "breaks=seq (as.integer (min (" . $x . "))-0.5, as.integer (max (" . $x ."))+0.5)";
14
 
                $breaks = "Integers";
15
 
        } else if (!empty ($breaks)) {
16
 
                $breaksopt = "breaks=\"" . $breaks . "\"";
17
 
        }
18
 
?>
19
 
rk.header ("Histogram", list ("Frequency", "<? echo $scale; ?>", "Breaks algorithm", <? echo ("\"" . $breaks . "\""); ?>, "Variable", rk.get.description (<? echo ($x); ?>)))
 
26
        $plot_adds = getRK_val ("plotoptions.code.calculate");
 
27
 
 
28
 
 
29
        if ($final) { ?>
 
30
rk.header ("Histogram", list ("Variable", rk.get.description (<? echo ($x); ?>) <? if (($densityscaled) && getRK_val ("density")) { ?>, "Density bandwidth", "<? echo ($bw); ?>", "Density adjust", <? echo ($adjust); ?>, "Density resolution", <? echo ($n); ?>, "Density Remove missing values", <? echo ($narm); ?> <? } ?> <? getRK ("histogram_opt.code.preprocess"); ?>))
 
31
 
20
32
rk.graph.on ()
21
 
hist (<? echo ($x); ?>, <? echo ($breaksopt); ?>, freq = <? echo $scale; ?><? getRK ("plotoptions.code.printout"); ?>)
 
33
<?      }
 
34
?>
 
35
try ({
 
36
        hist (<? echo ($x); getRK ("histogram_opt.code.calculate"); getRK ("histogram_opt.code.printout"); getRK ("plotoptions.code.printout"); ?>)
 
37
<?      if (($densityscaled) && getRK_val ("density")) { ?>
 
38
        lines(density(<? echo ($x); ?>, bw="<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($narm); ?>, n = <? getRK ("n"); ?>)<? getRK ("col_density.code.printout"); ?>)
 
39
<?      } ?>
 
40
<?      if (!empty ($plot_adds)) { ?>
 
41
 
 
42
<?              // print the grid() related code
 
43
                printIndented ("\t", $plot_adds);
 
44
        }
 
45
?>
 
46
})
 
47
<?      if ($final) { ?>
22
48
rk.graph.off ()
23
 
<?
24
 
        }
25
 
        
26
 
        function cleanup () {
27
 
        }
 
49
<?      }
 
50
}
 
51
 
28
52
?>