[rkward-cvs] SF.net SVN: rkward: [987] trunk/rkward/rkward/plugins
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Dec 4 18:54:54 UTC 2006
Revision: 987
http://svn.sourceforge.net/rkward/?rev=987&view=rev
Author: tfry
Date: 2006-12-04 10:54:54 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Move scatterplot plugin to plots
Modified Paths:
--------------
trunk/rkward/rkward/plugins/Makefile.am
trunk/rkward/rkward/plugins/all.pluginmap
Added Paths:
-----------
trunk/rkward/rkward/plugins/plots/scatterplot.php
trunk/rkward/rkward/plugins/plots/scatterplot.xml
Removed Paths:
-------------
trunk/rkward/rkward/plugins/02plots/
Modified: trunk/rkward/rkward/plugins/Makefile.am
===================================================================
--- trunk/rkward/rkward/plugins/Makefile.am 2006-12-04 16:08:39 UTC (rev 986)
+++ trunk/rkward/rkward/plugins/Makefile.am 2006-12-04 18:54:54 UTC (rev 987)
@@ -14,7 +14,9 @@
plots/box_plot.php \
plots/histogram.xml \
plots/ecdf_plot.php \
- plots/ecdf_plot.xml
+ plots/ecdf_plot.xml \
+ plots/scatterplot.xml \
+ plots/scatterplot.php
pluginsXdistributionsdir = $(kde_datadir)/rkward/distributions
dist_pluginsXdistributions_DATA = \
@@ -180,10 +182,6 @@
pluginsX02plotsdir = $(kde_datadir)/rkward/02plots
pluginsX02plotsXscatterplotdir = $(kde_datadir)/rkward/02plots/scatterplot
-dist_pluginsX02plotsXscatterplot_DATA = \
- 02plots/scatterplot/code.php \
- 02plots/scatterplot/description.xml
-
pluginsXx11devicedir = $(kde_datadir)/rkward/x11device
dist_pluginsXx11device_DATA = \
x11device/export.xml \
Modified: trunk/rkward/rkward/plugins/all.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/all.pluginmap 2006-12-04 16:08:39 UTC (rev 986)
+++ trunk/rkward/rkward/plugins/all.pluginmap 2006-12-04 18:54:54 UTC (rev 987)
@@ -13,7 +13,7 @@
<component type="standard" id="save_variables" file="00saveload/save/write/description.xml" label="Save variables" />
<component type="standard" id="save_table" file="writetable/description.xml" label="Save as table" />
- <component type="standard" id="plots_scatterplot" file="02plots/scatterplot/description.xml" label="Scatterplot" />
+ <component type="standard" id="plots_scatterplot" file="plots/scatterplot.xml" label="Scatterplot" />
<component type="standard" id="plot_options" file="plots/plot_options.xml" label="Plot Options" />
<component type="standard" id="descriptive" file="20descriptive/description.xml" label="Descriptive Statistics" />
Copied: trunk/rkward/rkward/plugins/plots/scatterplot.php (from rev 982, trunk/rkward/rkward/plugins/02plots/scatterplot/code.php)
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot.php (rev 0)
+++ trunk/rkward/rkward/plugins/plots/scatterplot.php 2006-12-04 18:54:54 UTC (rev 987)
@@ -0,0 +1,85 @@
+<?
+function preprocess () {
+?>
+ rk.temp <- list ()
+<?
+}
+
+function calculate () {
+ $x = str_replace ("\n", ",", trim (getRK_val ("x"))) ;
+ $y = str_replace ("\n", ",", trim (getRK_val ("y"))) ;
+
+ /** fetch some values which are needed in more than one place, to avoid mulitple transfer */
+ $type = getRK_val ("type");
+ $typeCusto = getRK_val ("typeCusto");
+ if ($type == "custoType") $type_string = $typeCusto;
+ else $type_string = $type;
+ $col = getRK_val ("col");
+ $pch = getRK_val ("pch");
+ $cex = getRK_val ("cex");
+ if (getRK_val("isXaxis") == "1") $Xname = getRK_val ("Xname"); else $Xname = "";
+ if (getRK_val("isYaxis") == "1") $Yname = getRK_val ("Yname"); else $Yname = "";
+ if (getRK_val("isTitle") == "1") $main = getRK_val ("main"); else $main = "";
+ if (getRK_val("isSub") == "1") $sub = getRK_val ("sub"); else $sub = "";
+?>
+
+<? #input ?>
+rk.temp$Xvar <- list(<? echo ($x) ;?>)
+rk.temp$Yvar <- list(<? echo ($y) ;?>)
+rk.temp$Xval <- <? if (getRK_val("columns") == "custoCol" ) echo (getRK_val("Xscale") . "\n"); else echo ("c(" . $x . ")\n"); ?>
+rk.temp$Yval <- <? if (getRK_val("rows") == "custoRow" ) echo (getRK_val("Yscale") . "\n"); else echo ("c(" . $y . ")\n"); ?>
+
+<? # verification (chiant mais doit \xEAtre fait)?>
+rk.temp$ok <- TRUE
+if (length(rk.temp$Xvar) != length(rk.temp$Yvar)) {
+ rk.temp$ok <- FALSE ;
+ stop("Unequal number of X and Y variables given")
+}
+
+# find range of X/Y values needed
+rk.temp$Xdef <- c(min(rk.temp$Xval,na.rm=TRUE), max(rk.temp$Xval,na.rm=TRUE))
+rk.temp$Ydef <- c(min(rk.temp$Yval,na.rm=TRUE), max(rk.temp$Yval,na.rm=TRUE))
+
+rk.temp$type <- rep (<? echo ($type_string); ?>, length.out=length (rk.temp$Xvar));
+rk.temp$col <- rep (<? echo ($col); ?>, length.out=length (rk.temp$Xvar));
+rk.temp$cex <- rep (<? echo ($cex); ?>, length.out=length (rk.temp$Xvar));
+rk.temp$pch <- rep (<? echo ($pch); ?>, length.out=length (rk.temp$Xvar));
+<?
+}
+
+function printout () {
+
+?>
+if (!rk.temp$ok) stop ()
+
+rk.graph.on()
+
+try ({
+ # make frame and axes
+ plot(rk.temp$Xdef, rk.temp$Ydef, type="n", xlab = "<? echo ($Xname); ?>", ylab = "<? echo ($Yname); ?>", main = "<? echo ($main); ?>", sub = "<? echo ($sub); ?>", axes = <? getRK("axes") ;?>, log = "<? getRK("logX") ; getRK("logY") ; ?>")
+
+ # plot variables one X/Y pair at a time
+ for (rk.temp.iterator in 1:length(rk.temp$Xvar)) {
+ points (
+ rk.temp$Xvar[[rk.temp.iterator]],
+ rk.temp$Yvar[[rk.temp.iterator]],
+ type = rk.temp$type[[rk.temp.iterator]],
+ col = rk.temp$col[[rk.temp.iterator]],
+ cex = rk.temp$cex[[rk.temp.iterator]],
+ pch = rk.temp$pch[[rk.temp.iterator]]
+ )
+ }
+})
+
+rk.graph.off()
+
+<?
+}
+
+function cleanup () {
+?>
+rm(rk.temp)
+rm(rk.temp.iterator)
+<?
+}
+?>
Copied: trunk/rkward/rkward/plugins/plots/scatterplot.xml (from rev 979, trunk/rkward/rkward/plugins/02plots/scatterplot/description.xml)
===================================================================
--- trunk/rkward/rkward/plugins/plots/scatterplot.xml (rev 0)
+++ trunk/rkward/rkward/plugins/plots/scatterplot.xml 2006-12-04 18:54:54 UTC (rev 987)
@@ -0,0 +1,244 @@
+<!DOCTYPE rkplugin>
+<document>
+ <code file="scatterplot.php"/>
+
+<!--Adrien d'Hardemare
+first attempt to produce simple plot using the plot function
+A duplicate option has to be tested-->
+ <logic>
+ <connect client="Xscale.enabled" governor="columns.number" />
+ <connect client="Xscale.required" governor="columns.number" />
+ <connect client="Yscale.enabled" governor="rows.number" />
+ <connect client="Yscale.required" governor="rows.number" />
+ <convert id="XorYscale" mode="or" sources="Xscale.enabled;Yscale.enabled" />
+ <connect client="varname.enabled" governor="XorYscale" />
+
+ <convert id="customtype" mode="equals" sources="type.string" standard="custoType" />
+ <connect client="typeCusto.enabled" governor="customtype" />
+ <connect client="typeCusto.required" governor="customtype" />
+ <connect client="Xname.enabled" governor="isXaxis.state" />
+ <connect client="Xname.required" governor="isXaxis.state" />
+ <connect client="Yname.enabled" governor="isYaxis.state" />
+ <connect client="Yname.required" governor="isYaxis.state" />
+ <connect client="main.enabled" governor="isTitle.state" />
+ <connect client="main.required" governor="isTitle.state" />
+ <connect client="sub.enabled" governor="isSub.state" />
+ <connect client="sub.required" governor="isSub.state" />
+ </logic>
+ <dialog label="Scatterplot" >
+ <tabbook>
+ <tab label="Variables" >
+ <row>
+ <varselector id="vars" />
+ <varslot multi="true" duplicate="true" types="number unknown" id="x" source="vars" label="'X' variables" required="true" />
+ <varslot multi="true" duplicate="true" types="number unknown" id="y" source="vars" label="'Y' variables" required="true" />
+ </row>
+ </tab>
+ <tab label="Axes" >
+ <row>
+ <varselector id="varname" />
+ <column>
+ <radio id="columns" label="Value for 'X' scale" >
+ <option value="FALSE" label="Default" />
+ <option value="custoCol" label="Customize" />
+ </radio>
+ <varslot multi="false" types="number unknown" source="varname" id="Xscale" />
+ <radio id="rows" label="Value for 'Y' scale" >
+ <option value="FALSE" id="temp2" label="Default" />
+ <option value="custoRow" label="Customize" />
+ </radio>
+ <varslot multi="false" types="number unknown" id="Yscale" source="varname" />
+ </column>
+ </row>
+ </tab>
+ <tab label="Type" >
+ <radio id="type" label="Type of graphics" >
+ <option value="'p'" label="Plot individual dots" />
+ <option value="'l'" label="Plot lines" />
+ <option value="'b'" label="Plot dots connected by lines (both)" />
+ <option value="'o'" label="Plot dots overplotted by lines (both)" />
+ <option value="'h'" label="Plot histogram like vertical lines (high-density)" />
+ <option value="'s'" label="Stair steps: the top of the vertical defines the point" />
+ <option value="'S'" label="Stair steps: the bottom of the vertical defines the point" />
+ <option value="custoType" label="Customize" />
+ </radio>
+ <input size="medium" id="typeCusto" label="Give a character vector eg : c('p','l')" />
+ </tab>
+ <tab label="Names" >
+ <row>
+ <column>
+ <checkbox checked="false" value="1" id="isXaxis" label="Give a name to 'X' axis" />
+ <input size="medium" id="Xname" initial="X" label="Name for X axis" />
+ <checkbox checked="false" value="1" id="isYaxis" label="Give a name to Y axis" />
+ <input size="medium" id="Yname" initial="Y" label="Name of Y axis" />
+ <checkbox checked="false" value="1" id="isTitle" label="Give a title" />
+ <input size="medium" id="main" />
+ <checkbox checked="false" value="1" id="isSub" label="Give a subtitle" />
+ <input size="medium" id="sub" />
+ </column>
+ <column>
+ <checkbox value_unchecked="FALSE" checked="true" value="TRUE" id="axes" label="Generate axes" />
+ <checkbox value_unchecked="" checked="false" value="x" id="logX" label="X as logarythm" />
+ <checkbox value_unchecked="" checked="false" value="y" id="logY" label="Y as logarythm" />
+ </column>
+ </row>
+ </tab>
+ <tab label="Options" >
+ <frame>
+ <row>
+ <radio id="color" label="Color" >
+ <option value="all" label="Same color for all variables" />
+ <option value="each" label="Different for each variable" />
+ </radio>
+ <column>
+ <text>
+ Enter value - for diff.col. enter a vector -
+ eg: c(1,2) or c('red','green')
+ </text>
+ <input size="small" id="col" initial="'black'" label=" " />
+ </column>
+ </row>
+ </frame>
+ <frame>
+ <row>
+ <radio id="isCe" label="Size" >
+ <option value="all" label="Same for all variables" />
+ <option value="each" label="Different for each variable" />
+ </radio>
+ <column>
+ <text>
+ A numerical value giving the amount by which plotting text and symbols should be scaled relative to the default.
+ </text>
+ <input size="small" id="cex" initial="1" label="Enter value - for diff.size. enter a vector -" />
+ </column>
+ </row>
+ </frame>
+ <frame>
+ <row>
+ <radio id="isPch" label="Symbol" >
+ <option value="all" label="Same for all variables" />
+ <option value="each" label="Different for each variable" />
+ </radio>
+ <column>
+ <text>
+ Either an integer specifying a symbol or a single character to be used as the default in plotting points.
+ </text>
+ <input size="small" id="pch" initial="1" label="Enter value - for diff.symbol. enter a vector -" />
+ </column>
+ </row>
+ </frame>
+ </tab>
+ </tabbook>
+ </dialog>
+ <wizard label="Scatterplot">
+ <!--variable
+ -->
+ <page>
+ <row>
+ <varselector id="vars" />
+ <varslot multi="true" duplicate="true" types="number unknown" id="x" source="vars" label="'X' variables" required="true" />
+ <varslot multi="true" duplicate="true" duplicate="true" types="number unknown" id="y" source="vars" label="'Y' variables" required="true" />
+ </row>
+ </page>
+ <!-- axes-->
+ <page>
+ <row>
+ <varselector id="varname" />
+ <column>
+ <radio id="columns" label="Value for 'X' scale" >
+ <option value="FALSE" label="Default" />
+ <option value="custoCol" label="Customize" />
+ </radio>
+ <varslot multi="false" types="number unknown" source="varname" id="Xscale" />
+ <radio id="rows" label="Value for 'Y' scale" >
+ <option value="FALSE" id="temp2" label="Default" />
+ <option value="custoRow" label="Customize" />
+ </radio>
+ <varslot multi="false" types="number unknown" id="Yscale" source="varname" />
+ </column>
+ </row>
+ </page>
+ <!--couleur
+ -->
+ <page>
+ <frame>
+ <row>
+ <radio id="color" label="Color" >
+ <option value="all" label="Same color for all variables" />
+ <option value="each" label="Different for each variable" />
+ </radio>
+ <column>
+ <text>
+ Enter value - for diff.col. enter a vector -
+ eg: c(1,2) or c('red','green')
+ </text>
+ <input size="small" id="col" initial="'black'" label=" " />
+ </column>
+ </row>
+ </frame>
+ <frame>
+ <row>
+ <radio id="isCex" label="Size" >
+ <option value="all" label="Same for all variables" />
+ <option value="each" label="Different for each variable" />
+ </radio>
+ <column>
+ <text>
+ A numerical value giving the amount by which plotting text and symbols should be scaled relative to the default.
+ </text>
+ <input size="small" id="cex" initial="1" label="Enter value - for diff.size. enter a vector -" />
+ </column>
+ </row>
+ </frame>
+ <frame>
+ <row>
+ <radio id="isPch" label="Symbol" >
+ <option value="all" label="Same for all variables" />
+ <option value="each" label="Different for each variable" />
+ </radio>
+ <column>
+ <text>
+ Either an integer specifying a symbol or a single character to be used as the default in plotting points.
+ </text>
+ <input size="small" id="pch" initial="1" label="Enter value - for diff.symbol. enter a vector -" />
+ </column>
+ </row>
+ </frame>
+ </page>
+ <!--type
+ -->
+ <page>
+ <radio id="type" label="Type of graphics" >
+ <option value="'p'" label="Plot individual points " />
+ <option value="'l'" label="Plot lines " />
+ <option value="b" label="Plot points connected by lines (both)" />
+ <option value="1" label="Plot points overlaid by lines " />
+ <option value="'h'" label="Plot vertical lines from points to the zero axis (high-density)" />
+ <option value="'s'" label="Step-function plots : the top of the vertical defines the point" />
+ <option value="'S'" label="Step-function plots : the bottom of the vertical defines the point" />
+ <option value="custoType" label="Customize" />
+ </radio>
+ <input size="medium" id="typeCusto" label="Give a character vector eg : c('p','l')" />
+ </page>
+ <!--titre-->
+ <page>
+ <row>
+ <column>
+ <checkbox checked="false" value="1" id="isXaxis" label="Give a name to 'X' axis" />
+ <input size="medium" id="Xname" initial="X" label="Name for X axis" />
+ <checkbox checked="false" value="1" id="isYaxis" label="Give a name to Y axis" />
+ <input size="medium" id="Yname" initial="Y" label="Name of Y axis" />
+ <checkbox checked="false" value="1" id="isTitle" label="Give a title" />
+ <input size="medium" id="main" />
+ <checkbox checked="false" value="1" id="isSub" label="Give a subtitle" />
+ <input size="medium" id="sub" />
+ </column>
+ <column>
+ <checkbox value_unchecked="FALSE" checked="true" value="TRUE" id="axes" label="Generate axes" />
+ <checkbox value_unchecked="" checked="false" value="x" id="logX" label="X as logarythm" />
+ <checkbox value_unchecked="" checked="false" value="y" id="logY" label="Y as logarythm" />
+ </column>
+ </row>
+ </page>
+ </wizard>
+</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