[rkward-cvs] SF.net SVN: rkward: [1081] trunk/rkward/rkward/plugins/plots

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jan 7 17:42:53 UTC 2007


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

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

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/ecdf_plot.php
    trunk/rkward/rkward/plugins/plots/histogram.php
    trunk/rkward/rkward/plugins/plots/histogram.xml

Modified: trunk/rkward/rkward/plugins/plots/ecdf_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/ecdf_plot.php	2007-01-07 17:08:40 UTC (rev 1080)
+++ trunk/rkward/rkward/plugins/plots/ecdf_plot.php	2007-01-07 17:42:53 UTC (rev 1081)
@@ -1,36 +1,33 @@
 <?
 	function preprocess () {
+?>
+rk.temp.range <- range (<? getRK("x"); ?>, na.rm=TRUE)
+<?
 	}
 	
 	function calculate () {
-?>
-	rk.min <- min (<? getRK("x"); ?>);
-	rk.max <- max (<? getRK("x"); ?>);
-	rk.length <- length (<? getRK ("x"); ?>);
-	doth_pnrom <- <? getRK ("th_pnorm"); ?>;
-	dorug <- <? getRK ("rug"); ?>;
-<?
 	}
 	
 	function printout () {
 	$x = getRK_val ("x");
 	$col = getRK_val ("col");
 ?>
-rk.header ("ECDF", list ("Variable", rk.get.description (<? echo ($x); ?>), "Minimum", rk.min, "Maximum", rk.max, "Length", rk.length))
+rk.header ("Empirical Cumulative Distribution Function", list ("Variable", rk.get.description (<? echo ($x); ?>), "Minimum", rk.temp.range[1], "Maximum", rk.temp.range[2]))
 rk.graph.on ()
 plot.ecdf (<? echo ($x); ?>, <? getRK ("dopoints"); ?>, <? getRK ("verticals"); ?> <? getRK ("plotoptions.code.printout"); ?>)
-if (doth_pnrom) curve(pnorm, from= rk.min, to= rk.max, add=TRUE, col="<? echo ($col); ?>")
-if (dorug) rug(<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+<?	if (getRK_val ("th_pnorm")) { ?>
+curve (pnorm, from=rk.temp.range[1], to=rk.temp.range[2], add=TRUE, col="<? echo ($col); ?>")
+<?	}
+	if (getRK_val ("rug")) { ?>
+rug (<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+<?	} ?>
 rk.graph.off ()
 <?
 	}
 	
 	function cleanup () {
-?>	rm (rk.min)
-	rm (rk.max)
-	rm (rk.length)
-	rm (doth_pnrom)
-	rm (dorug)
+?>
+rm (rk.temp.range)
 <?
 	}
 ?>

Modified: trunk/rkward/rkward/plugins/plots/histogram.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram.php	2007-01-07 17:08:40 UTC (rev 1080)
+++ trunk/rkward/rkward/plugins/plots/histogram.php	2007-01-07 17:42:53 UTC (rev 1081)
@@ -1,15 +1,12 @@
 <?
-	function preprocess () {
-	}
-	
-	function calculate () {
-	}
-	
-	function printout () {
-?>
-	dodensity <- <? getRK ("density"); ?>;
-	
-<?	$breaks = getRK_val ("breaks");
+function preprocess () {
+}
+
+function calculate () {
+}
+
+function printout () {
+	$breaks = getRK_val ("breaks");
 	$scale = getRK_val ("scale");
 	$bw =  getRK_val ("bw");
 	$adjust = getRK_val ("adjust");
@@ -26,13 +23,13 @@
 rk.header ("Histogram", list ("Frequency", "<? echo $scale; ?>", "Breaks algorithm", <? echo ("\"" . $breaks . "\""); ?>, "Variable", rk.get.description (<? echo ($x); ?>)))
 rk.graph.on ()
 hist (<? echo ($x); ?>, <? echo ($breaksopt); ?>, freq = <? echo $scale; ?><? getRK ("plotoptions.code.printout"); ?>)
-if ((dodensity) && (<? echo $scale ?> == FALSE)) lines(density(<? echo ($x); ?>, bw="<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, <? echo ($narm); ?>, n = <? getRK ("n"); ?>), col= "<? getRK ("col_density"); ?>")
+<?	if (($scale=="FALSE") && getRK_val ("density")) { ?>
+lines(density(<? echo ($x); ?>, bw="<? echo ($bw); ?>", adjust = <? echo ($adjust); ?>, <? echo ($giveRkern); ?>, <? echo ($narm); ?>, n = <? getRK ("n"); ?>), col= "<? getRK ("col_density"); ?>")
+<?	} ?>
 rk.graph.off ()
 <?
-	}
-	
-	function cleanup () {
-?>	rm (dodensity)
-<?
-	}
+}
+
+function cleanup () {
+}
 ?>

Modified: trunk/rkward/rkward/plugins/plots/histogram.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram.xml	2007-01-07 17:08:40 UTC (rev 1080)
+++ trunk/rkward/rkward/plugins/plots/histogram.xml	2007-01-07 17:42:53 UTC (rev 1081)
@@ -5,6 +5,9 @@
 		<connect client="plotoptions.xvar" governor="x.available"/>
 		<set id="plotoptions.allow_log" to="false"/>
 		<set id="plotoptions.allow_type" to="false"/>
+		
+		<convert id="densityscaled" mode="equals" sources="scale.string" standard="FALSE" />
+		<connect client="densityoptions.enabled" governor="densityscaled" />
 	</logic>
 	<dialog label="Histogram" >
 		<tabbook>
@@ -28,7 +31,7 @@
 				<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
 				<stretch/>
 			</tab>
-			<tab label="Density">
+			<tab label="Density" id="densityoptions">
 				<row>
 					<column>
 						<checkbox value_unchecked="0" value="1" checked="false" id="density" label="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