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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Mar 18 14:54:33 UTC 2007


Revision: 1613
          http://svn.sourceforge.net/rkward/?rev=1613&view=rev
Author:   tfry
Date:     2007-03-18 07:54:32 -0700 (Sun, 18 Mar 2007)

Log Message:
-----------
Convert ECDF plot to use plot_stepfun_options plugin. Add help page

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/ecdf_plot.php
    trunk/rkward/rkward/plugins/plots/ecdf_plot.xml
    trunk/rkward/rkward/plugins/plots/plot_stepfun_options.xml
    trunk/rkward/rkward/plugins/plots.pluginmap
    trunk/rkward/rkward/plugins/under_development.pluginmap

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

Modified: trunk/rkward/rkward/plugins/plots/ecdf_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/ecdf_plot.php	2007-03-18 04:56:47 UTC (rev 1612)
+++ trunk/rkward/rkward/plugins/plots/ecdf_plot.php	2007-03-18 14:54:32 UTC (rev 1613)
@@ -1,51 +1,43 @@
 <?
-	function preprocess () {
+function preprocess () {
 ?>
-rk.temp.range <- range (<? getRK("x"); ?>, na.rm=TRUE)
+yrange <- range (<? getRK("x"); ?>, na.rm=TRUE)
 <?
-	}
-	
-	function calculate () {
-	}
-	
-	function printout () {
-		doPrintout (true);
-	}
-	
-	function cleanup () {
-?>
-rm (rk.temp.range)
-<?
-	}
+}
 
-	function preview () {
-		preprocess ();
-		calculate ();
-		doPrintout (false);
-		cleanup ();
-	}
+function calculate () {
+}
 
-	function doPrintout ($final) {
-		$x = getRK_val ("x");
-		$col = getRK_val ("col");
+function printout () {
+	doPrintout (true);
+}
+
+function preview () {
+	preprocess ();
+	calculate ();
+	doPrintout (false);
+}
+
+function doPrintout ($final) {
+	$x = getRK_val ("x");
 	
-		if ($final) { ?>
-rk.header ("Empirical Cumulative Distribution Function", list ("Variable", rk.get.description (<? echo ($x); ?>), "Minimum", rk.temp.range[1], "Maximum", rk.temp.range[2]))
+	if ($final) { ?>
+rk.header ("Empirical Cumulative Distribution Function", list ("Variable", rk.get.description (<? echo ($x); ?>), "Minimum", yrange[1], "Maximum", yrange[2]))
 
 rk.graph.on ()
-<?		} ?>
+<?	} ?>
 try ({
-	plot.ecdf (<? echo ($x); ?>, <? getRK ("dopoints"); ?>, <? getRK ("verticals"); ?> <? getRK ("plotoptions.code.printout"); ?>)
+	plot.ecdf (<? echo ($x); ?>, <? getRK ("stepfun_options.code.printout"); ?><? getRK ("plotoptions.code.printout"); ?>)
 <?	if (getRK_val ("th_pnorm")) { ?>
-	curve (pnorm, from=rk.temp.range[1], to=rk.temp.range[2], add=TRUE, col="<? echo ($col); ?>")
+	curve (pnorm, from=yrange[1], to=yrange[2], add=TRUE, <? getRK ("col_thnorm.code.printout"); ?>)
 <?	}
 	if (getRK_val ("rug")) { ?>
-	rug (<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?>, col ="<? getRK ("col_rug"); ?>")
+	rug (<? echo ($x); ?>, <? getRK ("ticksize"); ?>, <? getRK ("lwd"); ?>, <? getRK ("side"); ?><? getRK ("col_rug.code.printout"); ?>)
 <?	} ?>
 })
-<?		if ($final) { ?>
+<?	if ($final) { ?>
 rk.graph.off ()
-<?		}
-	}
+<?	}
+}
 
 ?>

