使用符号字体映射的详细信息如下:
?plotmath
?points # to which plotmath sends you for mapping of 'symbol' characters
# And I do not like the plotmath-paste function,
# so translated to 'pure' expressions.
# The number arguments to symbol are numbers in octal.
plot(1, 1, pch = "")
text(1, 1.2,
expression(low ~italic(P)*"("*italic(p)~
symbol("\332")~ italic(q)*
"), -1 SD"),
cex = 1.2)
text(1, 0.8,
expression(low~italic(P)*
"("*symbol("\330")*italic(p)~symbol("\331")~ italic(q)*
"), -1 SD"),
cex = 1.2 )
这是要求显示符号字形及其十进制索引的代码。(注意:这是 Mac 上的 Symbol 字体。不能保证在任何地方都一样。)您仍然需要转换为八进制来引用以使用上面看到的“\nnn”形式:
> as.octmode(216)
[1] "330"
TestChars <- function(sign = 1, font = 1, ...)
{
MB <- l10n_info()$MBCS
r <- if(font == 5) { sign <- 1; c(32:126, 160:254)
} else if(MB) 32:126 else 32:255
if (sign == -1) r <- c(32:126, 160:255)
par(pty = "s")
plot(c(-1,16), c(-1,16), type = "n", xlab = "", ylab = "",
xaxs = "i", yaxs = "i",
main = "Symbol Font, Decimal Indices")
grid(17, 17, lty = 1) ; mtext(paste("MBCS:", MB))
for(i in r) try(points(i%%16, i%/%16, pch = sign*i, font = font,...))
for(i in r) try(text(x=i%%16, y=(i%/%16)-0.4, i, cex=0.5 , font = font,...))
}
TestChars(font = 5)