[rkward-cvs] SF.net SVN: rkward:[2749] trunk/rkward/rkward/plugins/plots
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Feb 21 11:40:25 UTC 2010
Revision: 2749
http://rkward.svn.sourceforge.net/rkward/?rev=2749&view=rev
Author: tfry
Date: 2010-02-21 11:40:24 +0000 (Sun, 21 Feb 2010)
Log Message:
-----------
Finish porting plot plugins to JS
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/piechart.js
trunk/rkward/rkward/plugins/plots/plot.xml
trunk/rkward/rkward/plugins/plots/scatterplot.js
trunk/rkward/rkward/plugins/plots/scatterplot.xml
Removed Paths:
-------------
trunk/rkward/rkward/plugins/plots/pareto.php
trunk/rkward/rkward/plugins/plots/piechart.php
trunk/rkward/rkward/plugins/plots/plot.php
trunk/rkward/rkward/plugins/plots/plot_stepfun_options.php
trunk/rkward/rkward/plugins/plots/scatterplot.php
trunk/rkward/rkward/plugins/plots/scatterplot_matrix.php
trunk/rkward/rkward/plugins/plots/sieve_plot.php
trunk/rkward/rkward/plugins/plots/stem.php
trunk/rkward/rkward/plugins/plots/stripchart_plot.php
Deleted: trunk/rkward/rkward/plugins/plots/pareto.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/pareto.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/pareto.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,53 +0,0 @@
-<?
-function preprocess () { ?>
-require(qcc)
-<? if (getRK_val ("descriptives")=="TRUE") { ?>
-require(xtable)
-<? }
-}
-
-function calculate () {
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- $vars = getRK_val ("x");
- $descriptives = getRK_val ("descriptives")=="TRUE";
- $tabulate= getRK_val ("tabulate")=="TRUE";
-
-if($tabulate) {?>
-x <- table (<? echo ($vars); ?>, exclude=NULL)
-<? } else { ?>
-x <- <? echo ($vars); ?>
-
-if (!is.numeric (x)) {
- warning ("Data may not be numeric, but proceeding as requested.\nDid you forget to check the tabulate option?")
-}
-<? } ?>
-
-<? if ($final) { ?>
-rk.header ("Pareto chart")
-
-rk.graph.on ()
-<? }
-?>
-try ({
- descriptives <- pareto.chart(x<? getRK ("plotoptions.code.printout"); ?>)
-<? if ($final && $descriptives) { ?>
- rk.results(xtable(descriptives))
-<? } ?>
-})
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
-}
-?>
Modified: trunk/rkward/rkward/plugins/plots/piechart.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.js 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/piechart.js 2010-02-21 11:40:24 UTC (rev 2749)
@@ -37,7 +37,7 @@
options += ", angle =" + angle;
if (angle_inc != 0) options += " + " + angle_inc + " * 0:length (x)";
}
- if (radius != 0+8) options += ", radius=" + radius;
+ 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 += getValue ("plotoptions.code.printout");
Deleted: trunk/rkward/rkward/plugins/plots/piechart.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/piechart.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/piechart.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,87 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- $vars = getRK_val ("x");
- $tabulate= getRK_val ("tabulate");
- if ($tabulate) {
- $tabulate_header = '"Tabulate", "Yes"';
- } else {
- $tabulate_header = '"Tabulate", "No"';
- }
- $radius = getRK_val ("radius");
- $angle = getRK_val ("angle");
- $angle_inc = getRK_val ("angle_inc");
- $density = getRK_val ("density");
- $density_inc = getRK_val ("density_inc");
- $col = getRK_val ("colors");
- $clockwise = getRK_val ("clockwise");
- if ($clockwise) {
- $clockwise_header = '"Clockwise", "Yes"';
- } else {
- $clockwise_header = '"Clockwise", "No"';
- }
- $names_mode = getRK_val ("names_mode");
-
- $options = "";
- $options .= ", clockwise =" . $clockwise;
- if (($density >= 0) || ($density_inc != 0)) $options .= ", density =" . $density;
- if ($density_inc != 0) $options .= "+ $density_inc * 0:length (x)";
- if (($density > 0) || $density_inc != 0) {
- $options .= ", angle =" . $angle;
- if ($angle_inc != 0) $options .= "+ $angle_inc * 0:length (x)";
- }
- 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 { ?>
-x <- <? echo ($vars); ?>
-
-if (!is.numeric (x)) {
- warning ("Data may not be numeric, but proceeding as requested.\nDid you forget to check the tabulate option?")
-}
-<? } ?>
-
-<? if ($final) { ?>
-rk.header ("Pie chart", parameters=list ("Variable", rk.get.description (<? echo ($vars); ?>), <? echo ($tabulate_header); ?>, <? echo ($clockwise_header); ?>))
-
-rk.graph.on ()
-<? }
-?>
-try ({
-<? if (!empty ($plotpre)) printIndented ("\t", $plotpre);
- 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");
- }
-?>
- pie(x<? echo ($options); ?>)
-<? if (!empty ($plotpost)) printIndented ("\t", $plotpost); ?>
-})
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
-}
-?>
Deleted: trunk/rkward/rkward/plugins/plots/plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/plot.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,50 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- $x = getRK_val ("xvarslot");
- $y = getRK_val ("yvarslot");
- if (!($y == "")) {
- $y = ", " . $y;
- }
- // get additional code (as of now grid) from the calculate section
- $plot_adds = getRK_val ("plotoptions.code.calculate");
-
- if ($final) {
-?>
-rk.header ("Generic Plot")
-rk.graph.on ()
-<?
- }
-?>
-try({
- plot(<? echo ($x . $y . getRK_val ("plotoptions.code.printout")); ?>);
-<? if (!empty ($plot_adds)) { ?>
-
-<? // print the grid() related code
- printIndented ("\t", $plot_adds);
- }
-?>
-})
-<?
- if ($final) {
-?>
-rk.graph.off ()
-<?
- }
-}
-?>
Modified: trunk/rkward/rkward/plugins/plots/plot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot.xml 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/plot.xml 2010-02-21 11:40:24 UTC (rev 2749)
@@ -15,14 +15,12 @@
<column>
<varslot id="xvarslot" source="vars" required="true" label="X variable"/>
<varslot id="yvarslot" source="vars" required="false" label="Y variable"/>
+ <embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot Options" />
<stretch/>
<preview id="preview"/>
</column>
</row>
</tab>
- <tab label="Plot Options" id="tab_options">
- <embed id="plotoptions" component="rkward::plot_options" label="Various plot options"/>
- </tab>
</tabbook>
</dialog>
Deleted: trunk/rkward/rkward/plugins/plots/plot_stepfun_options.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_stepfun_options.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/plot_stepfun_options.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,42 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-}
-
-function printout () {
- $options = "";
-
- $addtoplot = getRK_val ("addtoplot");
- if ($addtoplot) $options .= ', add=TRUE';
-
- $lty = getRK_val ("linetype");
- if (!($lty == "")) $options .= ", lty=\"{$lty}\"";
-
- $verticals = getRK_val ("verticals");
- if ($verticals) {
- $options .= ', verticals=TRUE' . getRK_val ("col_vert.code.printout");
- } else $options .= ', verticals=FALSE';
-
- $do_points = getRK_val ("do_points");
- if ($do_points) {
- $options .= getRK_val ("col_points.code.printout");
- } else $options .= ', do.points=FALSE';
-
- $col_hor = getRK_val ("col_hor.code.printout");
- if (!($col_hor == "")) $options .= getRK_val ("col_hor.code.printout");
-
- if (getRK_val ("allow_col01line")) {
- $col_y0 = getRK_val ("col_y0.code.printout");
- $col_y1 = getRK_val ("col_y1.code.printout");
- if (($col_y0 != "") && ($col_y1 != "")) {
- $options .= ", col.01line=c({$col_y0},{$col_y1})";
- } elseif (($col_y0 != "") || ($col_y1 != "")) {
- $options .= ", col.01line={$col_y0}{$col_y1}";
- } // col.01line option to plot.ecdf()
- }
-
- echo ($options);
-}
-?>
Modified: trunk/rkward/rkward/plugins/plots/scatterplot.js
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot.js 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/scatterplot.js 2010-02-21 11:40:24 UTC (rev 2749)
@@ -25,9 +25,9 @@
echo (' stop("Unequal number of X and Y variables given")\n');
echo ('}\n');
-// find range of X/Y values needed
- echo ('Xrange <- range (c (Xvars), na+rm=TRUE)\n');
- echo ('Yrange <- range (c (Yvars), na+rm=TRUE)\n');
+ echo ('# find range of X/Y values needed\n');
+ echo ('Xrange <- range (c (Xvars), na.rm=TRUE)\n');
+ echo ('Yrange <- range (c (Yvars), na.rm=TRUE)\n');
echo ('\n');
echo ('type <- rep (' + type + ', length.out=length (Xvars));\n');
echo ('col <- rep (' + col + ', length.out=length (Xvars));\n');
Deleted: trunk/rkward/rkward/plugins/plots/scatterplot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/scatterplot.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,82 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
- global $x, $y;
- $x = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
- $y = str_replace ("\n", ",", trim (getRK_val ("y"))) ;
-
- if (getRK_val ("manual_type") == "true") {
- $type = getRK_val ("custom_type");
- } else {
- $type = "c ('" . getRK_val ("pointtype") . "')";
- }
- $col = getRK_val ("col");
- $pch = getRK_val ("pch");
- $cex = getRK_val ("cex");
-?>
-
-<? #input ?>
-Xvars <- list(<? echo ($x) ;?>)
-Yvars <- list(<? echo ($y) ;?>)
-
-<? # verification (is this needed?) ?>
-if (length(Xvars) != length(Yvars)) {
- stop("Unequal number of X and Y variables given")
-}
-
-# find range of X/Y values needed
-Xrange <- range (c (Xvars), na.rm=TRUE)
-Yrange <- range (c (Yvars), na.rm=TRUE)
-
-type <- rep (<? echo ($type); ?>, length.out=length (Xvars));
-col <- rep (<? echo ($col); ?>, length.out=length (Xvars));
-cex <- rep (<? echo ($cex); ?>, length.out=length (Xvars));
-pch <- rep (<? echo ($pch); ?>, length.out=length (Xvars));
-<?
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- global $x, $y;
-
- if ($final) { ?>
-rk.header ("Scatterplot", parameters = list (
- "X variables"=paste (rk.get.description (<?echo ($x); ?>), collapse=", "),
- "Y variables"=paste (rk.get.description (<?echo ($y); ?>), collapse=", ")))
-
-rk.graph.on()
-
-<? } ?>
-try ({
- # make frame and axes
- plot(Xrange, Yrange, type="n"<? getRK ("plotoptions.code.printout"); ?>)
-
- # plot variables one X/Y pair at a time
- for (i in 1:length(Xvars)) {
- points (
- Xvars[[i]],
- Yvars[[i]],
- type = type[[i]],
- col = col[[i]],
- cex = cex[[i]],
- pch = pch[[i]]
- )
- }
-})
-<? if ($final) { ?>
-
-rk.graph.off()
-<? }
-}
-?>
Modified: trunk/rkward/rkward/plugins/plots/scatterplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot.xml 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/scatterplot.xml 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,6 +1,6 @@
<!DOCTYPE rkplugin>
<document>
- <code file="scatterplot.php"/>
+ <code file="scatterplot.js"/>
<!--Adrien d'Hardemare
first attempt to produce simple plot using the plot function
Deleted: trunk/rkward/rkward/plugins/plots/scatterplot_matrix.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot_matrix.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/scatterplot_matrix.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,36 +0,0 @@
-<?
-function preprocess () {
-?>
-require(car)
-<?
-}
-
-function calculate () {
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- $vars = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
-?>
-data <- data.frame (<? echo ($vars); ?>)
-
-<? if ($final) { ?>
-rk.header ("Scatterplot Matrix", parameters=list ("Diagonal Panels", "<? getRK("diag") ?>", "Plot points", "<? getRK ("plot_points"); ?>", "Smooth", "<? getRK ("smooth"); ?>", "Ellipses", "<? getRK ("ellipse"); ?> at 0.5 and 0.9 levels."))
-
-rk.graph.on ()
-<? } ?>
-try (scatterplot.matrix(data, diagonal="<? getRK("diag") ?>", plot.points=<? getRK ("plot_points"); ?>, smooth=<? getRK ("smooth"); ?>, ellipse=<? getRK ("ellipse"); ?>))
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
-}
-?>
Deleted: trunk/rkward/rkward/plugins/plots/sieve_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/sieve_plot.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/sieve_plot.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,44 +0,0 @@
-<?
-function preprocess () { ?>
-require(vcd)
-<? }
-
-function calculate () {
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- $vars = getRK_val ("x");
- $shade = getRK_val ("shade");
- $sievetype = getRK_val ("sievetype");
-{ ?>
-x <- <? echo ($vars); ?>
-<? } ?>
-
-<? if ($final) { ?>
-rk.header ("Extended Sieve Plot", parameters=list ("Variable", rk.get.description (<? echo ($vars); ?>), "shade", <? echo ($shade); ?>))
-
-rk.graph.on ()
-<? }
-?>
-try ({
-<? if (!empty ($plotpre)) printIndented ("\t", $plotpre);
-
-?>
- sieve(x, shade = <? echo ($shade); ?>, sievetype = "<? echo ($sievetype); ?>" <? getRK ("plotoptions.code.printout"); ?>)
-<? if (!empty ($plotpost)) printIndented ("\t", $plotpost); ?>
-})
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
-}
-?>
Deleted: trunk/rkward/rkward/plugins/plots/stem.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/stem.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/stem.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,20 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-}
-
-function printout () {
- $x = getRK_val ("x");
- $scale = getRK_val ("scale");
- $width = getRK_val ("width");
- $atom = getRK_val ("atom");
-?>
-rk.header ("Stem-and-Leaf Plot",
- parameters=list ("Variable", paste (rk.get.description (<? echo ($x); ?>)), "Plot Length", "<? echo ($scale); ?>","Plot Width", "<? echo ($width); ?>", "Tolerance", "<? echo ($atom); ?>"))
-
-rk.print.literal(capture.output(stem(<? echo ($x); ?>, scale = <? echo ($scale); ?>, width = <? echo ($width); ?>, atom = <? echo ($atom); ?>)))
-<?
-}
-?>
Deleted: trunk/rkward/rkward/plugins/plots/stripchart_plot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/stripchart_plot.php 2010-02-21 11:33:36 UTC (rev 2748)
+++ trunk/rkward/rkward/plugins/plots/stripchart_plot.php 2010-02-21 11:40:24 UTC (rev 2749)
@@ -1,49 +0,0 @@
-<?
-function preprocess () {
-}
-
-function calculate () {
-}
-
-function printout () {
- doPrintout (true);
-}
-
-function preview () {
- preprocess ();
- calculate ();
- doPrintout (false);
-}
-
-function doPrintout ($final) {
- $x = getRK_val ("x");
- $g = getRK_val ("g");
- $method = '"' . getRK_val ("method") . '"';
- if ($method == "\"jitter\"") {
- $opts .= ", jitter = " . getRK_val ("jitter");
- $params .= ", \"Jitter\" = " . getRK_val ("jitter");
- } else if ($method == "\"stack\"") {
- $opts .= ", offset = " . getRK_val ("offset");
- $params .= ", \"Offset\" = " . getRK_val ("offset");
- }
- $orientation = getRK_val ("orientation");
- if ($orientation == "Vertical") $opts .= ", vertical = TRUE";
- $plot_adds = getRK_val ("plotoptions.code.calculate"); //add grid and alike
-
- if ($final) { ?>
-rk.header ("Stripchart", list ("Variable"=rk.get.description (<? echo ($x); ?>), "Group"=rk.get.description (<? echo ($g); ?>), "Method"=<? echo ($method); echo ($params); ?>, "Orientation"="<? echo ($orientation); ?>"))
-
-rk.graph.on ()
-<? } ?>
-try (stripchart (<? echo ($x); ?> ~ (<? echo ($g); ?>), method = <? echo ($method); echo ($opts); getRK ("plotoptions.code.printout"); ?>))
-<? if (!empty ($plot_adds)) { ?>
-
-<? // print the grid() related code
- printIndented ("\t", $plot_adds);
- }
-?>
-<? if ($final) { ?>
-rk.graph.off ()
-<? }
-}
-?>
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