找回密码
 注册
查看: 3478|回复: 0

R语言:plotmath()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 19:06:43 | 显示全部楼层 |阅读模式
plotmath(grDevices)
plotmath()所属R语言包:grDevices

                                        Mathematical Annotation in R
                                         R中的数学诠释

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

If the text argument to one of the text-drawing functions (text, mtext, axis, legend) in R is an expression, the argument is interpreted as a mathematical expression and the output will be formatted according to TeX-like rules.  Expressions can also be used for titles, subtitles and x- and y-axis labels (but not for axis labels on persp plots).
如果文字绘图功能之一(text,text,mtext,axis)在R是一个表达式,参数是参数legend作为一个数学表达式,并解释将输出根据TEX样的规则格式化。表达式也可用于标题,字幕和x和y轴标签(但不适用于persp图上的轴标签)。

In most cases other language objects (names and calls, including formulas) are coerced to expressions and so can also be used.
在大多数情况下,其他语言中的对象(姓名和电话,包括公式)强制表达式,因此也可用于。


Details

详情----------Details----------

A mathematical expression must obey the normal rules of syntax for any R expression, but it is interpreted according to very different rules than for normal R expressions.
一个数学表达式必须服从任何R的表达语法的一般规则,但它是根据比正常ŕ表达非常不同的规则解释。

It is possible to produce many different mathematical symbols, generate sub- or superscripts, produce fractions, etc.
这是可能产生许多不同的数学符号,生成子标,产生分数等

The output from demo(plotmath) includes several tables which show the available features.  In these tables, the columns of grey text show sample R expressions, and the columns of black text show the resulting output.
demo(plotmath)输出包括几个表显示可用的功能。在这些表中,灰色文字显示样品ŕ表情,和黑色文字列列显示输出结果。

The available features are also described in the tables below:
可用的功能也被描述在下面的表格:

The symbol font uses Adobe Symbol encoding so, for example, a lower case mu can be obtained either by the special symbol mu or by symbol("m").  This provides access to symbols that have no special symbol name, for example, the universal, or forall, symbol is symbol("\042").  To see what symbols are available in this way use TestChars(font=5) as given in the examples for points: some are only available on some devices.
符号字体使用Adobe符号编码,例如,一个较低的情况下每亩可以得到特殊符号mu或symbol("m")。这提供了访问,没有什么特殊的符号名的符号,例如,通用,或FORALL,符号是symbol("\042")。看到什么是符号可用以这种方式使用TestChars(font=5)中points的例子:一些仅在某些设备上。

Note to TeX users: TeX's \Upsilon is Upsilon1, TeX's \varepsilon is close to epsilon, and there is no equivalent of TeX's \epsilon.  TeX's \varpi is close to omega1.  vartheta, varphi and varsigma are allowed as synonyms for theta1, phi1 and sigma1.
TeX用户请注意:TeX的\Upsilon是Upsilon1 TeX的\varepsilon是密切epsilon,有没有TeX的\epsilon相当于。 TeX的\varpi是密切omega1。 vartheta,varphi和varsigma允许theta1,phi1和sigma1的同义词。

sigma1 is also known as stigma, its Unicode name.
sigma1也被称为stigma,它的Unicode名称。

Control characters (e.g. \n) are not interpreted in character strings in plotmath, unlike normal plotting.
控制字符(例如\n)不解释字符串plotmath不像正常的图。

The fonts used are taken from the current font family, and so can be set by par(family=) in base graphics, and gpar(fontfamily=) in package grid.
从目前的字体家族使用的字体,所以可以设置par(family=)基本图形,并gpar(fontfamily=)包grid。

Note that bold, italic and bolditalic do not apply to symbols, and hence not to the Greek symbols such as mu which are displayed in the symbol font.  They also do not apply to numeric constants.
请注意bold,italic和bolditalic不适用的符号,因此不希腊符号,如mu符号字体显示。他们也并不适用于数字常量。


其他符号----------Other symbols----------

On many OSes and some graphics devices many other symbols are available as part of the standard text font, and all of the symbols in the Adobe Symbol encoding are in principle available via changing the font face or (see "Details") plotmath: see the examples section of points for a function to display them.  ("In principle" because some of the glyphs are missing from some implementations of the symbol font.)  Unfortunately, postscript and pdf have support for little more than European (not Greek) and CJK characters and the Adobe Symbol encoding (and in a few fonts, also Cyrillic characters).
许多操作系统和一些图形设备上的许多其他符号作为标准文本字体的一部分,在Adobe符号编码的符号都是可以通过改变字体或(见“详细资料”)plotmath原则:见points的例子第一个函数来显示他们。 (“原则”,因为从符号字体的一些实现中缺少一些字形。)不幸的是,postscript和pdf有一点比欧洲(希腊)和CJK字符支持和Adobe的符号编码(和几个字体,也西里尔字符)。

