[rkward-cvs] rkward/rkward/plugins/plots box_plot.php,1.2,1.3 box_plot.xml,1.2,1.3 plot_options.php,1.3,1.4

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Apr 5 19:34:05 UTC 2006


Update of /cvsroot/rkward/rkward/rkward/plugins/plots
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1275/plots

Modified Files:
	box_plot.php box_plot.xml plot_options.php 
Log Message:
Boxplot can now deal with multiple variables

Index: plot_options.php
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/plots/plot_options.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** plot_options.php	5 Apr 2006 10:10:04 -0000	1.3
--- plot_options.php	5 Apr 2006 19:34:03 -0000	1.4
***************
*** 9,14 ****
  	$log; $xaxt; $yaxt; $xlim; $ylim; $xlab; $ylab;
  
! 	$xvar = getRK_val ("xvar");
! 	$yvar = getRK_val ("yvar");
  	if ($yvar == "") {
  		$yvar = "1:length (" . $xvar .")";
--- 9,25 ----
  	$log; $xaxt; $yaxt; $xlim; $ylim; $xlab; $ylab;
  
! 	$xvars = split ("\n", getRK_val ("xvar"));
! 	if (count ($xvars) > 1) {
! 		$xvar = "c (" . join (", ", $xvars) . ")";
! 	} else {
! 		$xvar = $xvars[0];
! 	}
! 	$yvars = getRK_val ("yvar");
! 	if (count ($yvars) > 1) {
! 		$yvar = "c (" . join (", ", $yvars) . ")";
! 	} else {
! 		$yvar = $yvars[0];
! 	}
! 
  	if ($yvar == "") {
  		$yvar = "1:length (" . $xvar .")";
***************
*** 19,74 ****
  	// X axis
  	$xaxt = getRK_val ("xaxt");
! 	$have_x_axis = ($xaxt == "");
! 	if ($have_x_axis) {
! 		$log .= getRK_val ("xlog");
  
! 		$xlab = getRK_val ("xlab");
! 		if (($xlab != "") && (getRK_val ("xlabisexp") != "1")) {
! 			$xlab = "\"" . $xlab . "\"";
! 		}
! 		if ($xlab != "") $xlab = ", xlab=" . $xlab;
  
! 		$xminvalue = getRK_val ("xminvalue");
! 		$xmaxvalue = getRK_val ("xmaxvalue");
! 		if (($xminvalue != "") || ($xmaxvalue != "")) {
! 			$xlim = ", xlim=c (";
! 			if ($xminvalue == "") $xlim .= "min (" . $xvar . ")";
! 			else $xlim .= $xminvalue;
! 			$xlim .= ", ";
! 			if ($xmaxvalue == "") $xlim .= "max (" . $xvar . ")";
! 			else $xlim .= $xmaxvalue;
! 			$xlim .= ")";
! 		}
! 	} else {
! 		$xaxt = ", xaxt=\"" . $xaxt . "\"";
  	}
  
  	// same for Y axis
  	$yaxt = getRK_val ("yaxt");
! 	$have_y_axis = ($yaxt == "");
! 	if ($have_y_axis) {
! 		$log .= getRK_val ("ylog");
  
! 		$ylab = getRK_val ("ylab");
! 		if (($ylab != "") && (getRK_val ("ylabisexp") != "1")) {
! 			$ylab = "\"" . $ylab . "\"";
! 		}
! 		if ($ylab != "") $ylab = ", ylab=" . $ylab;
  
! 		$yminvalue = getRK_val ("yminvalue");
! 		$ymaxvalue = getRK_val ("ymaxvalue");
! 		if (($yminvalue != "") || ($ymaxvalue != "")) {
! 			$ylim = ", ylim=c (";
! 			if ($yminvalue == "") $ylim .= "min (" . $yvar . ")";
! 			else $ylim .= $yminvalue . ", ";
! 			$ylim .= ", ";
! 			if ($ymaxvalue == "") $ylim .= "max (" . $yvar . ")";
! 			else $ylim .= $ymaxvalue;
! 			$ylim .= ")";
! 		}
! 	} else {
! 		$yaxt = ", yaxt=\"" . $yaxt . "\"";
  	}
  
  	// final touches
  	if ($log != "") $log = ", log=\"" . $log . "\"";
--- 30,83 ----
  	// X axis
  	$xaxt = getRK_val ("xaxt");
! 	if ($xaxt != "") {
! 		$xaxt = ", xaxt=\"" . $xaxt . "\"";
! 	}
! 	$log .= getRK_val ("xlog");
  
! 	$xlab = getRK_val ("xlab");
! 	if (($xlab != "") && (getRK_val ("xlabisexp") != "1")) {
! 		$xlab = "\"" . $xlab . "\"";
! 	}
! 	if ($xlab != "") $xlab = ", xlab=" . $xlab;
  
! 	$xminvalue = getRK_val ("xminvalue");
! 	$xmaxvalue = getRK_val ("xmaxvalue");
! 	if (($xminvalue != "") || ($xmaxvalue != "")) {
! 		$xlim = ", xlim=c (";
! 		if ($xminvalue == "") $xlim .= "min (" . $xvar . ")";
! 		else $xlim .= $xminvalue;
! 		$xlim .= ", ";
! 		if ($xmaxvalue == "") $xlim .= "max (" . $xvar . ")";
! 		else $xlim .= $xmaxvalue;
! 		$xlim .= ")";
  	}
  
+ 
  	// same for Y axis
  	$yaxt = getRK_val ("yaxt");
! 	if ($yaxt != ""){
! 		$yaxt = ", yaxt=\"" . $yaxt . "\"";
! 	}
! 	$log .= getRK_val ("ylog");
  
! 	$ylab = getRK_val ("ylab");
! 	if (($ylab != "") && (getRK_val ("ylabisexp") != "1")) {
! 		$ylab = "\"" . $ylab . "\"";
! 	}
! 	if ($ylab != "") $ylab = ", ylab=" . $ylab;
  
! 	$yminvalue = getRK_val ("yminvalue");
! 	$ymaxvalue = getRK_val ("ymaxvalue");
! 	if (($yminvalue != "") || ($ymaxvalue != "")) {
! 		$ylim = ", ylim=c (";
! 		if ($yminvalue == "") $ylim .= "min (" . $yvar . ")";
! 		else $ylim .= $yminvalue . ", ";
! 		$ylim .= ", ";
! 		if ($ymaxvalue == "") $ylim .= "max (" . $yvar . ")";
! 		else $ylim .= $ymaxvalue;
! 		$ylim .= ")";
  	}
  
+ 
  	// final touches
  	if ($log != "") $log = ", log=\"" . $log . "\"";

Index: box_plot.xml
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/plots/box_plot.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** box_plot.xml	5 Apr 2006 15:03:30 -0000	1.2
--- box_plot.xml	5 Apr 2006 19:34:03 -0000	1.3
***************
*** 11,15 ****
  		<row>
  		<varselector id="vars" />
! 		<varslot multi="false" type="numeric" source="vars" id="x" label="variable(s):" required="true" />
  		</row>
  	</tab>
--- 11,15 ----
  		<row>
  		<varselector id="vars" />
! 		<varslot multi="true" type="numeric" source="vars" id="x" label="variable(s):" required="true" />
  		</row>
  	</tab>

Index: box_plot.php
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugins/plots/box_plot.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** box_plot.php	5 Apr 2006 15:03:30 -0000	1.2
--- box_plot.php	5 Apr 2006 19:34:02 -0000	1.3
***************
*** 7,15 ****
  	
  	function printout () {
! 	$x = getRK_val ("x");
  ?>
! rk.header ("Boxplot", list ("Variable", rk.get.description (<? echo ($x); ?>)))
  rk.graph.on()
! boxplot (<? echo ($x); ?>, notch = <? getRK ("notch") ?>, outline = <? getRK("outline")?>, horizontal = <? getRK("orientation") ?><? getRK ("plotoptions.code.printout"); ?>)
  rk.graph.off ()
  <?
--- 7,17 ----
  	
  	function printout () {
! 	$xvarsstring = join (", ", split ("\n", getRK_val ("x")));
! 	$xvars = "list (" . $xvarsstring . ")";
! 	$xvarsstring = str_replace (array ("\\", "\""), array ("\\\\", "\\\""), $xvarsstring);
  ?>
! rk.header ("Boxplot", list ("Variable(s)", "<?echo ($xvarsstring); ?>"))
  rk.graph.on()
! boxplot (<? echo ($xvars); ?>, notch = <? getRK ("notch") ?>, outline = <? getRK("outline")?>, horizontal = <? getRK("orientation") ?><? getRK ("plotoptions.code.printout"); ?>)
  rk.graph.off ()
  <?





More information about the rkward-tracker mailing list