[rkward-cvs] SF.net SVN: rkward: [1647] trunk/rkward/rkward/plugins/plots/barplot.php
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Mar 19 22:44:55 UTC 2007
Revision: 1647
http://svn.sourceforge.net/rkward/?rev=1647&view=rev
Author: tfry
Date: 2007-03-19 15:44:54 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
local() adjustments and indentation issues
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/barplot.php
Modified: trunk/rkward/rkward/plugins/plots/barplot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.php 2007-03-19 22:39:43 UTC (rev 1646)
+++ trunk/rkward/rkward/plugins/plots/barplot.php 2007-03-19 22:44:54 UTC (rev 1647)
@@ -1,7 +1,7 @@
<?
function preprocess () {
}
-
+
function calculate () {
}
@@ -9,32 +9,26 @@
doPrintout (true);
}
-function cleanup () { ?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
-<?
-}
-
function preview () {
preprocess ();
calculate ();
doPrintout (false);
- cleanup ();
}
function doPrintout ($final) {
- $vars = getRK_val ("x") ;
+ $var = getRK_val ("x") ;
$labels = getRK_val ("labels")=="TRUE";
$tabulate= getRK_val ("tabulate")=="TRUE";
?>
-rk.temp.x <- (<? echo ($vars); ?>)
-<?
-if($tabulate) {?>
- rk.temp.x <- table(rk.temp.x, exclude=NULL)
+x <- <? echo ($var); ?>
+<?
+ if($tabulate) { ?>
+x <- table(x, exclude=NULL)
<? } else { ?>
- # barplot is a bit picky about attributes, so we need to convert to vector explicitely
- if(!is.matrix(rk.temp.x)) rk.temp.x <- as.vector(rk.temp.x)
-<? }
+# barplot is a bit picky about attributes, so we need to convert to vector explicitely
+if(!is.matrix(x)) x <- as.vector(x)
+<? }
if ($final) { ?>
rk.header ("Barplot", parameters=list ("Rainbow colors", "<? getRK ("rainbow"); ?>", "Beside", "<? getRK ("beside"); ?>", "Legend", "<? getRK ("legend"); ?>"))
@@ -45,17 +39,17 @@
try ({
<? if (getRK_val ("beside") == "TRUE") { ?>
<? if ($labels) { ?>
-# adjust the range so that the labels will fit
-rk.temp.range <- range (rk.temp.x, na.rm=TRUE) * 1.2
-if (rk.temp.range[1] > 0) rk.temp.range[1] <- 0
-if (rk.temp.range[2] < 0) rk.temp.range[2] <- 0
+ # adjust the range so that the labels will fit
+ yrange <- range (x, na.rm=TRUE) * 1.2
+ if (yrange[1] > 0) yrange[1] <- 0
+ if (yrange[2] < 0) yrange[2] <- 0
<? } ?>
-rk.temp.barplot <- barplot((rk.temp.x)<? if (getRK_val ("rainbow")=="TRUE") { ?>, col=rainbow( if(is.matrix(rk.temp.x)) dim(rk.temp.x) else length(rk.temp.x)) <? } ?>, beside=<? getRK ("beside"); ?>, legend.text=<? getRK ("legend"); ?><? if ($labels) echo (", ylim = rk.temp.range"); ?>)
+ bplot <- barplot(x<? if (getRK_val ("rainbow")=="TRUE") { ?>, col=rainbow( if(is.matrix(x)) dim(x) else length(x))<? } ?>, beside=<? getRK ("beside"); ?>, legend.text=<? getRK ("legend"); ?><? if ($labels) echo (", ylim = yrange"); ?>)
<? if ($labels) { ?>
-text(rk.temp.barplot, rk.temp.x, labels=rk.temp.x, pos=<? getRK ("place"); ?>, offset=.5)
+ text(bplot, x, labels=x, pos=<? getRK ("place"); ?>, offset=.5)
<? }
} else { ?>
-barplot((rk.temp.x)<? if (getRK_val ("rainbow")=="TRUE") { ?>, col=rainbow( if(is.matrix(rk.temp.x)) dim(rk.temp.x) else length(rk.temp.x)) <? } ?>, legend.text=<? getRK ("legend"); ?>)
+ barplot(x<? if (getRK_val ("rainbow")=="TRUE") { ?>, col=rainbow( if(is.matrix(x)) dim(x) else length(x))<? } ?>, legend.text=<? getRK ("legend"); ?>)
<? }
?>
})
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list