Added: trunk/rkward/rkward/plugins/plots/ecdf_plot.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/ecdf_plot.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/ecdf_plot.rkh	2007-03-18 14:54:32 UTC (rev 1613)
@@ -0,0 +1,33 @@
+<!DOCTYPE rkplugin>
+<document>
+	<summary>
+		Plot an empirical cumulative distribution function.
+	</summary>
+	<usage>
+		Select a variable to plot an ECDF for. The theoretcial normal distribution and a rug can be added to the plot.
+	</usage>
+	<settings>
+		<caption id="tab_variables"/>
+		<setting id="x">The variable to plot the ECDF</setting>
+		<caption id="tab_stepfun_opts"/>
+		<setting id="stepfun_options">Options to change the look of the ECDF plot itself.Refer to <link href="rkward://component/plot_stepfun_options"/> for details.</setting>
+		<caption id="tab_further_opts"/>
+		<setting id="th_pnorm">Should a theoretical normal distribution curve be added to the plot?</setting>
+		<setting id="col_thnorm">Color of the theoretical normal distribution curve.</setting>
+		<setting id="rug">Should a rug be added to the plot?</setting>
+		<setting id="side">Should the rug be added above or below the plot?</setting>
+		<setting id="ticksize">Height of the rug ticks</setting>
+		<setting id="lwd">Line width of the rug ticks</setting>
+		<setting id="col_rug">Color of the rug</setting>
+		<caption id="tab_plot_opts"/>
+		<setting id="plotoptions">Further generic plot options. Refer to <link href="rkward://component/plot_options"/> for details.</setting>
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://component/plot_stepfun_options"/></li>
+			<li><link href="rkward://rhelp/plot.ecdf"/></li>
+			<li><link href="rkward://rhelp/pnorm"/></li>
+			<li><link href="rkward://rhelp/rug"/></li>
+		</ul>
+	</related>
+</document>

Modified: trunk/rkward/rkward/plugins/plots/ecdf_plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/ecdf_plot.xml	2007-03-18 04:56:47 UTC (rev 1612)
+++ trunk/rkward/rkward/plugins/plots/ecdf_plot.xml	2007-03-18 14:54:32 UTC (rev 1613)
@@ -1,15 +1,25 @@
 <!DOCTYPE rkplugin>
 <document>
 	<code file="ecdf_plot.php" />
+	<help file="ecdf_plot.rkh" />
 	<logic>
 		<connect client="plotoptions.xvar" governor="x.available"/>
 		<set id="plotoptions.allow_log" to="false"/>
 		<set id="plotoptions.allow_type" to="false"/>
 		<set id="plotoptions.allow_asp" to="true"/>
+		
+		<set id="stepfun_options.allow_addtoplot" to="false"/>
+		
+		<connect client="col_thnorm.enabled" governor="th_pnorm.state"/>
+		
+		<connect client="side.enabled" governor="rug.state"/>
+		<connect client="ticksize.enabled" governor="rug.state"/>
+		<connect client="lwd.enabled" governor="rug.state"/>
+		<connect client="col_rug.enabled" governor="rug.state"/>
 	</logic>
 	<dialog label="Empirical Distribution Function" >
 		<tabbook>
-			<tab label="Variable(s)" >
+			<tab label="Variable(s)" id="tab_variables">
 				<row>
 					<varselector id="vars" />
 					<column>
@@ -19,41 +29,32 @@
 					<stretch/>
 				</row>
 			</tab>
-			<tab label="Options" >
-				<row>
-					<column>
-						<radio id="dopoints" label="dopoints">
-							<option value="do.points = TRUE" label="Do Points TRUE"/>
-							<option value="do.points = FALSE" label="Do Points FALSE"/>
+			<tab label="Step function options" id="tab_stepfun_opts">
+				<embed id="stepfun_options" component="rkward::plot_stepfun_options" label="Step function plot options"/>
+				<stretch/>
+			</tab>
+			<tab label="Futher options" id="tab_further_opts">
+				<frame label="Theoretical Normal Distribution">
+					<checkbox value_unchecked="0" value="1" checked="true" id="th_pnorm" label="Draw Theoretical Normal Distribution" />
+					<embed id="col_thnorm" component="rkward::color_chooser" label="Color"/>
+				</frame>
+				<frame label="Rug">
+					<checkbox value_unchecked="0" value="1" checked="true" id="rug" label="Add rug to plot" />
+					<row>
+						<radio label="Side of Rug" id="side">
+							<option value="side = 1" label="Rug on bottom" />
+							<option value="side = 3" label="Rug on top" />
 						</radio>
-						<radio id="verticals" label="vertical">
-							<option value="verticals = FALSE" label="Verticals False"/>
-							<option value="verticals = TRUE" label="Verticals TRUE"/>
-						</radio>						
-						<frame label="Theoretical Normal Distribution">
-							<checkbox value_unchecked="0" value="1" checked="true" id="th_pnorm" label="Theoretical Normal Distribution" />
-							<input id="col" initial="red" label="Color of Theoretical Normal Distribution"/>
-							<text>To change the coulor type another like 'blue' (please refere to R-help for more information).
-							</text>
-						</frame>
-						<stretch/>
-					</column>
-					<column>
-						<frame label="Add Rug to Plot">
-							<checkbox value_unchecked="0" value="1" checked="true" id="rug" label="Rug" />
+						<column>
 							<spinbox initial="0.03" id="ticksize" label="Ticksize" />
 							<spinbox initial="0.5" id="lwd" label="Line width of ticks" />
