From ihaka@stat.auckland.ac.nz  Mon Sep 22 22:38:38 1997
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Tue, 23 Sep 1997 09:38:38 +1200 (NZST)
Subject: R-alpha: mtext
Message-ID: <199709222138.JAA15965@stat1.stat.auckland.ac.nz>

Larry P Ammann <ammann@utdallas.edu> writes:

> Something seems to have broken mtext between the R-0.50-a1 and R-0.50-a4
> releases. It prints OK when side=2 or 4, but does not print if side=1 or 3.
> Try for example:

> plot(1:10, (-4:5)^2, main="Parabola Points", xlab="xlab")
> for(s in 1:10) {
>     mtext(paste("mtext(..,side=1, line=",-s,")"), side=1, line=-s)
>     mtext(paste("mtext(..,side=2, line=",-s,")"), side=2, line=-s)
>     mtext(paste("mtext(..,side=3, line=",-s,")"), side=3, line=-s)
>     mtext(paste("mtext(..,side=4, line=",-s,")"), side=4, line=-s)
> }


Ahhh.  It looks like I need to change my test example from plot(1:10)
to plot(rnorm(10)) ...

Here is the fix:  In src/main/plot.c at about line 1180, you will
find the lines:

	if(!FINITE(at)) {
		switch(side % 2) {
		case 0:
			at = (1 - adjx) * GP->usr[0] + adjx * GP->usr[1];
			break;
		case 1:
			at = (1 - adjx) * GP->usr[2] + adjx * GP->usr[3];
			break;
		}
	}

the bodies of the cases need to be swapped.  I.e. it should read

	if(!FINITE(at)) {
		switch(side % 2) {
		case 0:
			at = (1 - adjx) * GP->usr[2] + adjx * GP->usr[3];
			break;
		case 1:
			at = (1 - adjx) * GP->usr[0] + adjx * GP->usr[1];
			break;
		}
	}

Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: mtext
Ross Ihaka