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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Feb 26 15:03:40 UTC 2007


Revision: 1475
          http://svn.sourceforge.net/rkward/?rev=1475&view=rev
Author:   tfry
Date:     2007-02-26 07:03:40 -0800 (Mon, 26 Feb 2007)

Log Message:
-----------
Modifications to histogram options plugin:
* Hide the disallowed options
* allow to configure the options splitter string (defaulting to empty)
* also generate options for use in rk.header

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php
    trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml
    trunk/rkward/rkward/plugins/plots/histogram_options.php
    trunk/rkward/rkward/plugins/plots/histogram_options.xml

Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php	2007-02-26 14:03:18 UTC (rev 1474)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.php	2007-02-26 15:03:40 UTC (rev 1475)
@@ -44,7 +44,7 @@
 	}
 
 	if ($fun == "hist") {
-		$all_hist_code = explode ("HIST_STRING_SPLITTER", getRK_val ("histogram_opt.code.printout"));
+		$all_hist_code = explode (getRK_val ("histogram_opt.options_splitter_string"), getRK_val ("histogram_opt.code.printout"));
 		$histbreaksoptions = $all_hist_code[0];
 		$histoptions = $all_hist_code[1];
 		$histoptions .= getRK_val("plotoptions.code.printout");

Modified: trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml	2007-02-26 14:03:18 UTC (rev 1474)
+++ trunk/rkward/rkward/plugins/distributions/plot_binomial_clt.xml	2007-02-26 15:03:40 UTC (rev 1475)
@@ -11,6 +11,7 @@
 		<set id="normlinecol.default_color" to="red" />
 
 		<set id="histogram_opt.varname" to="rk.temp.cltdistrib$avg" />
+		<set id="histogram_opt.options_splitter_string" to="###OPTIONS_SPLIT###" />
 		<set id="histogram_opt.allow_freq" to="false" />
 		<set id="histogram_opt.allow_barlabels" to="true" />
 		<set id="histogram_opt.allow_addtoplot" to="false" />

Modified: trunk/rkward/rkward/plugins/plots/histogram_options.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram_options.php	2007-02-26 14:03:18 UTC (rev 1474)
+++ trunk/rkward/rkward/plugins/plots/histogram_options.php	2007-02-26 15:03:40 UTC (rev 1475)
@@ -8,30 +8,55 @@
 function printout () {
 		$histbreaksoptions = ", breaks=";
 		$histoptions = "";
+		$headeroptions = "";
 		$varname = getRK_val ("varname");
 
 		$histbreaks = getRK_val ("histbreaksFunction");
-		if ($histbreaks == "cells") $histbreaksoptions .= getRK_val ("histbreaks_ncells");
-		else if ($histbreaks == "int") $histbreaksoptions .= "seq (floor (min (" . $varname . ", na.rm=TRUE))-0.5, ceiling (max (" . $varname . ", na.rm=TRUE))+0.5)";
+		$headeroptions .= ', Breaks, "';
+		if ($histbreaks == "cells") {
+			$histbreaksoptions .= getRK_val ("histbreaks_ncells");
+			$header_options .= getRK_val ("histbreaks_ncells") . 'cells"';
+		} else if ($histbreaks == "int") {
+			$histbreaksoptions .= "seq (floor (min (" . $varname . ", na.rm=TRUE))-0.5, ceiling (max (" . $varname . ", na.rm=TRUE))+0.5)";
+			$header_options .= 'integers"';
+		}
 		else if ($histbreaks == "vec") {
 			$histbreaksoptions .= "(function(x) {y = extendrange(x,f=0.1); seq(from=y[1], to=y[2], length=" . getRK_val ("histbreaks_veclength") . ")})(" . $varname . ")";
+			$header_options .= 'vector length ' . getRK_val ("histbreaks_veclength") . '"';
+		} else {
+			$histbreaksoptions .= "\"" . $histbreaks . "\"";
+			$header_options .= $histbreaks . '"';
 		}
-		else $histbreaksoptions .= "\"" . $histbreaks . "\"";
 
 		$addbars = getRK_val ("addtoplot");
 		if ($addbars) $histoptions .= ", add=TRUE";
 
 		$freq = getRK_val ("freq");
-		if (!$freq) $histoptions .= ", freq=FALSE";
+		if (!$freq) {
+			$histoptions .= ", freq=FALSE";
+			$headeroptions .= ', Scale, "Density"';
+		} else {
+			$headeroptions .= ', Scale, "Frequency"';
+		}
 
 		$labels = getRK_val ("barlabels");
 		if ($labels) $histoptions .= ", labels=TRUE";
 
 		$right = getRK_val ("rightclosed");
-		if (!$right) $histoptions .= ", right=FALSE";
+		if (!$right) {
+			$headeroptions .= ', "Right closed", "FALSE"';
+			$histoptions .= ", right=FALSE";
+		} else {
+			$headeroptions .= ', "Right closed", "TRUE"';
+		}
 
 		$inclowest = getRK_val ("include_lowest");
-		if (!$inclowest) $histoptions .= ", include.lowest=FALSE";
+		if (!$inclowest) {
+			$headeroptions .= ', "Include in lowest cell", "FALSE"';
+			$histoptions .= ", include.lowest=FALSE";
+		} else {
+			$headeroptions .= ', "Include in lowest cell", "TRUE"';
+		}
 
 		$histlty = getRK_val ("histlinetype");
 		$histoptions .= ", lty=" . "\"" . $histlty . "\"";
@@ -48,7 +73,8 @@
 			if (getRK_val ("usefillcol")) $histfillcol = getRK_val ("histfillcol.code.printout");
 
 			$histoptions .= $histbordercol . $histfillcol;
-		echo ($histbreaksoptions . "HIST_STRING_SPLITTER" . $histoptions);
+		$splitter = getRK_val ("options_splitter_string");
+		echo ($histbreaksoptions . $splitter . $histoptions . $splitter . $headeroptions);
 }
 
 function cleanup () {

Modified: trunk/rkward/rkward/plugins/plots/histogram_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/histogram_options.xml	2007-02-26 14:03:18 UTC (rev 1474)
+++ trunk/rkward/rkward/plugins/plots/histogram_options.xml	2007-02-26 15:03:40 UTC (rev 1475)
@@ -4,13 +4,15 @@
 	<help file="histogram_options.rkh"/>
 	<logic>
 		<external id="varname" default=""/>
+		<external id="options_splitter_string" default=""/>
+		<external id="make_header_options" default="1" />
 		<external id="allow_freq" default="true"/>
 		<external id="allow_barlabels" default="true"/>
 		<external id="allow_addtoplot" default="true"/>
 
-		<connect client="freq.enabled" governor="allow_freq"/>
-		<connect client="barlabels.enabled" governor="allow_barlabels"/>
-		<connect client="addtoplot.enabled" governor="allow_addtoplot"/>
+		<connect client="freq.visible" governor="allow_freq"/>
+		<connect client="barlabels.visible" governor="allow_barlabels"/>
+		<connect client="addtoplot.visible" governor="allow_addtoplot"/>
 
 		<set id="histbordercol.argument" to=", border="/>
 
@@ -56,7 +58,7 @@
 					<option value="FD" label="Friedman-Diaconis" />
 					<option value="cells" label="A single number" />
 					<option value="int" label="Integer numbers" />
-					<option value="vec" label="Vecor of break points" />
+					<option value="vec" label="Vector of break points" />
 				</radio>
 				<row>
 				<spinbox id="histbreaks_ncells" label="Suggested cells" type="integer" min="1" initial="10"/>


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