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

R语言 RSVGTipsDevice包 devSVGTips()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-28 22:31:51 | 显示全部楼层 |阅读模式
devSVGTips(RSVGTipsDevice)
devSVGTips()所属R语言包:RSVGTipsDevice

                                        A graphics device for SVG with dynamic tips and hyperlinks
                                         SVG动态提示和超链接的图形设备

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

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

This function starts up an SVG graphics device that will write to a file.  The SVG shapes and text have optional tooltips and/or hyperlinks.
此功能启动一个的SVG图形设备将写入到一个文件中。 SVG图形和文本有可选的工具提示和/或超链接。


用法----------Usage----------


devSVGTips(file = "Rplots.svg", width = 7, height = 7,
       bg = "white", fg = "black", onefile=TRUE,
       xmlHeader=FALSE, useStyleAttributes=FALSE,
       toolTipMode = 1, toolTipFontSize = 10,
       toolTipOpacity = 1.0, title = "R SVG Plot", sub.special=TRUE)



参数----------Arguments----------

参数:file
the file where output will appear
文件输出将出现


参数:width
The width of the plot in inches
的图英寸的宽度


参数:height
the height of the plot in inches
高度的图英寸


参数:bg
the background color for the plot
图的背景颜色


参数:fg
the foreground color for the plot
图的前景色


参数:onefile
merge plot calls into onefile or separate them to separate pages
合并图需要到onefile或将它们分开到不同的页面


参数:xmlHeader
Print XML header or not (it is recommended to not print a header)
打印XML头(建议不打印头)


参数:useStyleAttributes
Specify shape attributes in a style attribute or as plain attributes (plain attributes is recommended)
在style属性或指定形状属性为纯属性(普通属性)


参数:toolTipMode
Mode of toop tips: 0 (no tool tips), 1, or 2 (number of lines of tool tip)
模式的托普提示:0(工具提示),1或2(刀尖的行数)


参数:toolTipFontSize
Size of font in tool tips (in points/pixels)
在工具提示的字体大小(以点/像素)


参数:toolTipOpacity
Opacity of toop tips: between 0 and 1.  A value of 0.9 allows the image behind the tooltip to be seen, but can render slowly on some viewers
不透明度的托普提示:在0和1之间。 0.9允许值的图像背后的提示,以待观察,但可以使一些观众慢慢


参数:title
Title of plot
图标题


参数:sub.special
Unless sub.special=FALSE, special SVG characters (ampersand, less-than, etc.) in title will be substituted by the appropriate XML encoding, except for an ampersand followed by lower-case letters and then a semi-colon (if these substitutions are not made, it is easy to inadvertently create unusable SVG files)
除非sub.special=FALSE,SVG字符(符号,小于等)在title将取代相应的XML编码,除了其次是小写字母的符号,然后一个半冒号(如果没有这些替代的,它很容易在不经意间创造无法使用SVG文件)


Details

详细信息----------Details----------

This graphics do not appear in any window while they are being drawn – SVG commands are written to a file and can be viewed in an SVG viewer after the plot is completed.
此图形没有出现在任何窗口中,而他们正在绘制 -  SVG命令写入到一个文件中,该图完成后,可以查看在SVG浏览器。

After the plot is completed, the function dev.off must be called to close the graphics device and flush all unwritten SVG commands to the file.
图完成后,函数dev.off必须调用,关闭图形处理装置,冲洗所有不成文SVG的命令的文件。

Text drawn on the graphic by commands like text() is subject to XML special characters being replaced by the corresponding XML encoding, except for an ampersand followed by lower-case letters and then a semi-colon.  This behavior is NOT controlled by sub.special and there is currently no way to turn it off.
在图形上绘制文本的命令,如text()是XML特殊字符被替换为相应的XML编码,除了符号,其次是小写字母,然后一个分号。这种行为是不是控制sub.special和目前还没有办法将其关闭。

