[rkward-cvs] SF.net SVN: rkward: [1242] trunk/rkward/rkward/plugins/plots
nono_231 at users.sourceforge.net
nono_231 at users.sourceforge.net
Mon Jan 29 16:28:08 UTC 2007
Revision: 1242
http://svn.sourceforge.net/rkward/?rev=1242&view=rev
Author: nono_231
Date: 2007-01-29 08:28:08 -0800 (Mon, 29 Jan 2007)
Log Message:
-----------
Added preview option. Corrected barplot title.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/plots/barplot.php
trunk/rkward/rkward/plugins/plots/barplot.xml
trunk/rkward/rkward/plugins/plots/cor_graph.php
trunk/rkward/rkward/plugins/plots/cor_graph.xml
Modified: trunk/rkward/rkward/plugins/plots/barplot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.php 2007-01-29 13:55:18 UTC (rev 1241)
+++ trunk/rkward/rkward/plugins/plots/barplot.php 2007-01-29 16:28:08 UTC (rev 1242)
@@ -1,49 +1,60 @@
<?
- function preprocess () {
+function preprocess () {
}
- function calculate () {
+function calculate () {
}
- function printout () {
+function printout () {
+ doPrintout (true);
+}
+
+function cleanup () {
+ ?>
+rm (list=grep ("^rk.temp", ls (), value=TRUE))
+ <?
+ }
+
+function preview () {
+ preprocess ();
+ calculate ();
+ doPrintout (false); // only this one actually needed...
+ cleanup ();
+}
+
+function doPrintout ($final) {
$vars = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
- ?>
+?>
rk.temp.x <- (<? echo ($vars); ?>)
if(is.factor(rk.temp.x)) rk.temp.x=summary(rk.temp.x)
+<?
+ if ($final) { ?>
rk.header ("Barplot", parameters=list ("Rainbow colors", "<? getRK ("rainbow"); ?>", "Beside", "<? getRK ("beside"); ?>", "Legend", "<? getRK ("legend"); ?>"))
rk.graph.on ()
+<? }
+?>
try ({
<?
if (getRK_val ("beside") == "TRUE") {
?>
-rk.temp.barplot <-barplot((rk.temp.x)<? if (getRK_val ("rainbow")=="TRUE") { ?>,
-col=rainbow(rk.temp.x) <? } ?>, beside=<? getRK ("beside"); ?>, legend.text=<?
-getRK ("legend"); ?>, ylim = range(rk.temp.x) * c(0, 1.2))
+rk.temp.barplot <-barplot((rk.temp.x)<? if (getRK_val ("rainbow")=="TRUE") { ?>, col=rainbow(rk.temp.x) <? } ?>, beside=<? getRK ("beside"); ?>, legend.text=<? getRK ("legend"); ?>, ylim = range(rk.temp.x) * c(0, 1.2))
<?
}
if ((getRK_val ("beside") == "TRUE") && getRK_val ("labels")=="TRUE") {
?>
-text(rk.temp.barplot, rk.temp.x, labels=rk.temp.x, pos=<? getRK ("place"); ?>,
-offset=.5)
+text(rk.temp.barplot, rk.temp.x, labels=rk.temp.x, pos=<? getRK ("place"); ?>, offset=.5)
<? }
if (getRK_val ("beside") == "FALSE") {
?>
-barplot((rk.temp.x)<? if (getRK_val ("rainbow")=="TRUE") { ?>,
-col=rainbow(rk.temp.x) <? } ?>, legend.text=<? getRK ("legend"); ?>)
+barplot((rk.temp.x)<? if (getRK_val ("rainbow")=="TRUE") { ?>, col=rainbow(rk.temp.x) <? } ?>, legend.text=<? getRK ("legend"); ?>)
<? }
?>
})
+<? if ($final) { ?>
rk.graph.off ()
-
-<?
- }
-
- function cleanup () {
- ?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
- <?
- }
+<? }
+}
?>
Modified: trunk/rkward/rkward/plugins/plots/barplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.xml 2007-01-29 13:55:18 UTC (rev 1241)
+++ trunk/rkward/rkward/plugins/plots/barplot.xml 2007-01-29 16:28:08 UTC (rev 1242)
@@ -9,13 +9,14 @@
<convert id="labelsvalue2" mode="and" sources="labelsvalue;labels.enabled" />
<connect client="place.enabled" governor="labelsvalue2" />
</logic>
- <dialog label="Correlation Matrix Plot" >
+ <dialog label="Barplot" >
<tabbook>
<tab label="Variables" id="tab_variables">
<row>
<varselector id="vars"/>
<column>
<varslot min_vars="1" id="x" source="vars" required="true" label="Matrix, Vector or Factor"/>
+ <preview id="preview"/>
</column>
</row>
</tab>
Modified: trunk/rkward/rkward/plugins/plots/cor_graph.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.php 2007-01-29 13:55:18 UTC (rev 1241)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.php 2007-01-29 16:28:08 UTC (rev 1242)
@@ -1,5 +1,5 @@
<?
- function preprocess () { ?>
+function preprocess () { ?>
rk.temp.cor.graph <- function(x) {
panel.cor <- function(x, y, digits=<? getRK ("digits"); ?>, cex.cor, use="<? getRK ("use"); ?>", method="<? getRK ("method"); ?>", scale=<? getRK ("scale"); ?>) {
usr <- par("usr"); on.exit(par(usr))
@@ -21,30 +21,48 @@
pairs(x, lower.panel=panel.smooth, upper.panel=panel.cor)
}
<?
+}
+
+function calculate () {
+}
+
+function printout () {
+ doPrintout (true);
+}
+
+function cleanup () { ?>
+rm(rk.temp.cor.graph, rk.temp.x)
+<?
}
- function calculate () {
- }
+function preview () {
+ preprocess ();
+ calculate ();
+ doPrintout (false); // only this one actually needed...
+ cleanup ();
+}
- function printout () {
+function doPrintout ($final) {
$vars = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
?>
rk.temp.x <- data.frame (<? echo ($vars); ?>)
+<?
+ if ($final) { ?>
rk.header ("Correlation Matrix Plot", parameters=list ("Method", "<? getRK ("method"); ?>", "Exclusion", "<? getRK ("use"); ?>", "Precision", "<? getRK ("digits"); ?> digits", "Scale text", "<? getRK ("scale"); ?>"))
rk.graph.on ()
+<?
+} ?>
try ({
rk.temp.cor.graph (rk.temp.x)
})
+<?
+ if ($final) { ?>
rk.graph.off ()
print("Signif. codes: 0 '***', 0.001 '**', 0.01 '*', 0.05 '.'', 0.1 ' ', 1")
-<?
- }
-
- function cleanup () { ?>
-rm(rk.temp.cor.graph, rk.temp.x)
-<?
- }
+<? }
+
+}
?>
Modified: trunk/rkward/rkward/plugins/plots/cor_graph.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.xml 2007-01-29 13:55:18 UTC (rev 1241)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.xml 2007-01-29 16:28:08 UTC (rev 1242)
@@ -8,7 +8,10 @@
<tab label="Variables" id="tab_variables">
<row>
<varselector id="vars"/>
+ <column>
<varslot type="numeric" min_vars="1" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+ <preview id="preview"/>
+ </column>
</row>
</tab>
<tab label="Options" id="tab_options">
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