-							<radio label="Side of Rug" id="side">
-								<option value="side = 1" label="Rug on Bottom" />
-								<option value="side = 3" label="Rug on Top" />
-							</radio>
-							<input id="col_rug" initial="black" label="Color of ticks"/>
-						</frame>
-						<stretch/>
-					</column>
-				</row>
+							<embed id="col_rug" component="rkward::color_chooser" label="Color"/>
+						</column>
+					</row>
+				</frame>
+				<stretch/>
 			</tab>
-			<tab label="Title/Axis">
+			<tab label="Title/Axis" id="tab_plot_opts">
 				<column>
 					<embed id="plotoptions" component="rkward::plot_options" as_button="false" label="Plot Options" />
 				</column>

Modified: trunk/rkward/rkward/plugins/plots/plot_stepfun_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_stepfun_options.xml	2007-03-18 04:56:47 UTC (rev 1612)
+++ trunk/rkward/rkward/plugins/plots/plot_stepfun_options.xml	2007-03-18 14:54:32 UTC (rev 1613)
@@ -5,7 +5,7 @@
 	<logic>
 		<external id="varname" default=""/>
 		<external id="allow_addtoplot" default="true"/>
-		<external id="default_verticals" default="true"/>
+		<external id="default_verticals" default="false"/>
 
 		<set id="col_vert.argument" to=", col.vert="/>
 		<set id="col_points.argument" to=", col.points="/>
@@ -13,6 +13,8 @@
 
 		<connect client="addtoplot.visible" governor="allow_addtoplot"/>
 
+		<convert id="default_verticalsb" sources="default_verticals" mode="equals" standard="true"/>
+		<connect client="verticals.state" governor="default_verticalsb"/>
 		<connect client="col_vert.color.enabled" governor="verticals.state"/>
 		<connect client="col_points.color.enabled" governor="do_points.state"/>
 	</logic>

Modified: trunk/rkward/rkward/plugins/plots.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/plots.pluginmap	2007-03-18 04:56:47 UTC (rev 1612)
+++ trunk/rkward/rkward/plugins/plots.pluginmap	2007-03-18 14:54:32 UTC (rev 1613)
@@ -5,7 +5,6 @@
 		<component type="standard" id="barplot" file="barplot.xml" label="Barplot" />
 		<component type="standard" id="box_plot" file="box_plot.xml" label="Box Plot" />
 		<component type="standard" id="density_plot" file="density_plot.xml" label="Density Plot" />
-		<component type="standard" id="ecdf_plot" file="ecdf_plot.xml" label="ECDF Plot" />
 		<component type="standard" id="pareto" file="pareto.xml" label="Pareto Chart" />
 		<component type="standard" id="scatterplot" file="scatterplot.xml" label="Scatterplot" />
 		<component type="standard" id="scatterplot_matrix" file="scatterplot_matrix.xml" label="Scatterplot Matrix" />
@@ -21,7 +20,6 @@
 			<entry component="barplot" />
 			<entry component="box_plot" />
 			<entry component="density_plot" />
-			<entry component="ecdf_plot" />
 			<entry component="pareto" />
 			<entry component="scatterplot" />
 			<entry component="scatterplot_matrix" />

Modified: trunk/rkward/rkward/plugins/under_development.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/under_development.pluginmap	2007-03-18 04:56:47 UTC (rev 1612)
+++ trunk/rkward/rkward/plugins/under_development.pluginmap	2007-03-18 14:54:32 UTC (rev 1613)
@@ -30,6 +30,7 @@
 		<component type="standard" id="stem" file="plots/stem.xml" label="Stem-and-Leaf Plot" />
 
 		<component type="standard" id="plot_stepfun_options" file="plots/plot_stepfun_options.xml" label="Step Function plot options" />
+		<component type="standard" id="ecdf_plot" file="plots/ecdf_plot.xml" label="ECDF Plot" />
 		<component type="standard" id="x11grid" file="x11device/grid.xml" label="Draw Grid" />
 
 	</components>
@@ -66,6 +67,7 @@
 			</menu>
 		</menu>
 		<menu id="plots" label="Plots" index="5">
+			<entry component="ecdf_plot" />
 			<entry component="histogram" />
 			<entry component="stem" />
 		</menu>


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