[R-SIG-Mac] Dashed line not evenly separated

Daniel Kelley D@n@Ke||ey @end|ng |rom D@|@C@
Wed Feb 23 23:56:30 CET 2022


I get the same, on an intel mac with the same R and macOS monterey 12.3-beta.

I also get that if I just plot() the thing you're using lines() for.  I am guessing that it's a problem with the fact that the data get very close together towards the right-hand part of the plot.  That should not be a problem, of course; this seems like a bug.

Dan Kelley / Dept. Oceanography / Dalhousie University / Canada

On Feb 23, 2022, at 6:41 PM, Zhang, Jialin via R-SIG-Mac <r-sig-mac using r-project.org<mailto:r-sig-mac using r-project.org>> wrote:

CAUTION: The Sender of this email is not from within Dalhousie.
Hello Mac experts,

I wrote the following code on my Mac but the resulting plot has a weird dashed line. Here are the codes:

zeta.ppt <- function(v){
  ppt=function(i){
    result <- numeric(length(i))
    for (j in i){
      if (j < 11) {result[j] <- (11-j)/110}
      else {result[j] <- 3/pi^2/(j-10)^2}
    }
    result
  }
  p <- ppt(1:10000)
  printout <- numeric(length(v))
  for (k in 1:length(v)) {
    printout[k] <- sum(p*(1-p)^v[k])
  }
  printout
}
zeta.sept <- function(v){
  sept=function(i){
    result <- numeric(length(i))
    for (j in i){
      if (j < 11) {result[j] <- (11-j)/110}
      else {result[j] <- 0.5/1.670407*exp(-sqrt(j-10))}
    }
    result
  }
  p <- sept(1:10000)
  printout <- numeric(length(v))
  for (k in 1:length(v)) {
    printout[k] <- sum(p*(1-p)^v[k])
  }
  printout
}
tau.ppt <- function(v){
  v*zeta.ppt(v)
}
tau.sept <- function(v){
  v*zeta.sept(v)
}
plot(log(tau.ppt(1:20000))~log(1:20000), xlim = c(0,10), ylim=c(0, 5), axes = F, ylab = "", xlab = "", type = "l")
lines(log(tau.sept(1:20000))~log(1:20000), lty = 2, type = "l")
box()


Here is the plot I got:
<image001.png>

As we could observe, the end portion of the dashed line is almost a solid line. I posted the question onhttps://stackoverflow.com/questions/71241028/plot-line-types-in-r as well and seems they can run my codes with perfect dashed line on Windows OS.

I have tried it on both intel Mac and M1 Mac, both gave me weird dashed lines. I have tried it in both R and RStudio. Here is my sessionsInfo:


> sessionInfo()

R version 4.1.2 (2021-11-01)

Platform: x86_64-apple-darwin17.0 (64-bit)

Running under: macOS Monterey 12.2.1



Matrix products: default

LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib



locale:

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8



attached base packages:

[1] stats     graphics  grDevices utils     datasets  methods   base



loaded via a namespace (and not attached):

[1] compiler_4.1.2 tools_4.1.2




Please advise. Thank you!

—

Jialin Zhang (JZ), Assistant Professor of Statistics
Department of Mathematics and Statistics
Mississippi State University
tel: (662) 325-7137; email: jzhang using math.msstate.edu<mailto:jzhang using math.msstate.edu>

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac using r-project.org<mailto:R-SIG-Mac using r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list