[R] Bug 14340 - Symbols() plots with wrongly scaled y-axis
nancynyk at gmail.com
nancynyk at gmail.com
Sat Jul 17 18:21:54 CEST 2010
Hello, I submitted this bug report to r-core and got a rejection
saying I should post to r-help.
This is my first time ever submitting a bug report, so forgive me if
I'm using some wrong format.
So, here's my bug report:
Component: Graphics
OS: Mac OS 10.5.8, X11 XQuartz 2.5.0
Summary:
In the symbols function of the graphics package, scaling of the y-axis is
wrong, causing symbols that should be separate to overlap in the y-direction
(x-direction is okay).
Description:
Attached is a plot that should be of circles of radius 5 spaced exactly with
their centers 10 apart in both x and y directions, so that they should be
packed with the circles touching edge-to-edge. In the y-direction, somehow the
plotting scale is wrong such that the circles overlap. I've plotted horizontal
and vertical lines at x=45,50,55, and y=45,50,55, as well as two squares with
side=10. The squares are also overlapping in the vertical scale.
Steps to reproduce:
Here are the commands I used to generate this:
maptrees = function(n=1,a=1,b=1,h=2,view="horz",fg=1,np=FALSE,add=TRUE) {
#n = tree density (#/m2)
#a = crown horizontal radius (m)
#b = crown vertical radius (m)
#h = tree height (m)
#view = "horz", "vert"
#np = TRUE if new plot desired
if (np) {
quartz(width=6, height=6)
add=!np
}
dx = sqrt(1/n)
x = rep(dx*(1:10),10)
y = as.vector(t(matrix(x,10,10)))
if (view=="horz") {
circles = rep(a,100)
symbols(x=x,y=y,circles=circles, fg=fg,inches=FALSE,add=add)
points(x,y,pch='.')
mtext(paste("n=",n,", d=",dx,", a=",a))
} else {
#mtext(paste("n=",n,", d=",dx,", a=",a,", b=",b,", h=",h))
}
return(cbind(x,y,circles))
}
Commands:
junk =maptrees(n= 0.01, a=5,add=FALSE)
lines(c(0,100),c(45,45))
lines(c(0,100),c(55,55))
lines(c(0,100),c(50,50))
lines(c(50,50),c(0,100))
lines(c(55,55),c(0,100))
lines(c(45,45),c(0,100))
symbols(50,50,squares=10,fg=2, add=TRUE,inches=FALSE)
symbols(50,60,squares=10,fg=2, add=TRUE,inches=FALSE)
Actual results: See attached plot.
Expected results: The circles and squares in the plot should be edge-to-edge,
not overlapping in the vertical direction.
Build Date and Platform: Build 2010-7-16 on Mac 10.5.8
I am using a MacBookPro:
platform x86_64-apple-darwin9.8.0
arch x86_64
os darwin9.8.0
system x86_64, darwin9.8.0
status
major 2
minor 11.1
year 2010
month 05
day 31
svn rev 52157
language R
version.string R version 2.11.1 (2010-05-31)
I could not find another bug report of this problem.
Thanks to anyone who can help.
Nancy Kiang
--
More information about the R-help
mailing list