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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Dec 13 09:00:04 UTC 2011


Revision: 4112
          http://rkward.svn.sourceforge.net/rkward/?rev=4112&view=rev
Author:   tfry
Date:     2011-12-13 09:00:04 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Enable trim of mean option only for arithmetic mean. Stefan, is this what you had in mind?
Also, use checkable frames, instead of checkboxes inside frames.

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/box_plot.js
    trunk/rkward/rkward/plugins/plots/box_plot.xml

Modified: trunk/rkward/rkward/plugins/plots/box_plot.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/box_plot.js	2011-12-13 08:44:41 UTC (rev 4111)
+++ trunk/rkward/rkward/plugins/plots/box_plot.js	2011-12-13 09:00:04 UTC (rev 4112)
@@ -10,9 +10,9 @@
 	var grouped_mode = getValue ("data_mode_grouped.numeric");
 	var dodged = grouped_mode && getValue ("dodges");
 	var names_mode = getValue ("names_mode");
-	var mean = getValue ("mean");
+	var do_mean = getValue ("mean.checked");
 	var pch_mean = getValue ("pch_mean");
-	var sd = getValue ("sd");
+	var do_sd = getValue ("sd.checked");
 	var pch_sd_high = getValue ("pch_sd_high");
 	var pch_sd_low = getValue ("pch_sd_low");
 	var horizontal = getValue ("orientation") == "TRUE";
@@ -55,8 +55,8 @@
 		echo ('rk.graph.on()\n');
 	}
 	echo ('try (boxplot (data_list' + boxwex + positions + ', notch = ' + getValue ("notch") + ', outline = ' + getValue("outline") + ', horizontal = ' + getValue("orientation") + getValue ("plotoptions.code.printout") + ')) #actual boxplot function\n');
-	if (mean == "TRUE") {
-		var mean_fun = "mean" + ", trim=" + getValue("trim");	// arithmetic mean
+	if (do_mean) {
+		var mean_fun = "mean";
 		if (getValue ("type_of_mean") =="geometric_mean") {
 			echo('	geo_mean <- function (x) {prod(na.omit(x))^1/length(na.omit(x))}	#Calculate geometric mean\n');
 			mean_fun = "geo_mean";
@@ -66,6 +66,9 @@
 		} else if (getValue ("type_of_mean") =="interquantile_mean") {
 			echo('	interq_mean <- function (x) {sum(quantile(x, probs=c(0.25), na.rm=TRUE), quantile(x, probs=c(0.75), na.rm=TRUE)) / 2}	#Calculate interquantile mean\n');
 			mean_fun = "interq_mean";
+		} else {	// arithmetic mean
+			var trim = getValue("trim");
+			if (trim != 0) mean_fun += ", trim=" + trim;
 		}
 
 		if (horizontal) {
@@ -75,7 +78,7 @@
 		}
 	}
 
-	if (sd == "TRUE") {
+	if (do_sd) {
 		echo ('	sd_low <- (sapply(data_list,mean,na.rm = TRUE)) - (sapply(data_list,sd,na.rm = TRUE))\n');
 		echo ('	sd_high <- (sapply(data_list,mean,na.rm = TRUE)) + (sapply(data_list,sd,na.rm = TRUE))\n');
 		if (horizontal) {

Modified: trunk/rkward/rkward/plugins/plots/box_plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/box_plot.xml	2011-12-13 08:44:41 UTC (rev 4111)
+++ trunk/rkward/rkward/plugins/plots/box_plot.xml	2011-12-13 09:00:04 UTC (rev 4112)
@@ -22,12 +22,11 @@
 		<connect client="names_custom.enabled" governor="custom_names"/>
 		<connect client="names_exp.visible" governor="rexp_names"/>
 
-		<connect client="type_of_mean.enabled" governor="mean.state"/>
-		<connect client="trim.enabled" governor="mean.state"/>
-		<connect client="pch_mean.enabled" governor="mean.state"/>
-		<connect client="pch_sd_high.enabled" governor="sd.state"/>
-		<connect client="pch_sd_low.enabled" governor="sd.state"/>
-		<convert id="sd_or_mean" mode="or" sources="mean.state;sd.state"/>
+		<connect client="type_of_mean.enabled" governor="mean.checked"/>
+		<convert id="arith_mean" mode="equals" sources="type_of_mean.string" standard="arithmetic_mean" />
+		<connect client="trim.enabled" governor="arith_mean"/>
+		<connect client="pch_mean.enabled" governor="mean.checked"/>
+		<convert id="sd_or_mean" mode="or" sources="mean.checked;sd.checked"/>
 		<connect client="size_and_color_frame.enabled" governor="sd_or_mean"/>
 	</logic>
 	<dialog label="Boxplot" >
@@ -77,21 +76,19 @@
 					</frame>
 				</column>
 				<column>
-					<frame label="Mean">
-					  <row>
-						<checkbox id="mean" checked="false" value="TRUE" label="show mean" />
+					<frame id="mean" label="Show mean" checkable="true" checked="false">
 						<spinbox type="integer" id="pch_mean" label="mean symbol" initial="15"/>
-						<spinbox id="trim" label="Trim of arithmetic mean" type="real" min="0" max="0.5" initial="0.0" />
-					  </row>
-						<radio id="type_of_mean" label="Type of mean" >
-						  <option value="arithmetic_mean" label="Arithmetic mean" checked="true" />
-						  <option value="geometric_mean" label="Geometric mean" />
-						  <option value="harmonic_mean" label="Harmonic mean" />
-						  <option value="interquantile_mean" label="Interquantile mean" />
-						</radio>
+						<row>
+							<radio id="type_of_mean" label="Type of mean" >
+								<option value="arithmetic_mean" label="Arithmetic mean" checked="true" />
+								<option value="geometric_mean" label="Geometric mean" />
+								<option value="harmonic_mean" label="Harmonic mean" />
+								<option value="interquantile_mean" label="Interquantile mean" />
+							</radio>
+							<spinbox id="trim" label="Trim of arithmetic mean" type="real" min="0" max="0.5" initial="0.0" />
+						</row>
 					</frame>
-					<frame label="SD">
-						<checkbox id="sd" checked="false" value="TRUE" label="show standard deviation" />
+					<frame id="sd" label="show standard deviation" checked="false" checkable="true">
 						<spinbox type="integer" id="pch_sd_high" label="standard deviation symbol (upper)" initial="3"/>
 						<spinbox type="integer" id="pch_sd_low" label="standard deviation symbol (lower)" initial="3"/>
 					</frame>

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