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

nono_231 at users.sourceforge.net nono_231 at users.sourceforge.net
Wed Jan 24 15:37:52 UTC 2007


Revision: 1206
          http://svn.sourceforge.net/rkward/?rev=1206&view=rev
Author:   nono_231
Date:     2007-01-24 07:37:52 -0800 (Wed, 24 Jan 2007)

Log Message:
-----------
Added barplot plugin

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

Added: trunk/rkward/rkward/plugins/plots/barplot.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.php	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/barplot.php	2007-01-24 15:37:52 UTC (rev 1206)
@@ -0,0 +1,45 @@
+<?
+	function preprocess () {
+}
+	
+	function calculate () {
+}
+
+	function printout () {
+	$vars = str_replace ("\n", ",", trim (getRK_val ("x"))) ; 
+	?>
+
+rk.temp.x2 <- (<? echo ($vars); ?>)
+if(is.matrix(rk.temp.x2)) rk.temp.x=rk.temp.x2
+if(is.factor(rk.temp.x2)) rk.temp.x=summary(rk.temp.x2)
+
+rk.header ("Barplot", parameters=list ("Rainbow colors", "<? getRK ("rainbow"); ?>", "Beside", "<? getRK ("beside"); ?>", "Legend", "<? getRK ("legend"); ?>"))
+
+rk.graph.on ()
+try ({
+	if(<? getRK ("beside"); ?>){
+		if(<? getRK ("rainbow"); ?>) {		
+		rk.temp.barplot <- barplot((rk.temp.x), col=rainbow(rk.temp.x), beside=<? getRK ("beside"); ?>, 	legend.text=<? getRK ("legend"); ?>,  ylim = range(rk.temp.x) * c(0, 1.2))
+		}
+		else {
+		rk.temp.barplot <- barplot((rk.temp.x), beside=<? getRK ("beside"); ?>, legend.text=<? getRK ("legend"); ?>,  ylim = range(rk.temp.x) * c(0, 1.2))
+	}
+	if(<? getRK ("labels"); ?>) text(rk.temp.barplot, rk.temp.x, labels=rk.temp.x, pos=<? getRK ("place"); ?>, offset=.5)
+	}
+	else {
+	if(<? getRK ("rainbow"); ?>) barplot((rk.temp.x), col=rainbow(rk.temp.x), legend.text=<? getRK ("legend"); ?>)
+	else barplot((rk.temp.x), legend.text=<? getRK ("legend"); ?>)
+	}
+})
+rk.graph.off ()
+
+
+<?
+	}
+	
+	function cleanup () {
+	?>
+rm(rk.temp.barplot, rk.temp.x, rk.temp.x2, rk.temp.rainbow)
+	<?
+	}
+?>

Added: trunk/rkward/rkward/plugins/plots/barplot.rkh
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.rkh	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/barplot.rkh	2007-01-24 15:37:52 UTC (rev 1206)
@@ -0,0 +1,30 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+Creates a bar plot with vertical bars.
+	</summary>
+
+	<usage>
+Choose a matrix or a factor to be plotted. Choose if you want stacked bars, legend, and rainbow colors. Also you can choose if you want to display or not bar values (labels) and in what place.
+	</usage>
+
+	<settings>
+		<caption id="tab_variables"/>
+		<setting id="x">Select a data matrix or a factor to be plotted.</setting>
+		<caption id="tab_options"/>
+		<setting id="legend">Select if you want to add a legend to the barplot. The row names of height will be used as labels if they are non-null. By default there is no legend.</setting>
+		<setting id="rainbow">Select between grey and rainbow collors. Default is grey colors.</setting>
+		<setting id="beside">Select a type between juxtaposed bars and stacked bars. If you select stacked bars you can not display bar values (labels). </setting>
+		<setting id="labels">Select if you want to display bar values (labels). By default the values sould not be displayed.</setting>
+		<setting id="place">If you have selected to display bar values (labels) you can select where should they be displayed:
+		<li> Above the bars (default)</li>
+		<li> Beside the bars </li>
+		<li> Inside the bars </li>
+		</setting>		
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://rhelp/barplot"/></li>
+		</ul>
+	</related>
+</document>

Added: trunk/rkward/rkward/plugins/plots/barplot.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/barplot.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/plots/barplot.xml	2007-01-24 15:37:52 UTC (rev 1206)
@@ -0,0 +1,41 @@
+<!DOCTYPE rkplugin>
+<document>
+	<code file="barplot.php" />
+	<help file="barplot.rkh" />
+	<logic>
+		<convert id="besidevalue" mode="equals" sources="beside.string" standard="TRUE" />
+		<connect client="labels.enabled" governor="besidevalue" />
+		<convert id="labelsvalue" mode="equals" sources="labels.string" standard="TRUE" />
+		<connect client="place.enabled" governor="labelsvalue" />
+	</logic>
+	<dialog label="Correlation Matrix Plot" >		
+		<tabbook>
+			<tab label="Variables" id="tab_variables">
+				<row>
+					<varselector id="vars"/>
+					<column>
+					<varslot type="numeric" min_vars="1" id="x" source="vars" required="true" label="Matrix or Factor"/>
+					</column>
+				</row>
+			</tab>
+			<tab label="Options" id="tab_options">
+				<checkbox id="legend" label="Legend" value="TRUE" value_unchecked="FALSE" checked="false"/>
+				<checkbox id="rainbow" label="Rainbow colors" value="TRUE" value_unchecked="FALSE" checked="false"/>
+				<radio id="beside" label="Type" >
+					<option value="TRUE" label="Juxtaposed" checked="true"/>
+					<option value="FALSE" label="Stacked"/>
+				</radio>
+				<radio id="labels" label="Label values" >
+					<option value="TRUE" label="Display" />
+					<option value="FALSE" label="Do not Display" checked="true"/>					
+				</radio>
+				<radio id="place" label="Display label values">
+					<option value="3" label="Above Bars" checked="true"/>
+					<option value="2" label="Beside Bars"/>
+					<option value="1" label="Inside Bars"/>
+				</radio>
+			</tab>
+		</tabbook>			
+	</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