[RkWard-devel] Barplot plugin

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Jan 24 19:25:44 UTC 2007


Hi!

On Wednesday 24 January 2007 16:35, I. Soumpasis wrote:
> I will uploaded at svn in some minutes. Also changed the plot.pluginmap
> accordingly.What else should I change so the plugin to be installed?
> Makefile or something?

Yes, Makefile.am. Stefan has taken care of it already.

> I made enough testings but please take a look and give advices and ideas.

Some comments:
- Try to avoid patterns like

if (<? getRK ("something")?>) {
	do.something.r ()
}

Rather write

<? if (getRK_val ("something") == "TRUE") { ?>
do.something.r ()
<? } ?>

This way the generated code will not get convoluted with statements which are 
not acutally needed. See also 
http://rkward.sourceforge.net/documents/devel/plugins/phptemplate.html#policysimplicity .

Something like (not tested for correctness):

<? 
if (getRK_val ("beside") == "TRUE") { 
?>rk.temp.barplot <- <?
} 
?>barplot((rk.temp.x)<? if (getRK_val ("rainbow")) { ?>, 
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")) { ?>
text(rk.temp.barplot, rk.temp.x, labels=rk.temp.x, pos=<? getRK ("place"); ?>, 
offset=.5)
<? } ?>

- You might want to rewrite the first part as:
rk.temp.x <- (<? echo ($vars); ?>)
if(is.factor(rk.temp.x)) rk.temp.x=summary(rk.temp.x)
else if (!is.matrix(rk.rempt.x)) error ("Only matrices or factors are 
supported")

Saving one variable name, and also giving a more meaningful error message in 
case something wrong was selected.

- in the cleanup function you could write to clear all symbols starting 
with "rk.temp" without listing each:
rm (list=grep ("^rk.temp", ls (), value=TRUE))

- in the .xml, you might want to add the following to the logic section:
<convert id="labelsvalue2" mode="and" sources="labelsvalue;labels.enabled" />
and then change the next line to
<connect client="place.enabled" governor="labelsvalue2" />

Otherwise, if the user first choses to display labels, and after that sets the 
mode to stacked, the placement option will still remain enabled.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20070124/2ec74769/attachment.sig>


More information about the Rkward-devel mailing list