[Rd] plotmath under windows (PR#3672)

mh.smith at niwa.co.nz mh.smith at niwa.co.nz
Thu Aug 7 02:28:30 MEST 2003


Full_Name: Murray H Smith
Version: 1.7.1
OS: Windows2000
Submission from: (NULL) (202.36.29.1)


This alleged bug is Windows specific and occurs when using Windows metafile
plots. 
The problem does not occur in a Linux version.
It does not occur in the pt rintout when a graphic is saved to a postscript file
under Windows.

The problem came to light when using plotmath to label a plot with latitudes
containing degree symbols. 

If expression(40 * degree) is used it is written on the default line for
labels.

If expression(paste(40 * degree, " S") is used it displced closer to the axis.
Pasting any character (except "") has this effect.

The following code illustrates the problem.

par(mfrow =c(3,2))

	# plotmath not used
plot(seq(-41, -40, 0.5), c(0, 1, 0), type = "n", xlab = "latitude", ylab = "",
xaxt = "n", yaxt = "n")
axis(1, at = seq(-41, -40, 0.5), 
	labels = seq(41 , 40, -0.5))
	
	# plotmath not used but characters pasted into labels
plot(seq(-41, -40, 0.5), c(0, 1, 0), type = "n", xlab = "latitude", ylab = "",
xaxt = "n", yaxt = "n")
axis(1, at = seq(-41, -40, 0.5), 
	labels = paste(seq(41, 40, -0.5), "S"))

	# last label has no character component
plot(seq(-41, -40, 0.5), c(0, 1, 0), type = "n", xlab = "latitude", ylab = "",
xaxt = "n", yaxt = "n")
axis(1, at = seq(-41, -40, 0.5), 
	labels = expression(paste(41 * degree, " S"), paste(40 * degree, " ", 30 *
minute), 40 * degree))

	# last label has no plotmath component
plot(seq(-41, -40, 0.5), c(0, 1, 0), type = "n", xlab = "latitude", ylab = "",
xaxt = "n", yaxt = "n")
axis(1, at = seq(-41, -40, 0.5), 
	labels = expression(paste(41 * degree, " S"), paste(40 * degree, " ", 30 *
minute), 40))

	# last label has null character component
plot(seq(-41, -40, 0.5), c(0, 1, 0), type = "n", xlab = "latitude", ylab = "",
xaxt = "n", yaxt = "n")
axis(1, at = seq(-41, -40, 0.5), 
	labels = expression(paste(41 * degree, " S"), paste(40 * degree, " ", 30 *
minute), paste(40 * degree,  "")))

	# last label has spaces character component
plot(seq(-41, -40, 0.5), c(0, 1, 0), type = "n", xlab = "latitude", ylab = "",
xaxt = "n", yaxt = "n")
axis(1, at = seq(-41, -40, 0.5), 
	labels = expression(paste(41 * degree, " S"), paste(40 * degree, " ", 30 *
minute), paste(" ", 40 * degree, " ")))

par(mfrow =c(1,1))



More information about the R-devel mailing list