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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Jun 1 11:13:15 UTC 2007


Revision: 1923
          http://svn.sourceforge.net/rkward/?rev=1923&view=rev
Author:   tfry
Date:     2007-06-01 04:13:15 -0700 (Fri, 01 Jun 2007)

Log Message:
-----------
Small addtions to and help page for piechart plugin

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

Added Paths:
-----------
    trunk/rkward/rkward/plugins/plots/piechart.rkh

Modified: trunk/rkward/rkward/plugins/plots/barplot_options.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot_options.rkh	2007-06-01 10:09:04 UTC (rev 1922)
+++ trunk/rkward/rkward/plugins/plots/barplot_options.rkh	2007-06-01 11:13:15 UTC (rev 1923)
@@ -9,7 +9,7 @@
 	</usage>
 
 	<settings>
-		<setting id="legend">Shoudl a legend be added to the barplot? The row names of the data will be used to construct the legend, so this option has no effect, if the rows are not named.</setting>
+		<setting id="legend">Should a legend be added to the barplot? The row names of the data will be used to construct the legend, so this option has no effect, if the rows are not named.</setting>
 		<setting id="colors">Select between grey and rainbow colors.</setting>
 		<setting id="type">Select a type between juxtaposed bars and stacked bars. This setting is only meaningful for two-dimensional data. If you chose stacked bars you can not display bar values, below.</setting>
 		<setting id="labels">Select if you want to display bar values (labels).</setting>

Modified: trunk/rkward/rkward/plugins/plots/piechart.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.php	2007-06-01 10:09:04 UTC (rev 1922)
+++ trunk/rkward/rkward/plugins/plots/piechart.php	2007-06-01 11:13:15 UTC (rev 1923)
@@ -18,7 +18,18 @@
 function doPrintout ($final) {
 	$vars = getRK_val ("x");
 	$tabulate= getRK_val ("tabulate")=="TRUE";
+	$radius = getRK_val ("radius");
+	$col = getRK_val ("colors");
 
+	$options = "";
+	if ($radius != 0.8) $options .= ", radius=" . $radius;
+	if ($col == "rainbow") $options .= ", col=rainbow (if(is.matrix(x)) dim(x) else length(x))";
+	else if ($col == "grayscale") $options .= ", col=gray.colors (if(is.matrix(x)) dim(x) else length(x))";
+	$options .= getRK_val ("plotoptions.code.printout");
+
+	$plotpre = getRK_val ("plotoptions.code.preprocess");
+	$plotpost = getRK_val ("plotoptions.code.calculate");
+
 if($tabulate) {?>
 x <- table (<? echo ($vars); ?>, exclude=NULL)
 <?      } else { ?>
@@ -36,7 +47,9 @@
 <?	}
 ?>
 try ({
-	pie(x, col=rainbow( if(is.matrix(x)) dim(x) else length(x)))
+<?	if (!empty ($plotpre)) printIndented ("\t", $plotpre); ?>
+	pie(x<? echo ($options); ?>)
+<?	if (!empty ($plotpost)) printIndented ("\t", $plotpost); ?>
 })
 <?	if ($final) { ?>
 rk.graph.off ()

Added: trunk/rkward/rkward/plugins/plots/piechart.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/piechart.rkh	2007-06-01 11:13:15 UTC (rev 1923)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+Draw a pie chart
+	</summary>
+
+	<usage>
+Choose a matrix, vector or a factor to be plotted. Further options are available on the second tab.
+	</usage>
+
+	<settings>
+		<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>
+		<caption id="tab_options"/>
+		<setting id="colors">Type of colors to use.</setting>
+		<setting id="radius">Radius of the pie. For long labels it may be necessary to make the pie smaller than the default.</setting>
+		<setting id="plotoptions">Generic plot options. See <link href="rkward://component/plot_options"/>.</setting>	
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://component/barplot"/></li>
+			<li><link href="rkward://component/plot_options"/></li>
+			<li><link href="rkward://rhelp/pie"/></li>
+			<li><link href="rkward://rhelp/table"/></li>
+		</ul>
+	</related>
+</document>

Modified: trunk/rkward/rkward/plugins/plots/piechart.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.xml	2007-06-01 10:09:04 UTC (rev 1922)
+++ trunk/rkward/rkward/plugins/plots/piechart.xml	2007-06-01 11:13:15 UTC (rev 1923)
@@ -1,6 +1,13 @@
 <!DOCTYPE rkplugin>
 <document>
 	<code file="piechart.php" />
+	<help file="piechart.rkh" />
+	<logic>
+		<set id="plotoptions.allow_ylim" to="false"/>
+		<set id="plotoptions.allow_xlim" to="false"/>
+		<set id="plotoptions.allow_type" to="false"/>
+		<set id="plotoptions.allow_log" to="false"/>
+	</logic>
 	<dialog label="Pie chart" >
 		<tabbook>
 			<tab label="Variables" id="tab_variables">
@@ -14,6 +21,15 @@
 					</column>
 				</row>
 			</tab>
+			<tab label="Options" id="tab_options">
+				<radio id="colors" label="Colors" >
+					<option value="default" label="Default (pastel)"/>
+					<option value="grayscale" label="Grayscale"/>
+					<option value="rainbow" label="Rainbow colors" checked="true"/>
+				</radio>
+				<spinbox id="radius" type="real" min="0.01" max="1" initial="0.8" label="Radius"/>
+				<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options"/>
+			</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