[R-SIG-Mac] Dashed line not evenly separated
Zhang, Jialin
jzh@ng @end|ng |rom m@th@m@@t@te@edu
Wed Feb 23 23:41:14 CET 2022
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:
[Plot 1]
As we could observe, the end portion of the dashed line is almost a solid line. I posted the question on https://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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20220223/81fc7289/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 67142 bytes
Desc: image001.png
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20220223/81fc7289/attachment-0001.png>
More information about the R-SIG-Mac
mailing list