[rkward-cvs] SF.net SVN: rkward: [1080] trunk/rkward/rkward/plugins/plots/density_plot. php

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jan 7 17:08:40 UTC 2007


Revision: 1080
          http://svn.sourceforge.net/rkward/?rev=1080&view=rev
Author:   tfry
Date:     2007-01-07 09:08:40 -0800 (Sun, 07 Jan 2007)

Log Message:
-----------
Plugin coding style

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/density_plot.php

Modified: trunk/rkward/rkward/plugins/plots/density_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/density_plot.php	2007-01-07 16:51:14 UTC (rev 1079)
+++ trunk/rkward/rkward/plugins/plots/density_plot.php	2007-01-07 17:08:40 UTC (rev 1080)
@@ -3,15 +3,6 @@
 	}
 	
 	function calculate () {
-?>	
-	length.temp <- length (<? getRK ("x"); ?>);
-	kern <- c("<? getRK ("kern"); ?>");
-	bw <- c("<? getRK ("bw"); ?>");
-	dohdrcde_plot <- <? getRK ("dohdrcde_plot"); ?>;
-	dodensity_plot <- <? getRK ("dodensity_plot"); ?>;
-	dorug_density <- <? getRK ("rug_density"); ?>;
-	dorug_hdrcde <- <? getRK ("rug_hdrcde"); ?>;
-<?
 	}
 	
 	function printout () {
@@ -20,34 +11,45 @@
 	$bw = getRK_val ("bw");
 	$x = getRK_val ("x");
 	$narm = getRK_val ("narm");
-	$kern = getRK_val ("kern");
-?>
+	$kern = "c(\"" . getRK_val ("kern") . "\")";
+	$dodensity_plot = getRK_val ("dodensity_plot");
+	$dohdrcde_plot = getRK_val ("dohdrcde_plot");
+	$dorug_density = getRK_val ("rug_density");
+	$dorug_hdrcde = getRK_val ("rug_hdrcde");
 
-if (dodensity_plot) rk.header ("Density Plot", list ("Variable", rk.get.description (<? echo ($x); ?>), "Band Width", bw, "Estimate Density", <? echo ($giveRkern) ?>, "Adjust", <? echo ($adjust) ?>, "Remove Missing Values", <? echo ($narm) ?>, "Length", length.temp, "n", <? getRK ("n"); ?>, "Smoothing Kernel", kern))
+	if ($dodensity_plot) { ?>
+rk.header ("Density Plot", list ("Variable", rk.get.description (<? echo ($x); ?>), "Band Width", c("<? getRK ("bw"); ?>"), "Estimate Density", <? echo ($giveRkern) ?>, "Adjust", <? echo ($adjust) ?>, "Remove Missing Values", <? echo ($narm) ?>, "Length", length (<? echo ($x); ?>), "n", <? getRK ("n"); ?>, "Smoothing Kernel", <? echo ($kern); ?>))
+<?	}
+	if ($dohdrcde_plot) { ?>
+rk.header ("Highest density regions", list ("Variable", rk.get.description (<? echo ($x); ?>)))
+<?	} ?>	
 
-if (dohdrcde_plot) rk.header ("Highest density regions", list ("Variable", rk.get.description (<? echo ($x); ?>)))
-
 rk.graph.on ()
 
-if ((dohdrcde_plot) && (dodensity_plot)) par(mfrow=c(1,2))
+<?	if ($dohdrcde_plot && $dodensity_plot) { ?>
+par(mfrow=c(1,2))
+<?	} ?>
 
-if (dodensity_plot) plot (density(<? echo ($x); ?>, bw = "<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, kern = c("<? echo ($kern) ?>"), n = <? getRK ("n"); ?>, <? echo ($narm); ?> <? getRK ("plotoptions.code.printout"); ?>))
-if (dorug_density) rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
-if (dohdrcde_plot) require(hdrcde)
-if (dohdrcde_plot) hdr.den(<? echo ($x); ?> <? getRK ("plotoptions.code.printout"); ?>)
-if (dorug_hdrcde) rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+<?	if ($dodensity_plot) { ?>
+plot (density(<? echo ($x); ?>, bw = "<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, kern = <? echo ($kern); ?>, n = <? getRK ("n"); ?>, <? echo ($narm); ?><? getRK ("plotoptions.code.printout"); ?>))
+<?	} ?>
+
+<?	if ($dorug_density) { ?>
+rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+<?	}
+
+	if ($dohdrcde_plot) { ?>
+require(hdrcde)
+hdr.den(<? echo ($x); ?><? getRK ("plotoptions.code.printout"); ?>)
+<?	}
+	if ($dorug_hdrcde) { ?>
+rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+	<? } ?>
+
 rk.graph.off ()
 <?
 	}
 	
 	function cleanup () {
-?>	rm (length.temp)
-	rm (kern)
-	rm (bw)
-	rm (dohdrcde_plot)
-	rm (dodensity_plot)
-	rm (dorug_hdrcde)
-	rm (dorug_density)
-<?
 	}
 ?>


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