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

sjar at users.sourceforge.net sjar at users.sourceforge.net
Sat Sep 22 17:08:19 UTC 2007


Revision: 1982
          http://rkward.svn.sourceforge.net/rkward/?rev=1982&view=rev
Author:   sjar
Date:     2007-09-22 10:08:18 -0700 (Sat, 22 Sep 2007)

Log Message:
-----------
FOR 0.4.8 (at least I would love to have it ;) ).
* applied pie chart patches of Thomas in bar plot. I tested it and it seems to work in any scenario.
* "label" is now in a frame in the variables tab (I would like to keep it there because I find it more reasonable in this place)

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

Modified: trunk/rkward/rkward/plugins/plots/barplot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.php	2007-09-20 22:02:33 UTC (rev 1981)
+++ trunk/rkward/rkward/plugins/plots/barplot.php	2007-09-22 17:08:18 UTC (rev 1982)
@@ -17,6 +17,7 @@
 	
 function doPrintout ($final) {
 	$var = getRK_val ("x");
+	$names_mode = getRK_val ("names_mode");
 	$tabulate = getRK_val ("tabulate");
 
 	if ($tabulate) {
@@ -33,6 +34,11 @@
 <?
 	if ($tabulate) { ?>
 x <- table(x, exclude=NULL)
+<?if ($names_mode == "rexp") {
+		echo ("\tnames(x) <- " . getRK_val ("names_exp") . "\n");
+	} else if ($names_mode == "custom") {
+		echo ("\tnames(x) <- c (\"" . str_replace (";", "\", \"", trim (getRK_val ("names_custom"))) . "\")\n");
+	} ?>
 <?      } else { ?>
 # barplot is a bit picky about attributes, so we need to convert to vector explicitely
 if(!is.matrix(x)) x <- as.vector(x)
@@ -47,6 +53,7 @@
 try ({
 <?
 	printIndented ("\t", $barplot_main);
+	
 ?>
 })
 <?	if ($final) { ?>

Modified: trunk/rkward/rkward/plugins/plots/barplot.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.rkh	2007-09-20 22:02:33 UTC (rev 1981)
+++ trunk/rkward/rkward/plugins/plots/barplot.rkh	2007-09-22 17:08:18 UTC (rev 1982)
@@ -12,6 +12,7 @@
 		<caption id="tab_variables"/>
 		<setting id="x">Select a data matrix, a vector or a factor to be plotted.</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="barplot_embed" title="Barplot Options">Since these settings are reused in further plugins, they are documented on a page of their own: See <link href="rkward://component/barplot_embed"/>.</setting>
 	</settings>

Modified: trunk/rkward/rkward/plugins/plots/barplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.xml	2007-09-20 22:02:33 UTC (rev 1981)
+++ trunk/rkward/rkward/plugins/plots/barplot.xml	2007-09-22 17:08:18 UTC (rev 1982)
@@ -1,27 +1,44 @@
-<!DOCTYPE rkplugin>
-<document>
-	<code file="barplot.php" />
-	<help file="barplot.rkh" />
-	<logic>
-		<set id="barplot_embed.xvar" to="x"/>
-	</logic>
-	<dialog label="Barplot" >		
-		<tabbook>
-			<tab label="Variables" id="tab_variables">
-				<row>
-					<varselector id="vars"/>
-					<column>
-					<varslot min_vars="1" id="x" source="vars" required="true" label="Matrix, Vector or Factor"/>
-					<checkbox id="tabulate" label="Tabulate" value="1" value_unchecked="0" checked="false" />
-					<stretch/>
-					<preview id="preview"/>
-					</column>
-				</row>
-			</tab>
-			<tab label="Options" id="tab_options">
-				<embed id="barplot_embed" component="rkward::barplot_embed"/>
-			</tab>
-		</tabbook>
-	</dialog>
-
-</document>
+	<!DOCTYPE rkplugin>
+	<document>
+		<code file="barplot.php" />
+		<help file="barplot.rkh" />
+		<logic>
+			<set id="barplot_embed.xvar" to="x"/>
+			
+			<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"/>
+		</logic>
+		<dialog label="Barplot" >		
+			<tabbook>
+				<tab label="Variables" id="tab_variables">
+					<row>
+						<varselector id="vars"/>
+						<column>
+						<varslot min_vars="1" id="x" source="vars" required="true" label="Matrix, Vector or Factor"/>
+						<checkbox id="tabulate" label="Tabulate" value="1" value_unchecked="0" checked="false" />
+						<stretch/>
+						<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>
+						<preview id="preview"/>
+						</column>
+					</row>
+				</tab>
+				<tab label="Options" id="tab_options">
+					
+					<embed id="barplot_embed" component="rkward::barplot_embed"/>
+				</tab>
+			</tabbook>
+		</dialog>
+	
+	</document>


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