svg(SVGAnnotation)
svg()所属R语言包:SVGAnnotation
Wrapper for the svg() function in the grDevices to create a plot
SVG()包装功能在grDevices创建一个图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function acts as a front-end/wrapper function for the corresponding function in the grDevices package. The intent is that the caller both opens the device and provides the commands to generate the entire plot within this call. This function creates the graphics device in the same way the grDevices (or CairoSVG on windows) function does. It then evaluates cmd in order to generate the plot. It then closes the graphics device and reads the SVG file back into R using the XML package. It adds the text of the R command cmd to the SVG file and writes that out again. If addInfo is TRUE (and if the plot is a lattice plot) it adds a great deal of meta-information to the SVG elements, including details about the lattice plot and also attempting to identify the type of each top-level element within the top-most <g> element in the SVG.
这个函数充当了相应的功能在grDevices包front-end/wrapper功能。这样做的目的是,来电者都打开设备,并提供命令来生成整个小区内这一呼吁。此功能的grDevices(或在Windows CairoSVG)的功能不以同样的方式创建图形设备。然后计算cmd以产生的图。然后关闭图形设备和SVG文件读入R的使用XML包。它增加了R命令cmdSVG文件的文本,并再次写入了。如果addInfo是TRUE(如果图是一个格子图)增加了很大的元信息SVG元素,包括有关的格子图的详细信息,还试图找出类型每个顶层元素,在最上面的<g>在SVG元素。
One can have the SVG document returned as a parsed XML document. This allows us to ignore the creation of the file and "pretend" that the SVG content is created directly in memory.
一个可以有SVG文档解析XML文档返回。这使得我们可以忽略该文件的创建和“假装”,直接在内存中创建SVG内容。
用法----------Usage----------
svgPlot(cmd, filename = paste(tempfile(), "svg", sep = "."), ...,
asXML = missing(filename),
print = inherits(ans, "trellis"),
removeFile = asXML, addInfo = TRUE)
参数----------Arguments----------
参数:filename
the name of the file to which the plot is written
图的书面文件的名称
参数:cmd
the R expression generating the plot
R表达产生积
参数:...
any additional arguments to the grDevices svg function, e.g. the dimensions of the plot, point size, background, ...
任何额外的参数grDevicessvg功能,例如图点的大小,尺寸,背景,...
参数:asXML
a logical value which indicates that whether the SVG document should be parsed and returned. The file is still created and left in place.
这表明,SVG文件是否应该被解析并返回一个逻辑值。该文件仍然是创建并留在原地。
参数:print
a logical value indicating whether we need to explicitly print the result of cmd to generate the plot. This is necessary for lattice plots.
一个逻辑值,该值指示,是否我们需要明确打印cmd生成的图的结果。格图,这是必要的。
参数:removeFile
a logical value indicating whether to delete the file that was created by the svg device. If one wants the parsed XML document returne, there is typically no need to keep the file, so this option controls whether it is removed at the end of the call to this function.
一个逻辑值,指示是否删除svg设备创建的文件。如果想要解析的XML文档returne,通常是有没有需要保留的文件,所以此选项控制是否在调用这个函数结束删除。
参数:addInfo
a logical value that controls whether meta-information is added to the SVG document that both describes the plot and also attempts to identify the top-level SVG elements in the display.
一个逻辑值,控制元数据信息是否被添加到SVG文档都描述的图,也试图找出在显示顶级的SVG元素。
值----------Value----------
The value of filename.
filename值。
作者(S)----------Author(s)----------
Duncan Temple Lang
参见----------See Also----------
svg
svg
举例----------Examples----------
doc = svgPlot(plot(1:10))
svgPlot({
plot(rnorm(100), col = c("red", "green"))
abline(v = 0, lwd = 2, lty = 3)
}, "tmp1.svg")
data(mtcars)
library(lattice)
pp = svgPlot(xyplot( mpg ~ wt | am + cyl, mtcars, group = carb,
auto.key = list(columns = 4, space ="right")))
getSVGNodeTypes(pp)
dim(pp)
x = getLatticeObject(pp)
# with a user-specified key.[用户指定的关键。]
o = svgPlot(xyplot( mpg ~ wt | am + cyl, mtcars, group = carb,
key = simpleKey(text = c("A", "B", "C"),
points = FALSE,
columns = 3)))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|