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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon May 7 20:06:04 UTC 2007


Revision: 1876
          http://svn.sourceforge.net/rkward/?rev=1876&view=rev
Author:   tfry
Date:     2007-05-07 13:06:02 -0700 (Mon, 07 May 2007)

Log Message:
-----------
Convert the remaining continuous distributions plots to using snippets

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh
    trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh
    trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh
    trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh
    trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh
    trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.xml
    trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.php
    trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh
    trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.xml

Modified: trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.php	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.php	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,58 +1,29 @@
 <?
-function preprocess () {
-}
+include ("plot_dist_common.php");
 
-function calculate () {
-}
+function getParameters () {
+	global $options;
 
-function printout () {
-	doPrintout (true);
-}
+	$options['loc'] = getRK_val ("loc");
+	$options['scale'] = getRK_val ("scale");
+	getContRangeParameters ();
 
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
-}
-
-function doPrintout ($final) {
-
-	$fun = getRK_val ("function");
-	$log_option = "";
-	if ($fun == "dlogis") {
-		$label = "density";
-		$lower_tag = "";
-		$tail_tag = "";
-		if (getRK_val ("log")) $log_option = ", log=TRUE";
+	if ($options['is_density']) {
+		$options['fun'] = "dlogis";
 	} else {
-		$label = "distribution";
-		if (getRK_val("lower") == "1") {
-			$lower_tag = ", lower.tail = TRUE";
-			$tail_tag = ", \"Tail\",\"Lower\"";
-		} else {
-			$lower_tag = ", lower.tail = FALSE";
-			$tail_tag = ", \"Tail\",\"Upper\"";
-		}
-		if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+		$options['fun'] = "plogis";
 	}
-	if (getRK_val ("log") == "1") $log_label="logarithmic";
-	else $log_label="normal";
-	$n = getRK_val ("n");
-	$min = getRK_val ("min");
-	$max = getRK_val ("max");
-	$loc = getRK_val ("loc");
-	$scale = getRK_val ("scale");
+}
 
-	if ($final) { ?>
-rk.header ("Logistic <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "Location", "<? echo ($loc); ?>", "Scale", "<? echo ($scale); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+	global $options;
 
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, location = <? echo ($loc); ?>, scale = <? echo ($scale); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+	echo ('rk.header ("Logistic ' . $options['label'] . ' function", list ("Number of Observations", "' . $options['n'] . '", "Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Location", "' . $options['loc'] . '", "Scale", "' . $options['scale'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
 
-<?	if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+	global $options;
+
+	echo ($options['fun'] . '(x, location=' . $options['loc'] . ', scale=' . $options['scale'] . $options['log_option'] . $options['tail_option'] . ')'); 
 }
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.rkh	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,32 +1,27 @@
 <!DOCTYPE rkhelp>
 <document>
+	<snippets>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
+
 	<summary>
 Density and distribution function plots for the Logistic distribution.
 	</summary>
 
-	<usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
-	</usage>
+	<insert snippet="general_usage_help"/>
 
 	<settings>
-		<setting id="function">
-			<li> Density Function, or </li>
-			<li> Distribution Function </li>
-		</setting>
-		<setting id="n">Number of observations (points) for constructing the plot (n).</setting>
-		<setting id="min">Smallest value at which the function is to be plotted.</setting>
-		<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
+		<insert snippet="density_help"/>
+		<insert snippet="cont_range_help"/>
 		<setting id="loc">See R reference on Logistic distribution.</setting>
 		<setting id="scale">See R reference on Logistic distribution.</setting>
-		<setting id="log">See the description given on Plot Beta distribution help page.</setting>
-		<setting id="lower">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="preview">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+		<setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
+		<insert snippet="common_options_help"/>
 	</settings>
+
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/Logistic"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
 			<li><link href="rkward://rhelp/curve"/></li>
 		</ul>

Modified: trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.xml	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_logistic_distribution.xml	2007-05-07 20:06:02 UTC (rev 1876)
@@ -3,44 +3,25 @@
 	<code file="plot_logistic_distribution.php" />
 	<help file="plot_logistic_distribution.rkh" />
 	<logic>
-		<convert id="dodist" mode="equals" sources="function.string" standard="plogis" />
-		<connect client="lower.enabled" governor="dodist" />
-		<set id="plotoptions.allow_log" to="false"/>
+		<insert snippet="common_logic"/>
 	</logic>
+	<snippets>
+		<snippet id="range_options">
+			<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
+			<frame label="Range" >
+				<spinbox default_precision="2" type="real" id="min" initial="-3.29" label="Lower quantile" />
+				<spinbox default_precision="2" type="real" id="max" initial="3.29" label="Upper quantile" />
+			</frame>
+		</snippet>
+		<snippet id="dist_options">
+			<frame label="Parameters">
+				<spinbox default_precision="2" type="real" id="loc" initial="0" label="Location" />
+				<spinbox default_precision="2" type="real" id="scale" initial="1" min="0.01" label="Scale" />
+			</frame>
+		</snippet>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
 	<dialog label="Plot Logistic probabilities" >
-		<tabbook>
-			<tab label="Plot Logistic probabilities" >
-				<row>
-					<column>
-						<row>
-							<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
-						</row>
-						<row>
-							<frame label="Range" >
-								<spinbox default_precision="2" type="real" id="min" initial="-3.29" label="Lower quantile" />
-								<spinbox default_precision="2" type="real" id="max" initial="3.29" label="Upper quantile" />
-							</frame>
-						</row>
-						<row>
-							<frame label="Parameters">
-							<spinbox default_precision="2" type="real" id="loc" initial="0" label="Location" />
-							<spinbox default_precision="2" type="real" id="scale" initial="1" min="0.01" label="Scale" />
-						</frame>
-						</row>
-					</column>
-					<column>
-						<radio id="function" label="Choose type of function plot" >
-							<option value="dlogis" label="Plot density function" />
-							<option value="plogis" label="Plot distribution" />
-						</radio>
-						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
-						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
-						<stretch/>
-						<preview id="preview" label="Preview"/>
-						<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					</column>
-				</row>
-			</tab>
-		</tabbook>
+		<include file="plot_dist_common_dialog_layout.xml"/>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.php	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.php	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,57 +1,29 @@
 <?
-function preprocess () {
-}
+include ("plot_dist_common.php");
 
-function calculate () {
-}
+function getParameters () {
+	global $options;
 
-function printout () {
-	doPrintout (true);
-}
+	$options['sd'] = getRK_val ("sd");
+	$options['mean'] = getRK_val ("mean");
+	getContRangeParameters ();
 
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
+	if ($options['is_density']) {
+		$options['fun'] = "dlnorm";
+	} else {
+		$options['fun'] = "plnorm";
+	}
 }
 
-function doPrintout ($final) {
+function doHeader () {
+	global $options;
 
-	$fun = getRK_val ("function");
-	$log_option = "";
-	if ($fun == "dlnorm") {
-		$label = "density";
-		$lower_tag = "";
-		$tail_tag = "";
-		if (getRK_val ("log")) $log_option = ", log=TRUE";
-	} else {
-		$label = "distribution";
-		if (getRK_val("lower") == "1") {
-			$lower_tag = ", lower.tail = TRUE";
-			$tail_tag = ", \"Tail\",\"Lower\"";
-		} else {
-			$lower_tag = ", lower.tail = FALSE";
-			$tail_tag = ", \"Tail\",\"Upper\"";
-		}
-		if (getRK_val ("log")) $log_option = ", log.p=TRUE";
-	}
-	if (getRK_val ("log") == "1") $log_label="logarithmic";
-	else $log_label="normal";
-	$n = getRK_val ("n");
-	$min = getRK_val ("min");
-	$max = getRK_val ("max");
-	$sd = getRK_val ("sd");
-	$mean = getRK_val ("mean");
-	if ($final) { ?>
-rk.header ("Lognormal <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "Mean", "<? echo ($mean); ?>", "Standard deviation", "<? echo ($sd); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+	echo ('rk.header ("Lognormal ' . $options['label'] . ' function", list ("Number of Observations", "' . $options['n'] . '", "Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Mean", "' . $options['mean'] . '", "Standard deviation", "' . $options['sd'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
 
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, meanlog = <? echo ($mean); ?>, sdlog = <? echo ($sd); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+function doFunCall () {
+	global $options;
 
-<?	if ($final) { ?>
-rk.graph.off ()
-<? }
+	echo ($options['fun'] . '(x, meanlog=' . $options['mean'] . ', sdlog=' . $options['sd'] . $options['log_option'] . $options['tail_option'] . ')');
 }
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.rkh	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,33 +1,28 @@
 <!DOCTYPE rkhelp>
 <document>
+	<snippets>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
+
 	<summary>
 Density and distribution function plots for the Lognormal distribution.
 	</summary>
 
-	<usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
-	</usage>
+	<insert snippet="general_usage_help"/>
 
 	<settings>
-		<setting id="function">
-			<li> Density Function, or </li>
-			<li> Distribution Function </li>
-		</setting>
-		<setting id="n">Number of observations (points) for constructing the plot (n).</setting>
-		<setting id="min">Smallest value at which the function is to be plotted.</setting>
-		<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
+		<insert snippet="density_help"/>
+		<insert snippet="cont_range_help"/>
 		<setting id="mean">See R reference on Lognormal distribution.</setting>
 		<setting id="sd">See R reference on Lognormal distribution.</setting>
-		<setting id="log">See the description given on Plot Beta distribution help page.</setting>
-		<setting id="lower">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="preview">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+		<setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
+		<insert snippet="common_options_help"/>
 	</settings>
+
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/Lognormal"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
 			<li><link href="rkward://rhelp/curve"/></li>
 		</ul>
 	</related>

Modified: trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.xml	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_lognormal_distribution.xml	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,46 +1,27 @@
 <!DOCTYPE rkplugin>
-<!--This is the simple "Plot lognormal probabilities" plugin--><document>
+<document>
 	<code file="plot_lognormal_distribution.php" />
 	<help file="plot_lognormal_distribution.rkh" />
 	<logic>
-		<convert id="dodist" mode="equals" sources="function.string" standard="plnorm" />
-		<connect client="lower.enabled" governor="dodist" />
-		<set id="plotoptions.allow_log" to="false"/>
+		<insert snippet="common_logic"/>
 	</logic>
+	<snippets>
+		<snippet id="range_options">
+			<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
+			<frame label="Range" >
+				<spinbox default_precision="2" type="real" id="min" initial="0.01" min="0.01" label="Lower quantile" />
+				<spinbox default_precision="2" type="real" id="max" initial="3.29" min="0.02" label="Upper quantile" />
+			</frame>
+		</snippet>
+		<snippet id="dist_options">
+			<frame label="Parameters (on log scale)">
+				<spinbox default_precision="2" type="real" id="mean" initial="0" label="Mean" />
+				<spinbox default_precision="2" type="real" id="sd" initial="1" min="0.01" label="Standard deviation" />
+			</frame>
+		</snippet>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
 	<dialog label="Plot Lognormal probabilities" >
-		<tabbook>
-			<tab label="Plot Lognormal probabilities" >
-				<row>
-					<column>
-						<row>
-							<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
-						</row>
-						<row>
-							<frame label="Range" >
-								<spinbox default_precision="2" type="real" id="min" initial="0.01" min="0.01" label="Lower quantile" />
-								<spinbox default_precision="2" type="real" id="max" initial="3.29" min="0.02" label="Upper quantile" />
-							</frame>
-						</row>
-						<row>
-							<frame label="Parameters (on log scale)">
-							<spinbox default_precision="2" type="real" id="mean" initial="0" label="Mean" />
-							<spinbox default_precision="2" type="real" id="sd" initial="1" min="0.01" label="Standard deviation" />
-						</frame>
-						</row>
-					</column>
-					<column>
-						<radio id="function" label="Choose type of function plot" >
-							<option value="dlnorm" label="Plot density function" />
-							<option value="plnorm" label="Plot distribution" />
-						</radio>
-						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
-						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
-						<stretch/>
-						<preview id="preview" label="Preview"/>
-						<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					</column>
-				</row>
-			</tab>
-		</tabbook>
+		<include file="plot_dist_common_dialog_layout.xml"/>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.php	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.php	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,57 +1,29 @@
 <?
-function preprocess () {
-}
+include ("plot_dist_common.php");
 
-function calculate () {
-}
+function getParameters () {
+	global $options;
 
-function printout () {
-	doPrintout (true);
-}
+	$options['mean'] = getRK_val ("mean");
+	$options['sd'] = getRK_val ("sd");
+	getContRangeParameters ();
 
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
-}
-
-function doPrintout ($final) {
-	$fun = getRK_val ("function");
-	$log_option = "";
-	if ($fun == "dnorm") {
-		$label = "density";
-		$lower_tag = "";
-		$tail_tag = "";
-		if (getRK_val ("log")) $log_option = ", log=TRUE";
+	if ($options['is_density']) {
+		$options['fun'] = "dnorm";
 	} else {
-		$label = "distribution";
-		if (getRK_val("lower") == "1") {
-			$lower_tag = ", lower.tail = TRUE";
-			$tail_tag = ", \"Tail\",\"Lower\"";
-		} else {
-			$lower_tag = ", lower.tail = FALSE";
-			$tail_tag = ", \"Tail\",\"Upper\"";
-		}
-		if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+		$options['fun'] = "pnorm";
 	}
-	if (getRK_val ("log") == "1") $log_label="logarithmic";
-	else $log_label="normal";
-	$n = getRK_val ("n");
-	$min = getRK_val ("min");
-	$max = getRK_val ("max");
-	$mean = getRK_val ("mean");
-	$sd = getRK_val ("sd");
+}
 
-	if ($final) { ?>
-rk.header ("Normal <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>", "Upper quantile", "<? echo ($max); ?>", "Mean", "<? echo ($mean); ?>", "Standard Deviation", "<? echo ($sd); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+	global $options;
 
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, mean = <? echo ($mean); ?>, sd = <? echo ($sd); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+	echo ('rk.header ("Normal ' . $options['label'] . ' function", list ("Number of Observations", "' . $options['n'] . '", "Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Mean", "' . $options['mean'] . '", "Standard Deviation", "' . $options['sd'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
 
-<?	if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+	global $options;
+
+	echo ($options['fun'] . '(x, mean=' . $options['mean'] . ', sd=' . $options['sd'] . $options['log_option'] . $options['tail_option'] . ')'); 
 }
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.rkh	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,32 +1,27 @@
 <!DOCTYPE rkhelp>
 <document>
+	<snippets>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
+
 	<summary>
 Density and distribution function plots for the Normal distribution.
 	</summary>
 
-	<usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
-	</usage>
+	<insert snippet="general_usage_help"/>
 
 	<settings>
-		<setting id="function">
-			<li> Density Function, or </li>
-			<li> Distribution Function </li>
-		</setting>
-		<setting id="n">Number of observations (points) for constructing the plot (n).</setting>
-		<setting id="min">Smallest value at which the function is to be plotted.</setting>
-		<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
+		<insert snippet="density_help"/>
+		<insert snippet="cont_range_help"/>
 		<setting id="mean">See R reference on Normal distribution.</setting>
 		<setting id="sd">See R reference on Normal distribution.</setting>
-		<setting id="log">See the description given on Plot Beta distribution help page.</setting>
-		<setting id="lower">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="preview">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+		<setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
+		<insert snippet="common_options_help"/>
 	</settings>
+
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/Normal"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
 			<li><link href="rkward://rhelp/curve"/></li>
 		</ul>

Modified: trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.xml	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_normal_distribution.xml	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,46 +1,27 @@
 <!DOCTYPE rkplugin>
-<!--This is the simple "Plot normal probabilities" plugin--><document>
+<document>
 	<code file="plot_normal_distribution.php" />
 	<help file="plot_normal_distribution.rkh" />
 	<logic>
-		<convert id="dodist" mode="equals" sources="function.string" standard="pnorm" />
-		<connect client="lower.enabled" governor="dodist" />
-		<set id="plotoptions.allow_log" to="false"/>
+		<insert snippet="common_logic"/>
 	</logic>
+	<snippets>
+		<snippet id="range_options">
+			<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
+			<frame label="Range" >
+				<spinbox default_precision="2" type="real" id="min" initial="-3.29" label="Lower quantile" />
+				<spinbox default_precision="2" type="real" id="max" initial="3.29" label="Upper quantile" />
+			</frame>
+		</snippet>
+		<snippet id="dist_options">
+			<frame label="Parameters">
+				<spinbox default_precision="2" type="real" id="mean" initial="0" label="Mean" />
+				<spinbox default_precision="2" type="real" id="sd" min="0.01" initial="1" label="Standard deviation"/>
+			</frame>
+		</snippet>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
 	<dialog label="Plot Normal probabilities" >
-		<tabbook>
-			<tab label="Plot Normal probabilities" >
-				<row>
-					<column>
-						<row>
-							<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
-						</row>
-						<row>
-							<frame label="Range" >
-								<spinbox default_precision="2" type="real" id="min" initial="-3.29" label="Lower quantile" />
-								<spinbox default_precision="2" type="real" id="max" initial="3.29" label="Upper quantile" />
-							</frame>
-						</row>
-						<row>
-							<frame label="Parameter">
-							<spinbox default_precision="2" type="real" id="mean" initial="0" label="Mean" />
-							<spinbox default_precision="2" type="real" id="sd" min="0.01" initial="1" label="Standard deviation"/>
-						</frame>
-						</row>
-					</column>
-					<column>
-						<radio id="function" label="Choose type of function plot" >
-							<option value="dnorm" label="Plot density function" />
-							<option value="pnorm" label="Plot distribution" />
-						</radio>
-						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
-						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
-						<stretch/>
-						<preview id="preview" label="Preview"/>
-						<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					</column>
-				</row>
-			</tab>
-		</tabbook>
+		<include file="plot_dist_common_dialog_layout.xml"/>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.php	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.php	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,60 +1,31 @@
 <?
-function preprocess () {
-}
+include ("plot_dist_common.php");
 
-function calculate () {
-}
+function getParameters () {
+	global $options;
 
-function printout () {
-	doPrintout (true);
-}
+	$options['df'] = getRK_val ("df");
+	$options['nmeans'] = getRK_val ("nmeans");
+	$options['nranges'] = getRK_val ("nranges");
+	getContRangeParameters ();
 
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
-}
-
-function doPrintout ($final) {
-
-// 	$fun = getRK_val ("function");
-	$fun = "ptukey";
-	$log_option = "";
-	if ($fun == "dtukey") {
-		$label = "density";
-		$lower_tag = "";
-		$tail_tag = "";
-		if (getRK_val ("log")) $log_option = ", log=TRUE";
+	if ($options['is_density']) {
+		// actually, this can never happen in this case, but we add it here, for consistency with the other plugins
+		$options['fun'] = "dtukey";
 	} else {
-		$label = "distribution";
-		if (getRK_val("lower") == "1") {
-			$lower_tag = ", lower.tail = TRUE";
-			$tail_tag = ", \"Tail\",\"Lower\"";
-		} else {
-			$lower_tag = ", lower.tail = FALSE";
-			$tail_tag = ", \"Tail\",\"Upper\"";
-		}
-		if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+		$options['fun'] = "ptukey";
 	}
-	if (getRK_val ("log") == "1") $log_label="logarithmic";
-	else $log_label="normal";
-	$n = getRK_val ("n");
-	$min = getRK_val ("min");
-	$max = getRK_val ("max");
-	$df = getRK_val ("df");
-	$nmeans = getRK_val ("nmeans");
-	$nranges = getRK_val ("nranges");
+}
 
-	if ($final) { ?>
-rk.header ("Tukey <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "Sample size for range", "<? echo ($nmeans); ?>", "Degreed of freedom for s", "<? echo ($df); ?>", "Number of groups", "<? echo ($nranges); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+	global $options;
 
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, nmeans = <? echo ($nmeans); ?>, df = <? echo ($df); ?>, nranges = <? echo ($nranges); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+	echo ('rk.header ("Tukey ' . $options['label'] . ' function", list ("Number of Observations", "' . $options['n'] . '", "Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Sample size for range", "' . $options['nmeans'] . '", "Degreed of freedom for s", "' . $options['df'] . '", "Number of groups", "' . $options['nranges'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
 
-<?	if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+	global $options;
+
+	echo ($options['fun'] . '(x, nmeans=' . $options['nmeans'] . ', df=' . $options['df'] . ', nranges=' . $options['nranges'] . $options['log_option'] . $options['tail_option'] . ')'); 
 }
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.rkh	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,30 +1,28 @@
 <!DOCTYPE rkhelp>
 <document>
+	<snippets>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
+
 	<summary>
 Distribution function plot for the Studentized Range (Tukey) distribution.
 	</summary>
 
-	<usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
-	</usage>
+	<insert snippet="general_usage_help"/>
 
 	<settings>
 		<setting id="function">Only the distribution function can be plotted for the Tukey distribution.</setting>
-		<setting id="n">Number of observations (points) for constructing the plot (n).</setting>
-		<setting id="min">Smallest value at which the function is to be plotted.</setting>
-		<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
+		<insert snippet="cont_range_help"/>
 		<setting id="nmeans">See R reference on Tukey distribution.</setting>
 		<setting id="df">See R reference on Tukey distribution.</setting>
 		<setting id="nranges">See R reference on Tukey distribution.</setting>
-		<setting id="log">See the description given on Plot Beta distribution help page.</setting>
-		<setting id="lower">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="preview">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+		<setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
+		<insert snippet="common_options_help"/>
 	</settings>
+
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/Tukey"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
 			<li><link href="rkward://rhelp/curve"/></li>
 		</ul>

Modified: trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.xml	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_tukey_distribution.xml	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,50 +1,41 @@
 <!DOCTYPE rkplugin>
-<!--This is the simple "Plot tukey probabilities" plugin--><document>
+<document>
 	<code file="plot_tukey_distribution.php" />
 	<help file="plot_tukey_distribution.rkh" />
 	<logic>
-		<convert id="disablefunction" mode="range" sources="n.int" max="0" />
-		<connect client="function.enabled" governor="disablefunction" />
-		<convert id="dodist" mode="equals" sources="function.string" standard="ptukey" />
-		<connect client="lower.enabled" governor="dodist" />
-		<set id="plotoptions.allow_log" to="false"/>
+		<set id="function.enabled" to="false" />
+		<set id="function.string" to="p" />
+
+		<insert snippet="common_logic"/>
 	</logic>
+	<snippets>
+		<snippet id="range_options">
+			<spinbox type="integer" id="n" min="2" initial="101" label="Number of Observations" />
+			<frame label="Range" >
+				<spinbox default_precision="2" type="real" id="min" initial="-1" min="-1" label="Lower quantile" />
+				<spinbox default_precision="2" type="real" id="max" initial="8" min="0" label="Upper quantile" />
+			</frame>
+		</snippet>
+		<snippet id="dist_options">
+			<frame label="Parameters">
+				<spinbox type="integer" id="nmeans" min="1" initial="6" label="Sample size for range (same for each group)" />
+				<spinbox default_precision="2" type="real" id="df" initial="5" min="0" label="Degrees of freedom for s" />
+				<spinbox type="integer" id="nranges" min="1" initial="1" label="Number of groups whose maximum range is considered" />
+			</frame>
+		</snippet>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
 	<dialog label="Plot Studentized Range (Tukey) probabilities" >
-		<tabbook>
-			<tab label="Plot Studentized Range (Tukey) probabilities" >
-				<row>
-					<column>
-						<row>
-							<spinbox type="integer" id="n" min="2" initial="101" label="Number of Observations" />
-						</row>
-						<row>
-							<frame label="Range" >
-								<spinbox default_precision="2" type="real" id="min" initial="-1" min="-1" label="Lower quantile" />
-								<spinbox default_precision="2" type="real" id="max" initial="8" min="0" label="Upper quantile" />
-							</frame>
-						</row>
-						<row>
-							<frame label="Parameters">
-							<spinbox type="integer" id="nmeans" min="1" initial="6" label="Sample size for range (same for each group)" />
-							<spinbox default_precision="2" type="real" id="df" initial="5" min="0" label="Degrees of freedom for s" />
-							<spinbox type="integer" id="nranges" min="1" initial="1" label="Number of groups whose maximum range is considered" />
-						</frame>
-						</row>
-					</column>
-					<column>
-						<radio id="function" label="Choose type of function plot" >
-							<option value="dtukey" label="Plot density function" />
-							<option value="ptukey" label="Plot distribution" checked="true"/>
-						</radio>
-						<text>Only the distribution function can be plotted for the Tukey distribution.</text>
-						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
-						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
-						<stretch/>
-						<preview id="preview" label="Preview"/>
-						<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					</column>
-				</row>
-			</tab>
-		</tabbook>
+		<!-- This one looks slightly different from the others -->
+		<row>
+			<column>
+				<insert snippet="range_options"/>
+				<insert snippet="dist_options"/>
+			</column>
+			<column>
+				<text>Only the distribution function can be plotted for the Tukey distribution.</text>
+				<insert snippet="common_options"/>
+			</column>
+		</row>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.php	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.php	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,58 +1,29 @@
 <?
-function preprocess () {
-}
+include ("plot_dist_common.php");
 
-function calculate () {
-}
+function getParameters () {
+	global $options;
 
-function printout () {
-	doPrintout (true);
-}
+	$options['llim'] = getRK_val ("llim");
+	$options['ulim'] = getRK_val ("ulim");
+	getContRangeParameters ();
 
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
-}
-
-function doPrintout ($final) {
-
-	$fun = getRK_val ("function");
-	$log_option = "";
-	if ($fun == "dunif") {
-		$label = "density";
-		$lower_tag = "";
-		$tail_tag = "";
-		if (getRK_val ("log")) $log_option = ", log=TRUE";
+	if ($options['is_density']) {
+		$options['fun'] = "dunif";
 	} else {
-		$label = "distribution";
-		if (getRK_val("lower") == "1") {
-			$lower_tag = ", lower.tail = TRUE";
-			$tail_tag = ", \"Tail\",\"Lower\"";
-		} else {
-			$lower_tag = ", lower.tail = FALSE";
-			$tail_tag = ", \"Tail\",\"Upper\"";
-		}
-		if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+		$options['fun'] = "punif";
 	}
-	if (getRK_val ("log") == "1") $log_label="logarithmic";
-	else $log_label="normal";
-	$n = getRK_val ("n");
-	$min = getRK_val ("min");
-	$max = getRK_val ("max");
-	$llim = getRK_val ("llim");
-	$ulim = getRK_val ("ulim");
+}
 
-	if ($final) { ?>
-rk.header ("Uniform <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "Domain", "[<? echo ($llim); ?>, <? echo ($ulim); ?>]", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+	global $options;
 
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, min = <? echo ($llim); ?>, max = <? echo ($ulim); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+	echo ('rk.header ("Uniform ' . $options['label'] . ' function", list ("Number of Observations", "' . $options['n'] . '", "Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Minimum", "' . $options['llim'] . '", "Maximum", "' . $options['ulim'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
 
-<?	if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+	global $options;
+
+	echo ($options['fun'] . '(x, min=' . $options['llim'] . ', max=' . $options['ulim'] . $options['log_option'] . $options['tail_option'] . ')'); 
 }
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.rkh	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,32 +1,27 @@
 <!DOCTYPE rkhelp>
 <document>
+	<snippets>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
+
 	<summary>
 Density and distribution function plots for the Uniform distribution.
 	</summary>
 
-	<usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
-	</usage>
+	<insert snippet="general_usage_help"/>
 
 	<settings>
-		<setting id="function">
-			<li> Density Function, or </li>
-			<li> Distribution Function </li>
-		</setting>
-		<setting id="n">Number of observations (points) for constructing the plot (n).</setting>
-		<setting id="min">Smallest value at which the function is to be plotted.</setting>
-		<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
+		<insert snippet="density_help"/>
+		<insert snippet="cont_range_help"/>
 		<setting id="llim">See R reference on Uniform distribution.</setting>
 		<setting id="ulim">See R reference on Uniform distribution.</setting>
-		<setting id="log">See the description given on Plot Beta distribution help page.</setting>
-		<setting id="lower">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="preview">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+		<setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
+		<insert snippet="common_options_help"/>
 	</settings>
+
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/Uniform"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
 			<li><link href="rkward://rhelp/curve"/></li>
 		</ul>

Modified: trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.xml	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_uniform_distribution.xml	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,46 +1,27 @@
 <!DOCTYPE rkplugin>
-<!--This is the simple "Plot uniform probabilities" plugin--><document>
+<document>
 	<code file="plot_uniform_distribution.php" />
 	<help file="plot_uniform_distribution.rkh" />
 	<logic>
-		<convert id="dodist" mode="equals" sources="function.string" standard="punif" />
-		<connect client="lower.enabled" governor="dodist" />
-		<set id="plotoptions.allow_log" to="false"/>
+		<insert snippet="common_logic"/>
 	</logic>
+	<snippets>
+		<snippet id="range_options">
+			<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
+			<frame label="Range" >
+				<spinbox default_precision="2" type="real" id="min" initial="-1" label="Lower quantile" />
+				<spinbox default_precision="2" type="real" id="max" initial="2" label="Upper quantile" />
+			</frame>
+		</snippet>
+		<snippet id="dist_options">
+			<frame label="Parameters">
+				<spinbox default_precision="2" type="real" id="llim" initial="0" label="Minimum" />
+				<spinbox default_precision="2" type="real" id="ulim" initial="1" label="Maximum" />
+			</frame>
+		</snippet>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
 	<dialog label="Plot Uniform probabilities" >
-		<tabbook>
-			<tab label="Plot Uniform probabilities" >
-				<row>
-					<column>
-						<row>
-							<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
-						</row>
-						<row>
-							<frame label="Range" >
-								<spinbox default_precision="2" type="real" id="min" initial="-1" label="Lower quantile" />
-								<spinbox default_precision="2" type="real" id="max" initial="2" label="Upper quantile" />
-							</frame>
-						</row>
-						<row>
-							<frame label="Parameters">
-							<spinbox default_precision="2" type="real" id="llim" initial="0" label="Minimum" />
-							<spinbox default_precision="2" type="real" id="ulim" initial="1" label="Maximum" />
-						</frame>
-						</row>
-					</column>
-					<column>
-						<radio id="function" label="Choose type of function plot" >
-							<option value="dunif" label="Plot density function" />
-							<option value="punif" label="Plot distribution" />
-						</radio>
-						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
-						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
-						<stretch/>
-						<preview id="preview" label="Preview"/>
-						<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					</column>
-				</row>
-			</tab>
-		</tabbook>
+		<include file="plot_dist_common_dialog_layout.xml"/>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.php	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.php	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,58 +1,29 @@
 <?
-function preprocess () {
-}
+include ("plot_dist_common.php");
 
-function calculate () {
-}
+function getParameters () {
+	global $options;
 
-function printout () {
-	doPrintout (true);
-}
+	$options['scale'] = getRK_val ("scale");
+	$options['shape'] = getRK_val ("shape");
+	getContRangeParameters ();
 
-function preview () {
-	preprocess ();
-	calculate ();
-	doPrintout (false);
-}
-
-function doPrintout ($final) {
-
-	$fun = getRK_val ("function");
-	$log_option = "";
-	if ($fun == "dweibull") {
-		$label = "density";
-		$lower_tag = "";
-		$tail_tag = "";
-		if (getRK_val ("log")) $log_option = ", log=TRUE";
+	if ($options['is_density']) {
+		$options['fun'] = "dweibull";
 	} else {
-		$label = "distribution";
-		if (getRK_val("lower") == "1") {
-			$lower_tag = ", lower.tail = TRUE";
-			$tail_tag = ", \"Tail\",\"Lower\"";
-		} else {
-			$lower_tag = ", lower.tail = FALSE";
-			$tail_tag = ", \"Tail\",\"Upper\"";
-		}
-		if (getRK_val ("log")) $log_option = ", log.p=TRUE";
+		$options['fun'] = "pweibull";
 	}
-	if (getRK_val ("log") == "1") $log_label="logarithmic";
-	else $log_label="normal";
-	$n = getRK_val ("n");
-	$min = getRK_val ("min");
-	$max = getRK_val ("max");
-	$scale = getRK_val ("scale");
-	$shape = getRK_val ("shape");
+}
 
-	if ($final) { ?>
-rk.header ("Weibull <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "Shape", "<? echo ($shape); ?>", "Scale", "<? echo ($scale); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
+function doHeader () {
+	global $options;
 
-rk.graph.on ()
-<? }
-?>
-try (curve (<? echo ($fun); ?> (x, shape = <? echo ($shape); ?>, scale = <? echo ($scale); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
+	echo ('rk.header ("Weibull ' . $options['label'] . ' function", list ("Number of Observations", "' . $options['n'] . '", "Lower quantile", "' . $options['min'] . '", "Upper quantile", "' . $options['max'] . '", "Shape", "' . $options['shape'] . '", "Scale", "' . $options['scale'] . '"' . $options['log_label'] . $options['tail_label'] . ', "Function", "' . $options['fun'] . '"));' . "\n");
+}
 
-<?	if ($final) { ?>
-rk.graph.off ()
-<? }
+function doFunCall () {
+	global $options;
+
+	echo ($options['fun'] . '(x, shape=' . $options['shape'] . ', scale=' . $options['scale'] . $options['log_option'] . $options['tail_option'] . ')');
 }
 ?>

Modified: trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.rkh	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,32 +1,27 @@
 <!DOCTYPE rkhelp>
 <document>
+	<snippets>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
+
 	<summary>
 Density and distribution function plots for the Weibull distribution.
 	</summary>
 
-	<usage>
-Choose appropriate values for the various parameters of the distribution and select the type of function. The "Submit" button will export the plot to the "Output" window. To dynamically visualise the plot check the "Preview" box.
-	</usage>
+	<insert snippet="general_usage_help"/>
 
 	<settings>
-		<setting id="function">
-			<li> Density Function, or </li>
-			<li> Distribution Function </li>
-		</setting>
-		<setting id="n">Number of observations (points) for constructing the plot (n).</setting>
-		<setting id="min">Smallest value at which the function is to be plotted.</setting>
-		<setting id="max">Largest value at which the function is to be plotted. So, the function will be evaluated at 'n' equally spaced points between the lower quantile and the upper quantile (inclusive of end points).</setting>
+		<insert snippet="density_help"/>
+		<insert snippet="cont_range_help"/>
 		<setting id="shape">See R reference on Weibull distribution.</setting>
 		<setting id="scale">See R reference on Weibull distribution.</setting>
-		<setting id="log">See the description given on Plot Beta distribution help page.</setting>
-		<setting id="lower">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="preview">See the description given on Plot Beta  distribution help page.</setting>
-		<setting id="plotoptions">Various plotting parameter settings for the plot. See the help page of "Plot Options" for more details.</setting>
+		<setting id="ncp">Non-centrality parameter of the Beta distribution.</setting>
+		<insert snippet="common_options_help"/>
 	</settings>
+
 	<related>
 		<ul>
 			<li><link href="rkward://rhelp/Weibull"/></li>
-			<li><link href="rkward://component/plot_beta_distribution"/></li>
 			<li><link href="rkward://component/plot_options"/></li>
 			<li><link href="rkward://rhelp/curve"/></li>
 		</ul>

Modified: trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.xml
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.xml	2007-05-07 19:04:49 UTC (rev 1875)
+++ trunk/rkward/rkward/plugins/distributions/plot_weibull_distribution.xml	2007-05-07 20:06:02 UTC (rev 1876)
@@ -1,46 +1,27 @@
 <!DOCTYPE rkplugin>
-<!--This is the simple "Plot weibullprobabilities" plugin--><document>
+<document>
 	<code file="plot_weibull_distribution.php" />
 	<help file="plot_weibull_distribution.rkh" />
 	<logic>
-		<convert id="dodist" mode="equals" sources="function.string" standard="pweibull" />
-		<connect client="lower.enabled" governor="dodist" />
-		<set id="plotoptions.allow_log" to="false"/>
+		<insert snippet="common_logic"/>
 	</logic>
+	<snippets>
+		<snippet id="range_options">
+			<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
+			<frame label="Range" >
+				<spinbox default_precision="2" type="real" id="min" initial="0" min="0" label="Lower quantile" />
+				<spinbox default_precision="2" type="real" id="max" initial="5" min="0" label="Upper quantile" />
+			</frame>
+		</snippet>
+		<snippet id="dist_options">
+			<frame label="Parameters">
+				<spinbox default_precision="2" type="real" id="shape" initial="2" min ="0.01" label="Shape" />
+				<spinbox default_precision="2" type="real" id="scale" initial="1" min ="0.01" label="Scale" />
+			</frame>
+		</snippet>
+		<include file="plot_dist_common_snippets.xml"/>
+	</snippets>
 	<dialog label="Plot Weibull probabilities" >
-		<tabbook>
-			<tab label="Plot Weibull probabilities" >
-				<row>
-					<column>
-						<row>
-							<spinbox type="integer" id="n" min="2" initial="100" label="Number of Observations" />
-						</row>
-						<row>
-							<frame label="Range" >
-								<spinbox default_precision="2" type="real" id="min" initial="0" min="0" label="Lower quantile" />
-								<spinbox default_precision="2" type="real" id="max" initial="5" min="0" label="Upper quantile" />
-							</frame>
-						</row>
-						<row>
-							<frame label="Parameter">
-							<spinbox default_precision="2" type="real" id="shape" initial="2" min ="0.01" label="Shape" />
-							<spinbox default_precision="2" type="real" id="scale" initial="1" min ="0.01" label="Scale" />
-						</frame>
-						</row>
-					</column>
-					<column>
-						<radio id="function" label="Choose type of function plot" >
-							<option value="dweibull" label="Plot density function" />
-							<option value="pweibull" label="Plot distribution" />
-						</radio>
-						<checkbox id="log" label="Logarithmic" value="1" value_unchecked="0"/>
-						<checkbox id="lower" label="Lower Tail" value="1" value_unchecked="0" checked="true"/>
-						<stretch/>
-						<preview id="preview" label="Preview"/>
-						<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
-					</column>
-				</row>
-			</tab>
-		</tabbook>
+		<include file="plot_dist_common_dialog_layout.xml"/>
 	</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