[rkward-cvs] rkward/rkward/plugins/02plots/scatterplot code.php,1.2,1.3 description.xml,1.6,1.7
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Wed Apr 12 17:49:47 UTC 2006
Update of /cvsroot/rkward/rkward/rkward/plugins/02plots/scatterplot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23251
Modified Files:
code.php description.xml
Log Message:
Clean up scatterplot code some. Should also give a slight speedup
Index: description.xml
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/02plots/scatterplot/description.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** description.xml 12 Apr 2006 16:54:43 -0000 1.6
--- description.xml 12 Apr 2006 17:49:44 -0000 1.7
***************
*** 31,36 ****
<row>
<varselector id="vars" />
! <varslot multi="true" duplicate="true" classes="integer numeric" id="x" source="vars" label="'X' variables" required="true" />
! <varslot multi="true" duplicate="true" duplicate="true" classes="integer numeric" id="y" source="vars" label="'Y' variables" required="true" />
</row>
</tab>
--- 31,36 ----
<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>
***************
*** 43,52 ****
<option value="custoCol" label="Customize" />
</radio>
! <varslot multi="false" classes="integer numeric" 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" classes="integer numeric " id="Yscale" source="varname" />
</column>
</row>
--- 43,52 ----
<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>
***************
*** 138,145 ****
-->
<input size="big" id="before" label="Before plot" />
- <checkbox value_unchecked=" " checked="true" value="rk.graph.off()" id="rkgraphsoff" label="Enter 'rk.graph.off()'" />
<!-- doesn't work very well TODO
! <input size="big" id="after" label="After plot" />
! -->
</frame>
</tab>
--- 138,145 ----
-->
<input size="big" id="before" label="Before plot" />
<!-- doesn't work very well TODO
! <checkbox value_unchecked=" " checked="true" value="rk.graph.off()" id="rkgraphsoff" label="Enter 'rk.graph.off()'" />
! -->
! <input size="big" id="after" label="After plot" />
</frame>
</tab>
***************
*** 152,157 ****
<row>
<varselector id="vars" />
! <varslot multi="true" duplicate="true" classes="numeric integer" id="x" source="vars" label="'X' variables" required="true" />
! <varslot multi="true" duplicate="true" duplicate="true" classes="numeric integer" id="y" source="vars" label="'Y' variables" required="true" />
</row>
</page>
--- 152,157 ----
<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>
***************
*** 165,174 ****
<option value="custoCol" label="Customize" />
</radio>
! <varslot multi="false" classes="integer numeric" 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" classes="integer numeric " id="Yscale" source="varname" />
</column>
</row>
--- 165,174 ----
<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>
Index: code.php
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/02plots/scatterplot/code.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** code.php 28 Apr 2005 20:05:54 -0000 1.2
--- code.php 12 Apr 2006 17:49:44 -0000 1.3
***************
*** 2,7 ****
function preprocess () {
}
- ?>
- <?
function calculate () {
--- 2,5 ----
***************
*** 9,21 ****
$y = str_replace ("\n", ",", trim (getRK_val ("y"))) ;
?>
<? #input ?>
! rk.plugin.Xvar = list(<? echo ($x) ;?>) ;
! rk.plugin.Yvar = list(<? echo ($y) ;?>) ;
! rk.plugin.Xval = c(<? echo ($x) ;?>) ;
! rk.plugin.Yval = c(<? echo ($y) ;?>) ;
!
<? # verification (chiant mais doit être fait)?>
--- 7,28 ----
$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");
+ $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.plugin.Xvar <- list(<? echo ($x) ;?>)
! rk.plugin.Yvar <- list(<? echo ($y) ;?>)
! rk.plugin.Xval <- <? if (getRK_val("columns") == "custoCol" ) echo (getRK_val("Xscale") . "\n"); else echo ("c(" . $x . ")\n"); ?>
! rk.plugin.Yval <- <? if (getRK_val("rows") == "custoRow" ) echo (getRK_val("Yscale") . "\n"); else echo ("c(" . $y . ")\n"); ?>
<? # verification (chiant mais doit être fait)?>
***************
*** 24,76 ****
rk.plugin.ok = FALSE ;
stop("'X' is of length ",length(rk.plugin.Xvar)," and 'Y' of length ",length(rk.plugin.Yvar) )
- }
- if ( "<? getRK("color") ; ?>" == "each") {
- if (length( <? getRK('col') ; ?>) != length(rk.plugin.Xvar))
- {
- rk.plugin.ok = FALSE ;
- stop('only ', length( <? getRK('col') ; ?>) ,' color(s) is(are) displayed') ;
- }
}
! if ( "<? getRK("isPch") ; ?>" == "each") {
! if (length( <? getRK('pch') ; ?>) != length(rk.plugin.Xvar))
! {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? getRK('pch') ; ?>) ,' symbol(s) is(are) displayed') ;
! }
}
! if ( "<? getRK("isCex") ; ?>" == "each") {
! if (length( <? getRK('cex') ; ?>) != length(rk.plugin.Xvar))
! {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? getRK('pch') ; ?>) ,' size(s) is(are) displayed') ;
! }
}
! if ( "<? getRK("type") ; ?>" == "custoType") {
! if (length( <? getRK('typeCusto') ; ?>) != length(rk.plugin.Xvar))
! {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? getRK('typeCusto') ; ?>) ,' type(s) is(are) displayed') ;
! }
}
!
if (rk.plugin.ok) {
<? #finding min and max for default plotin ; ?>
- <? if (getRK_val("columns") == "custoCol" ) echo (getRK("Xscale") . "-> rk.plugin.Xval") ; ?>
- <? if (getRK_val("rows") == "custoRow" ) echo (getRK("Yscale") . "-> rk.plugin.Yval") ; ?>
rk.plugin.Xdef = c(min(rk.plugin.Xval,na.rm=TRUE) , max(rk.plugin.Xval,na.rm=TRUE))
rk.plugin.Ydef = c(min(rk.plugin.Yval,na.rm=TRUE) , max(rk.plugin.Yval,na.rm=TRUE))
<? # names ?>
! rk.plugin.Xname = '<? getRK("Xname") ?>' ;
! rk.plugin.Yname = '<? getRK("Yname") ?>' ;
! rk.plugin.title = '<? getRK("main") ?>' ;
! rk.plugin.sub = '<? getRK("sub") ?>' ;
! <? if (getRK_val("isXaxis") != "1" ) echo ( "rk.plugin.Xname = '' " ) ?>
! <? if (getRK_val("isYaxis") != "1" ) echo ( "rk.plugin.Yname = '' " ) ?>
! <? if (getRK_val("isSub") != "1" ) echo ( "rk.plugin.sub = '' " ) ?>
! <? if (getRK_val("isTitle") != "1" ) echo ( "rk.plugin.main = '' " ) ?>
!
<? # type ?>
--- 31,72 ----
rk.plugin.ok = FALSE ;
stop("'X' is of length ",length(rk.plugin.Xvar)," and 'Y' of length ",length(rk.plugin.Yvar) )
}
! <?
! if (getRK_val ("color") == "each") { ?>
! if (length( <? echo ($col); ?>) != length(rk.plugin.Xvar)) {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? echo ($col); ?>) ,' color(s) is(are) displayed') ;
}
! <? }
! if (getRK_val ("isPch") == "each") { ?>
! if (length( <? echo ($pch); ?>) != length(rk.plugin.Xvar)) {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? echo ($pch); ?>) ,' symbol(s) is(are) displayed') ;
}
! <? }
! if (getRK_val ("isCe") == "each") { ?>
! if (length( <? echo ($cex); ?>) != length(rk.plugin.Xvar)) {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? echo ($cex); ?>) ,' size(s) is(are) displayed') ;
}
! <? }
! if ($type == "custoType") { ?>
! if (length( <? echo ($typeCusto); ?>) != length(rk.plugin.Xvar)) {
! rk.plugin.ok = FALSE ;
! stop('only ', length( <? echo ($typeCusto); ?>) ,' type(s) is(are) displayed') ;
! }
! <? } ?>
if (rk.plugin.ok) {
<? #finding min and max for default plotin ; ?>
rk.plugin.Xdef = c(min(rk.plugin.Xval,na.rm=TRUE) , max(rk.plugin.Xval,na.rm=TRUE))
rk.plugin.Ydef = c(min(rk.plugin.Yval,na.rm=TRUE) , max(rk.plugin.Yval,na.rm=TRUE))
<? # names ?>
! rk.plugin.Xname = '<? echo ($Xname); ?>'
! rk.plugin.Yname = '<? echo ($Yname); ?>'
! rk.plugin.title = '<? echo ($main); ?>'
! rk.plugin.sub = '<? echo ($sub); ?>'
<? # type ?>
***************
*** 81,89 ****
cex = rep(NA,length(rk.plugin.Xvar)))
! <? if (getRK_val("type") != "custoType" ) echo ( getRK("type") . " -> rk.plugin.tc[[1]]" ) ;
! else echo( getRK("typeCusto") . " -> rk.plugin.type.tc[[1]]" ) ?>
! rk.plugin.tc[[2]] = <? getRK("col") ;?>
! rk.plugin.tc[[3]] = <? getRK("cex") ;?>
! rk.plugin.tc[[4]] = <? getRK("pch") ;?>
<? # avant après ?>
--- 77,85 ----
cex = rep(NA,length(rk.plugin.Xvar)))
! <? if ($type != "custoType" ) echo ( $type . " -> rk.plugin.tc[[1]]" ) ;
! else echo( $typeCusto . " -> rk.plugin.type.tc[[1]]" ) ?>
! rk.plugin.tc[[2]] = <? echo ($col); ?>
! rk.plugin.tc[[3]] = <? echo ($cex); ?>
! rk.plugin.tc[[4]] = <? echo ($pch); ?>
<? # avant après ?>
***************
*** 92,99 ****
rk.plugin.off = expression( <? getRK("rkgraphsoff") ; ?>) ;
*/ ?>
- rk.plugin.before = expression( <? getRK("before") ; ?>) ;
- <? /*
- rk.plugin.after = expression( <? getRK("after") ; ?>) ;
- */ ?>
<? # axes ?>
--- 88,91 ----
***************
*** 107,113 ****
}
- ?>
- <?
-
function printout () {
--- 99,102 ----
***************
*** 116,124 ****
rk.graph.on()
! # evaluating before
! # doesn't work very well
! #if (!is.null(eval(rk.plugin.on))) eval(rk.plugin.on)
! rk.graph.on()
! if (!is.null(eval(rk.plugin.before))) eval(rk.plugin.before)
# making frame
--- 105,112 ----
rk.graph.on()
! <?
! $before = getRK_val ("before");
! if (!empty ($before)) echo ($before);
! ?>
# making frame
***************
*** 137,144 ****
}
! # evaluating after
! # if (!is.null(eval(rk.plugin.after))) eval(rk.plugin.after)
! #doesn't work very well
! #if (!is.null(eval(rk.plugin.off))) eval(rk.plugin.off)
rk.graph.off()
}
--- 125,135 ----
}
! <?
! $after = getRK_val ("after");
! if (!empty ($after)) echo ($after);
! ?>
!
! <? /*#doesn't work very well
! #if (!is.null(eval(rk.plugin.off))) eval(rk.plugin.off) */ ?>
rk.graph.off()
}
More information about the rkward-tracker
mailing list