Any Unicode character can be entered into a text string via a \uxxxx escape, or used by number in a call to points.  The windows family of devices can display such characters if they are available in the font in use. This can often be used to display Greek letters in bold or italic.
任何Unicode字符可以通过\uxxxx逃逸进入一个文本字符串,或使用调用points在数。 windows家庭设备可以显示字符,如果他们是在使用中的字体。通常可以使用粗体或斜体显示希腊字母。

A good way to both find out which characters are available in a font and to determine the Unicode number is to use the "Character Map" accessory (usually on the "Start" menu under "Accessories->System Tools").  You can also copy-and-paste characters from the "Character Map" window to the Rgui console (but not to Rterm).
找出哪些字符字体,并确定Unicode数字的一个好办法是使用“字符映射表”附件(通常在“附件” - >“系统工具”下的“开始”菜单) 。你也可以复制和粘贴Rgui控制台(而不是Rterm)字符从“字符映射表”窗口。


参考文献----------References----------

mathematical annotation in plots. Journal of Computational and Graphical Statistics, 9, 582–599.
e.g. for Postscript http://www.adobe.com/products/postscript/pdfs/PLRM.pdf or PDF http://www.adobe.com/devnet/acrobat/pdfs/pdf_reference_1-7.pdf and in decimal, octal and hex at http://www.stat.auckland.ac.nz/~paul/R/CM/AdobeSym.html.

参见----------See Also----------

demo(plotmath), axis, mtext, text, title, substitute quote, bquote
demo(plotmath),axis,mtext,text,title,substitutequote,bquote


举例----------Examples----------


require(graphics)

x <- seq(-4, 4, len = 101)
y <- cbind(sin(x), cos(x))
matplot(x, y, type = "l", xaxt = "n",
        main = expression(paste(plain(sin) * phi, "  and  ",
                                plain(cos) * phi)),
        ylab = expression("sin" * phi, "cos" * phi), # only 1st is taken[只有第一次采取]
        xlab = expression(paste("Phase Angle ", phi)),
        col.main = "blue")
axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
     labels = expression(-pi, -pi/2, 0, pi/2, pi))


## How to combine "math" and numeric variables :[#如何结合“数学”和数字变量:]
plot(1:10, type="n", xlab="", ylab="", main = "plot math &amp; numbers")
theta <- 1.23 ; mtext(bquote(hat(theta) == .(theta)), line= .25)
for(i in 2:9)
    text(i,i+1, substitute(list(xi,eta) == group("(",list(x,y),")"),
                           list(x=i, y=i+1)))
## note that both of these use calls rather than expressions.[#注意,使用这些要求,而不是表达式。]
##[#]
text(1,10,  "Derivatives:", adj=0)
text(1,9.6, expression(
"             first: {f * minute}(x) " == {f * minute}(x)), adj=0)
text(1,9.0, expression(
"     second: {f * second}(x) "        == {f * second}(x)), adj=0)


plot(1:10, 1:10)
text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)",
     cex = .8)
text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
text(4, 6.4, "expression(bar(x) == sum(frac(x[i], n), i==1, n))",
     cex = .8)
text(8, 5, expression(paste(frac(1, sigma*sqrt(2*pi)), " ",
                            plain(e)^{frac(-(x-mu)^2, 2*sigma^2)})),
     cex = 1.2)

## some other useful symbols[#其他一些有用的符号]
plot.new(); plot.window(c(0,4), c(15,1))
text(1, 1, "universal", adj=0); text(2.5, 1,  "\\042")
text(3, 1, expression(symbol("\042")))
text(1, 2, "existential", adj=0); text(2.5, 2,  "\\044")
text(3, 2, expression(symbol("\044")))
text(1, 3, "suchthat", adj=0); text(2.5, 3,  "\\047")
text(3, 3, expression(symbol("\047")))
text(1, 4, "therefore", adj=0); text(2.5, 4,  "\\134")
text(3, 4, expression(symbol("\134")))
text(1, 5, "perpendicular", adj=0); text(2.5, 5,  "\\136")
text(3, 5, expression(symbol("\136")))
text(1, 6, "circlemultiply", adj=0); text(2.5, 6,  "\\304")
text(3, 6, expression(symbol("\304")))
text(1, 7, "circleplus", adj=0); text(2.5, 7,  "\\305")
text(3, 7, expression(symbol("\305")))
text(1, 8, "emptyset", adj=0); text(2.5, 8,  "\\306")
text(3, 8, expression(symbol("\306")))
text(1, 9, "angle", adj=0); text(2.5, 9,  "\\320")
text(3, 9, expression(symbol("\320")))
text(1, 10, "leftangle", adj=0); text(2.5, 10,  "\\341")
text(3, 10, expression(symbol("\341")))
text(1, 11, "rightangle", adj=0); text(2.5, 11,  "\\361")
text(3, 11, expression(symbol("\361")))

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 08:27 , Processed in 0.027374 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表