This device is not implemented as one that can do clipping.  Thus, R commands like text will not draw the text if part of the text might be outside the plotting region.  This can be the cause of legend (or other functions that call text) omitting text.  The solution is to make sure that the text is drawn inside the plotting region, e.g., using commands like legend(...,     inset=0.01). If text is not appearing, use par(xpd=NA), which will do the least clipping of text.  The example plot svgplot13.svg in RSVGTipsDevice shows clipping that happens for various settings of par("xpd").
此设备没有实现,可以做剪报。因此,R命令,如text不会绘制文本的部分文字可能会超出绘图区域。这可能是legend(text)省略文字或其他功能的原因。解决的办法是确保绘制文本的绘图区域内,例如,使用命令legend(...,     inset=0.01)。如果文本没有出现,请使用的par(xpd=NA),这将至少剪裁的文字。这个例子的图svgplot13.svg在RSVGTipsDevice显示的剪裁,发生的各种设置par("xpd")。

The clipping behavior can result in labels unexpectedly not appearing in lattice graphics.  This can sometime be solved by making the region in which labels are drawn larger, e.g., by doing something like xyplot(strip.par.text=list(lines=2), ...).
,的剪辑行为可能会导致意外地没有出现在点阵图形的标签。这一段时间来解决,使该区域,在其中标注绘制较大,例如,通过做一些像xyplot(strip.par.text=list(lines=2), ...)。


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

SVG viewing Ways to view SVG files. Design and future of the RSVGTips device. Overview of the RSVGTips device (many more examples). setSVGShapeToolTip, setSVGShapeURL, getSVGToolTipMode, pictex, postscript, Devices.
SVG查看的方式来查看SVG文件。设计和未来的RSVGTips设备。概述的RSVGTips设备(更多的例子)。 setSVGShapeToolTip,setSVGShapeURL,getSVGToolTipMode,pictex,postscript,Devices。


实例----------Examples----------


## Not run: [#不运行:]
library("RSVGTipsDevice")
devSVGTips("svgplot1.svg", toolTipMode=1, title="SVG example plot 1: shapes and points, tooltips are title + 1 line")
plot(c(0,10),c(0,10), type="n", xlab="x", ylab="y", main="Example SVG plot with title+ 1 line tips (mode=1)")
setSVGShapeToolTip(title="A rectangle", desc="that is yellow")
rect(1,1,4,6, col='yellow')
setSVGShapeToolTip(title="1st circle with title only")
points(5.5,7.5,cex=20,pch=19,col='red')
setSVGShapeToolTip(title="A triangle", desc="big and green")
polygon(c(3,6,8), c(3,6,3), col='green')
# no tooltips on these points[在这些问题上没有工具提示]
points(2:8, 8:2, cex=3, pch=19, col='black')
# tooltips on each these points[每个这些点上的工具提示]
invisible(sapply(1:7, function(x) {setSVGShapeToolTip(title=paste("point", x)); points(x+1, 8-x, cex=3, pch=1, col='black')}))
setSVGShapeToolTip(title="Text", desc="can have a tool tip too!")
text(x=4, y=9, lab="Poke me!", col="blue")
dev.off()

# Not run in tests because uses the SemiPar package for the fuel.frame data[在测试中,由于采用半参数的fuel.frame数据包不运行]
# A plot of fuel mileage vs weight[燃油里程数与重量的图]
library("RSVGTipsDevice")
library("SemiPar")
data(fuel.frame)
fuel.frame <- cbind(fuel.frame,
    US=is.element(substring(fuel.frame$car.name, 1, 5),
                  c("Buick", "Chevr", "Chrys", "Dodge", "Eagle",
                    "Ford ", "Mercu", "Oldsm", "Plymo", "Ponti")))
devSVGTips("mlgvswgt1.svg", height=5, width=7, toolTipMode=1, title="Mileage vs Weight for autos, tooltips are title + 1 line")
plot(fuel.frame$Weight, fuel.frame$Mileage, type="n", xlab="Weight",
ylab="Miles per gallon", main="US cars in blue, imports in yellow")
for (i in seq(len=nrow(fuel.frame))) {
    setSVGShapeToolTip(title=fuel.frame[i,"car.name"],
        desc=paste(fuel.frame[i, "Type"], ", disp=", fuel.frame[i,"Disp."]))
    points(fuel.frame[i,"Weight"], fuel.frame[i,"Mileage"], pch=19,
        cex=2, col=if (fuel.frame[i,"US"]) "blue" else "yellow")
}
dev.off()

## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-27 22:22 , Processed in 0.038659 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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