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

sjar at users.sourceforge.net sjar at users.sourceforge.net
Tue Sep 25 19:56:57 UTC 2007


Revision: 1995
          http://rkward.svn.sourceforge.net/rkward/?rev=1995&view=rev
Author:   sjar
Date:     2007-09-25 12:56:56 -0700 (Tue, 25 Sep 2007)

Log Message:
-----------
FOR 0.4.8: label added

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/dotchart.php
    trunk/rkward/rkward/plugins/plots/dotchart.rkh
    trunk/rkward/rkward/plugins/plots/dotchart.xml

Modified: trunk/rkward/rkward/plugins/plots/dotchart.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.php	2007-09-25 19:23:04 UTC (rev 1994)
+++ trunk/rkward/rkward/plugins/plots/dotchart.php	2007-09-25 19:56:56 UTC (rev 1995)
@@ -17,7 +17,14 @@
 
 function doPrintout ($final) {
 	$vars = getRK_val ("x");
+	$names_mode = getRK_val ("names_mode");
 	$tabulate= getRK_val ("tabulate")=="TRUE";
+	$tabulate= getRK_val ("tabulate");
+	if ($tabulate) {
+		$tabulate_header = '"Tabulate", "Yes"';
+	} else {
+		$tabulate_header = '"Tabulate", "No"';
+	}
 
 	$options = getRK_val ("plotoptions.code.printout");
 
@@ -35,13 +42,18 @@
 <?      } ?>
 
 <?	if ($final) { ?>
-rk.header ("Dot chart", list ("Variable", rk.get.description (<? echo ($vars); ?>)))
+rk.header ("Dot chart", parameters=list ("Variable", rk.get.description (<? echo ($vars); ?>), <? echo ($tabulate_header); ?>))
 
 rk.graph.on ()
 <?	}
 ?>
 try ({
-<?	if (!empty ($plotpre)) printIndented ("\t", $plotpre); ?>
+<?	if ($names_mode == "rexp") {
+		echo ("names(x) <- " . getRK_val ("names_exp") . "\n");
+	} else if ($names_mode == "custom") {
+		echo ("names(x) <- c (\"" . str_replace (";", "\", \"", trim (getRK_val ("names_custom"))) . "\")\n");
+	}
+	if (!empty ($plotpre)) printIndented ("\t", $plotpre); ?>
 	dotchart(x<? echo ($options); ?>)
 <?	if (!empty ($plotpost)) printIndented ("\t", $plotpost); ?>
 })

Modified: trunk/rkward/rkward/plugins/plots/dotchart.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.rkh	2007-09-25 19:23:04 UTC (rev 1994)
+++ trunk/rkward/rkward/plugins/plots/dotchart.rkh	2007-09-25 19:56:56 UTC (rev 1995)
@@ -12,6 +12,7 @@
 		<caption id="tab_variables"/>
 		<setting id="x">Matrix, vector or a factor. Data needs to be numeric unless the tabulate option is checked, below.</setting>
 		<setting id="tabulate">Use tabulate option mainly for factor variables or wherever else applicable.</setting>
+		<setting id="names_mode">Method for assigning labels to the plot. "default" means, the labels are chosen automatically. If no labels are available, this will generally print the values. The other options allow you to specify the labels as literal string, or as an R statement (e.g. if the names are stored in a different variable in the workspace).</setting>
 		<caption id="tab_options"/>
 		<setting id="plotoptions">Generic plot options. See <link href="rkward://component/plot_options"/>.</setting>	
 	</settings>

Modified: trunk/rkward/rkward/plugins/plots/dotchart.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/dotchart.xml	2007-09-25 19:23:04 UTC (rev 1994)
+++ trunk/rkward/rkward/plugins/plots/dotchart.xml	2007-09-25 19:56:56 UTC (rev 1995)
@@ -3,6 +3,13 @@
 	<code file="dotchart.php" />
 	<help file="dotchart.rkh" />
 	<logic>
+		<convert id="custom_names" mode="equals" sources="names_mode.string" standard="custom"/>
+		<convert id="rexp_names" mode="equals" sources="names_mode.string" standard="rexp"/>
+		<connect client="names_custom.visible" governor="rexp_names.not"/>
+		<connect client="names_custom.enabled" governor="custom_names"/>
+		<connect client="names_exp.visible" governor="rexp_names"/>
+		<connect client="names_exp.required" governor="rexp_names"/>
+		
 		<set id="plotoptions.allow_ylim" to="false"/>
 		<set id="plotoptions.allow_log" to="false"/>
 		<set id="plotoptions.allow_type" to="false"/>
@@ -14,7 +21,16 @@
 					<varselector id="vars"/>
 					<column>
 					<varslot min_vars="1" id="x" source="vars" required="true" label="Variable"/>
-					<checkbox id="tabulate" label="Tabulate" value="TRUE" value_unchecked="FALSE" checked="false" />
+					<checkbox id="tabulate" label="Tabulate" value="1" value_unchecked="0" checked="false" />
+					<frame label="Labels">
+						<radio id="names_mode" label="Labeling" >
+							<option value="default" label="Default labels" checked="true"/>
+							<option value="custom" label="Custom labels"/>
+							<option value="rexp" label="From R expression"/>
+						</radio>
+						<input id="names_exp" label="Expression to use for labels" initial="names (x)"/>
+						<input id="names_custom" label="Labels (separated by ';')" initial="First label;Second label"/>
+					</frame>
 					<stretch/>
 					<preview id="preview"/>
 					</column>


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