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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed May 16 16:55:20 UTC 2007


Revision: 1905
          http://svn.sourceforge.net/rkward/?rev=1905&view=rev
Author:   tfry
Date:     2007-05-16 09:55:20 -0700 (Wed, 16 May 2007)

Log Message:
-----------
Add plot_options to barplot_embed, and some documentation

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

Modified: trunk/rkward/rkward/plugins/plots/barplot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.php	2007-05-16 16:54:53 UTC (rev 1904)
+++ trunk/rkward/rkward/plugins/plots/barplot.php	2007-05-16 16:55:20 UTC (rev 1905)
@@ -25,8 +25,8 @@
 		$tabulate_header = '"Tabulate:", "Yes"';
 	}
 
-	$barplot_header = getRK_val ("barplot_options.code.preprocess");
-	$barplot_main = getRK_val ("barplot_options.code.printout");
+	$barplot_header = getRK_val ("barplot_embed.code.preprocess");
+	$barplot_main = getRK_val ("barplot_embed.code.printout");
 
 ?>
 x <- <? echo ($var . "\n"); ?>

Modified: trunk/rkward/rkward/plugins/plots/barplot.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.rkh	2007-05-16 16:54:53 UTC (rev 1904)
+++ trunk/rkward/rkward/plugins/plots/barplot.rkh	2007-05-16 16:55:20 UTC (rev 1905)
@@ -13,11 +13,11 @@
 		<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>
 		<caption id="tab_options"/>
-		<setting id="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_options"/>.</setting>
+		<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>
 	<related>
 		<ul>
-			<li><link href="rkward://component/barplot_options"/></li>
+			<li><link href="rkward://component/barplot_embed"/></li>
 			<li><link href="rkward://rhelp/barplot"/></li>
 			<li><link href="rkward://rhelp/table"/></li>
 		</ul>

Modified: trunk/rkward/rkward/plugins/plots/barplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.xml	2007-05-16 16:54:53 UTC (rev 1904)
+++ trunk/rkward/rkward/plugins/plots/barplot.xml	2007-05-16 16:55:20 UTC (rev 1905)
@@ -3,7 +3,7 @@
 	<code file="barplot.php" />
 	<help file="barplot.rkh" />
 	<logic>
-		<set id="barplot_options.xvar" to="x"/>
+		<set id="barplot_embed.xvar" to="x"/>
 	</logic>
 	<dialog label="Barplot" >		
 		<tabbook>
@@ -19,9 +19,9 @@
 				</row>
 			</tab>
 			<tab label="Options" id="tab_options">
-				<embed id="barplot_options" component="rkward::barplot_options"/>
+				<embed id="barplot_embed" component="rkward::barplot_embed"/>
 			</tab>
-		</tabbook>			
+		</tabbook>
 	</dialog>
 
 </document>

Modified: trunk/rkward/rkward/plugins/plots/barplot_options.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot_options.php	2007-05-16 16:54:53 UTC (rev 1904)
+++ trunk/rkward/rkward/plugins/plots/barplot_options.php	2007-05-16 16:55:20 UTC (rev 1905)
@@ -40,9 +40,15 @@
 	if ($options['juxtaposed']) $main_call .= ', beside=TRUE';
 	if ($options['legend']) $main_call .= ', legend.text=TRUE';
 	if ($options['labels']) $main_call .= ", ylim = yrange";
+	$main_call .= getRK_val ('plotoptions.code.printout');
 	$main_call .= ")\n";
 
+	$plot_pre = getRK_val ('plotoptions.code.preprocess');
+	$plot_adds = getRK_val ('plotoptions.code.calculate');
+
 	// now print everything as needed
+	echo ($plot_pre);
+
 	if ($options['labels']) { ?>
 # adjust the range so that the labels will fit
 yrange <- range (<? echo ($options['xvar']); ?>, na.rm=TRUE) * 1.2
@@ -58,5 +64,7 @@
 		echo ('text (bplot,' . $options['xvar'] . ', labels=' . $options['xvar'] . ', pos=' . $options['place'] . ', offset=.5)');
 		echo ("\n");
 	}
+
+	echo ($plot_adds);
 }
 ?>

Modified: trunk/rkward/rkward/plugins/plots/barplot_options.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot_options.rkh	2007-05-16 16:54:53 UTC (rev 1904)
+++ trunk/rkward/rkward/plugins/plots/barplot_options.rkh	2007-05-16 16:55:20 UTC (rev 1905)
@@ -9,24 +9,31 @@
 	</usage>
 
 	<settings>
-		<setting id="legend">Select if you want to add a legend to the barplot. The row names of height will be used as labels if they are non-null.</setting>
-		<setting id="colors">Select between grey and rainbow collors.</setting>
-		<setting id="type">Select a type between juxtaposed bars and stacked bars. If you select stacked bars you can not display bar values (labels). </setting>
+		<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="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>
 		<setting id="place">If you have selected to display bar values (labels) you can select where should they be displayed:
 		<li> Above the bars </li>
 		<li> Beside the bars </li>
 		<li> Inside the bars </li>
-		</setting>		
+		</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/barplot"/></li>
 			<li><link href="rkward://rhelp/table"/></li>
 		</ul>
 	</related>
 	<technical>
-		TODO: Write me
+		This plugin is meant to be embedded in other plugins. It does not by itself provide a means to select input data. When embedding this plugin, you will be interested in the following properties:
+		<ul>
+			<li><i>xvar</i>: The name of the data variable. You can connect this to a varslot, or set it to a fixed string such as "x". This is required.</li>
+			<li><i>code.preprocess</i>: Provides a summary of parameters to be used in a call to rk.header(), if you have a use for it.</li>
+			<li><i>code.printout</i>: The actual commands needed to construct the barplot.</li>
+		</ul>
 	</technical>
 </document>

Modified: trunk/rkward/rkward/plugins/plots/barplot_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot_options.xml	2007-05-16 16:54:53 UTC (rev 1904)
+++ trunk/rkward/rkward/plugins/plots/barplot_options.xml	2007-05-16 16:55:20 UTC (rev 1905)
@@ -4,7 +4,9 @@
 	<help file="barplot_options.rkh" />
 	<logic>
 		<external id="xvar" default=""/>
-		<!-- when adding plot_options, here, the pre and post could be connected to "external" variables -->
+		<set id="plotoptions.allow_ylim" to="false"/>
+		<set id="plotoptions.allow_xlim" to="false"/>
+		<set id="plotoptions.allow_type" to="false"/>
 
 		<convert id="juxtaposed" mode="equals" sources="type.string" standard="juxtaposed" />
 		<connect client="labels.enabled" governor="juxtaposed" />
@@ -29,5 +31,6 @@
 				<option value="1" label="Inside Bars"/>
 			</radio>
 		</frame>
+		<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options"/>
 	</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