[R-SIG-Mac] pdf font issue for square bracket

Koenker, Roger W rkoenker @end|ng |rom ||||no|@@edu
Wed Jun 3 15:40:09 CEST 2020


If someone could advise me on how to get the “]” and “(“ characters to look 
remotely like they should in the following code, I would be eternally grateful.
Having experimented with pdf.options() and the vfont option for text() I’m at
a loss.  Rather than “]” I see only a black rectangle.

> sessionInfo()
R version 3.6.2 Patched (2019-12-12 r77564)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

# PDF Font issue for "]"
v <- c(-0.59103110,0.02659437,-1.51655310,-1.36265335,
       1.17848916,-0.93415132,1.32360565,0.62491779,-0.04572296,-1.00412058)
y <- c(1,1,1,0,1,0,1,0,1,0)
pdf("One.pdf", height = 2, width = 7)
plot(v[y==1],sample(c(-1,1),sum(y),replace = TRUE), type = "n", 
     axes = FALSE,  xlim = range(v),xlab = "", ylab = "")
text(v[y==1],rep(0,sum(y)), "]", cex = 2)
abline(h = 0)
text(v[y==0],rep(0,n-sum(y)), "(", cex = 2, col=2)
segments(c(vo[1]-0.1,vo)[klmax],c(0,0),c(vo[1]-0.1,vo)[klmax+1],c(0,0), 
	 col = 2, lwd = 2)  # (use right end point to represent interval)
dev.off()



More information about the R-SIG-Mac mailing list