[rkward-cvs] SF.net SVN: rkward:[2403] branches/release_branch_0.4.9/rkward/plugins/ plots
sjar at users.sourceforge.net
sjar at users.sourceforge.net
Thu Feb 19 23:48:44 UTC 2009
Revision: 2403
http://rkward.svn.sourceforge.net/rkward/?rev=2403&view=rev
Author: sjar
Date: 2009-02-19 23:48:43 +0000 (Thu, 19 Feb 2009)
Log Message:
-----------
New Feature (status: basically working but needs refinements)
* added option to show mean and standard deviation (sd) in boxplot
* colour, symbols and symbol size can be defined by the user
> symbols for sd can be chosen independently
> if not changed by the user they should be easily recognizable
known issues:
* GUI needs clean-up/rearrangements
* php/R-code uses points() instead of arrows() because the visual impression of a boxplot may suffer otherwise
* works only with input from RKWards table GUI or with data.frames of same length
won't work with data.frames of different length
# currently investigated solution is the usage of the plyr package
Example for the plyr packge with three different data.frames:
require(plyr)
List <- list(data.frame(2,1,3,2,4,5), data.frame(2,3,4), data.frame(1,2,4,3,2,4,5,4,2))
data_of_List<-do.call(rbind.fill, List)
data_of_List
# BUT it's not really reasonable to make the plug-in dependent of yet another package, thus open for alternative solutions (maybe loops)
Modified Paths:
--------------
branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.php
branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.xml
Modified: branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.php
===================================================================
--- branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.php 2009-02-19 23:23:04 UTC (rev 2402)
+++ branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.php 2009-02-19 23:48:43 UTC (rev 2403)
@@ -19,7 +19,10 @@
$xvarsstring = join (", ", split ("\n", getRK_val ("x")));
$names_mode = getRK_val ("names_mode");
$mean = getRK_val ("mean");
+ $pch_mean = getRK_val ("pch_mean");
$sd = getRK_val ("sd");
+ $pch_sd_high = getRK_val ("pch_sd_high");
+ $pch_sd_low = getRK_val ("pch_sd_low");
$horizontal = getRK_val ("orientation");
$plot_adds = getRK_val ("plotoptions.code.calculate"); //add grid and alike
@@ -39,21 +42,21 @@
<? } ?>
try (boxplot (data_list, notch = <? getRK ("notch") ?>, outline = <? getRK("outline")?>, horizontal = <? getRK("orientation"); ?><? getRK ("plotoptions.code.printout"); ?>)) #actuall boxplot function
<? if (($mean == "TRUE") && ($horizontal == "TRUE")) {?>
- try (points(1:length(data_list) ~ apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE),pch=19, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)) #calculates the mean for all data and adds a point at the corresponding position
+ try (points(1:length(data_list) ~ apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE),pch=<? echo ($pch_mean); ?>, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)) #calculates the mean for all data and adds a point at the corresponding position
<? } if (($mean == "TRUE") && ($horizontal == "FALSE")) {?>
- try (points(apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE),pch=19, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)) #calculates the mean for all data and adds a point at the corresponding position
+ try (points(apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE),pch=<? echo ($pch_mean); ?>, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)) #calculates the mean for all data and adds a point at the corresponding position
<? }
?>
<? if (($sd == "TRUE") && ($horizontal == "FALSE")) {?>
sd_low <- (apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE)) - (apply(data.frame(<? echo ($xvarsstring); ?>),2,sd,na.rm = TRUE))
sd_high <- (apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE)) + (apply(data.frame(<? echo ($xvarsstring); ?>),2,sd,na.rm = TRUE))
- points(sd_low,pch=3, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
- points(sd_high,pch=3, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
+ points(sd_low,pch=<? echo ($pch_sd_low); ?>, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
+ points(sd_high,pch=<? echo ($pch_sd_high); ?>, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
<? } if (($sd == "TRUE") && ($horizontal == "TRUE")) {?>
sd_low <- (apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE)) - (apply(data.frame(<? echo ($xvarsstring); ?>),2,sd,na.rm = TRUE))
sd_high <- (apply(data.frame(<? echo ($xvarsstring); ?>),2,mean,na.rm = TRUE)) + (apply(data.frame(<? echo ($xvarsstring); ?>),2,sd,na.rm = TRUE))
- points(1:length(data_list) ~ sd_low,pch=3, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
- points(1:length(data_list) ~ sd_high,pch=3, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
+ points(1:length(data_list) ~ sd_low,pch=<? echo ($pch_sd_low); ?>, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
+ points(1:length(data_list) ~ sd_high,pch=<? echo ($pch_sd_high); ?>, cex = <? getRK ("cex_sd_mean"); ?><? getRK ("sd_mean_color.code.printout"); ?>)
<? }
?>
<? if (!empty ($plot_adds)) { ?>
Modified: branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.xml
===================================================================
--- branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.xml 2009-02-19 23:23:04 UTC (rev 2402)
+++ branches/release_branch_0.4.9/rkward/plugins/plots/box_plot.xml 2009-02-19 23:48:43 UTC (rev 2403)
@@ -49,8 +49,19 @@
<stretch/>
</column>
<column>
- <checkbox id="mean" checked="false" value="TRUE" label="show mean" />
- <checkbox id="sd" checked="false" value="TRUE" label="show standard deviation" />
+ <row>
+ <checkbox id="mean" checked="false" value="TRUE" label="show mean" />
+ <spinbox type="integer" id="pch_mean" label="mean symbol" initial="19"/>
+ </row>
+ <row>
+ <column>
+ <checkbox id="sd" checked="false" value="TRUE" label="show standard deviation" />
+ </column>
+ <column>
+ <spinbox type="integer" id="pch_sd_high" label="standard deviation symbol (upper)" initial="3"/>
+ <spinbox type="integer" id="pch_sd_low" label="standard deviation symbol (lower)" initial="3"/>
+ </column>
+ </row>
<spinbox type="real" id="cex_sd_mean" label="size" initial="1"/>
<embed id="sd_mean_color" component="rkward::color_chooser" label="Color"/>
<embed id="plotoptions" component="rkward::plot_options" as_button="true" label="Plot 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