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

Zhang, Jialin jzh@ng @end|ng |rom m@th@m@@t@te@edu
Thu Feb 24 00:13:31 CET 2022


Yes, thank you John for the observation. Your code shows the same behavior on my Intel Mac as well.

Could anyone help make it look normal? Thanks!

�

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>


From: John Fox <jfox using mcmaster.ca>
Date: Wednesday, February 23, 2022 at 5:11 PM
To: Daniel Kelley <Dan.Kelley using Dal.Ca>, Zhang, Jialin <jzhang using math.msstate.edu>
Cc: r-sig-mac using r-project.org <r-sig-mac using r-project.org>
Subject: Re: [R-SIG-Mac] Dashed line not evenly separated
Dear Jialin Zhang and Dan,

You can simplify the example to

   plot(log10(1:1e4), lty = 2, type="l")

and observe the same behaviour -- in my case on an M1 Mac.

Best,
  John


On 2022-02-23 5:56 p.m., Daniel Kelley wrote:
> 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://secure-web.cisco.com/1C2jZBXabdphnm22sEK2OH8JJ_s4hBQhcAWdRxGw_6pBjqkW63sTcdXzzrNPVryJjrLh2aIwutJMj3H4fcbTQoeqz4HNLz2Qv6gFkTL3_145VGPdVtSC6Ayr7vSAZ_PTQKdV34CCG0swdUGqoD1vpGDIQ5rqHJt9ongNelIUAT63D48eU6sD912m2349D8vbQEWpV2e8UGYaL000vIa34gNvox1BWQ2DYjAgwx4C-XFyPjaE1BwBd3j5G4m9qlieUcECaeGmVTX_nvmZK6C0_4ys2O5_HjixyspzRbHnGUaJAYFyjOwLuRDfn6nZ7ETqe/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://secure-web.cisco.com/1C2jZBXabdphnm22sEK2OH8JJ_s4hBQhcAWdRxGw_6pBjqkW63sTcdXzzrNPVryJjrLh2aIwutJMj3H4fcbTQoeqz4HNLz2Qv6gFkTL3_145VGPdVtSC6Ayr7vSAZ_PTQKdV34CCG0swdUGqoD1vpGDIQ5rqHJt9ongNelIUAT63D48eU6sD912m2349D8vbQEWpV2e8UGYaL000vIa34gNvox1BWQ2DYjAgwx4C-XFyPjaE1BwBd3j5G4m9qlieUcECaeGmVTX_nvmZK6C0_4ys2O5_HjixyspzRbHnGUaJAYFyjOwLuRDfn6nZ7ETqe/https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac
--
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://secure-web.cisco.com/1zQuu3HCVSyc9bSv2w_UTFR_PcyZAR-iGHGepZbDWSbt0cNPFPyfAImkbWmIl95tbdbysOhl27C3XpIxRHn9uP0MiNVmYgle68e1DL2XI8E5WRD1vZ30a9S1WOR_CAix859xYqxDOxr3eo6Cmb6BxhbWhNbp6JTMzd-_5V6XHGxU4xM_ZYXrZhcQry_7MPqiPLFCZkP4lcOiWsMVvixGttjFBzI1UDxrKEMe_GfpUyRweqcKbje7_Uf_lspNFdXjIW3SEvvJ33rwHRtLpdUQAB3Lu8FbrocAEcLXh9tz0EIkuxHsY5hBBTl34NalNs74v/https%3A%2F%2Fsocialsciences.mcmaster.ca%2Fjfox%2F


	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list