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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Jan 11 21:15:37 UTC 2007


Revision: 1125
          http://svn.sourceforge.net/rkward/?rev=1125&view=rev
Author:   tfry
Date:     2007-01-11 13:15:37 -0800 (Thu, 11 Jan 2007)

Log Message:
-----------
Add correlation matrix plot (I. Soumpasis). Unfinished. Do NOT add to trunk, yet

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/plots/cor_graph.php
    trunk/rkward/rkward/plugins/plots/cor_graph.xml

Added: trunk/rkward/rkward/plugins/plots/cor_graph.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.php	2007-01-11 21:15:37 UTC (rev 1125)
@@ -0,0 +1,49 @@
+<?
+	function preprocess () {
+	}
+	
+	function calculate () {
+	}
+	
+	function printout () {
+	$vars = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
+?>
+
+rk.temp.cor.graph <- function(x){
+panel.cor <- function(x, y, digits=2, prefix="", cex.cor)
+{
+    usr <- par("usr"); on.exit(par(usr))
+    par(usr = c(0, 1, 0, 1))
+    r <- abs(cor(x, y))
+    txt <- format(c(r, 0.123456789), digits=digits)[1]
+    txt <- paste(prefix, txt, sep="")
+    if(missing(cex.cor)) cex <- 0.8/strwidth(txt)
+    
+    test <- cor.test(x,y)
+    # borrowed from printCoefmat
+    Signif <- symnum(test$p.value, corr = FALSE, na = FALSE,
+                  cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
+                  symbols = c("***", "**", "*", ".", " "))
+    
+    text(0.5, 0.5, txt, cex = cex * r)
+    text(.8, .8, Signif, cex=cex, col=2)
+}
+pairs(x, 
+  lower.panel=panel.smooth, upper.panel=panel.cor)
+}
+
+rk.temp.x<- data.frame (<? echo ($vars); ?>)
+rk.header ("Correlation Matrix Plot")
+rk.graph.on ()
+
+rk.temp.cor.graph(rk.temp.x)
+
+rk.graph.off ()
+
+rm(rk.temp.cor.graph,rk.temp.x)
+<?
+	}
+	
+	function cleanup () {
+	}
+?>

Added: trunk/rkward/rkward/plugins/plots/cor_graph.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/cor_graph.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/cor_graph.xml	2007-01-11 21:15:37 UTC (rev 1125)
@@ -0,0 +1,12 @@
+<!DOCTYPE rkplugin>
+<document>
+	<code file="cor_graph.php" />
+
+	<dialog label="Correlation Matrix Graph" >		
+				<row>
+					<varselector id="vars"/>
+					<varslot type="numeric" min_vars="1" multi="true" id="x" source="vars" required="true" label="variable(s):"/>
+				</row>			
+	</dialog>
+
+</document>

Modified: trunk/rkward/rkward/plugins/plots.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/plots.pluginmap	2007-01-11 18:27:43 UTC (rev 1124)
+++ trunk/rkward/rkward/plugins/plots.pluginmap	2007-01-11 21:15:37 UTC (rev 1125)
@@ -7,6 +7,7 @@
 		<component type="standard" id="ecdf_plot" file="ecdf_plot.xml" label="ECDF Plot" />
 		<component type="standard" id="histogram" file="histogram.xml" label="Histogram" />
 		<component type="standard" id="stripchart" file="stripchart_plot.xml" label="Stripchart" />
+		<component type="standard" id="cor_graph" file="cor_graph.xml" label="Correlation Matrix Plot" />
 
 	</components>
 
@@ -17,6 +18,7 @@
 			<entry component="ecdf_plot" />
 			<entry component="histogram" />
 			<entry component="stripchart" />
+			<entry component="cor_graph" />
 		</menu>
 	</hierarchy>
 </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