plotAndSave(ttutils)
plotAndSave()所属R语言包:ttutils
Display And Save A Plot
显示和保存的图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
plotAndSave saves a plot as “pdf”, “(e)ps”, “jp(e)g”, “png”, “bmp”, “tiff”, “emf” and/or “wmf” and additionally displays the plot.
plotAndSave节省了图如“PDF”,“(五)PS”,“JP(E)G”,“PNG”,“BMP”,“TIFF”,“EMF”和/或“WMF”,另外显示的图。
用法----------Usage----------
plotAndSave(plot.func, plot.name, ..., folder=getwd(),
format=c("eps", "pdf"),
options=list(eps = list(onefile=TRUE, horizontal=FALSE,
paper="special",
width=7, height=7),
ps = list(onefile=TRUE, horizontal=FALSE,
paper="special",
width=7, height=7),
pdf = list(onefile=TRUE)),
do.plot=TRUE, do.return=do.plot)
参数----------Arguments----------
参数:plot.func
either a function or a non-empty character string naming the plotting function to be called.
一个函数或一个非空的字符串命名的绘图函数被调用。
参数:plot.name
a character string (without any suffix such as “.pdf” or “.eps”) giving the name of the file where the plot should be saved to.
一个字符串(不带任何后缀,例如“。pdf”或“参与者”)提供的图应该被保存到的文件的名称。
参数:...
additional arguments to be passed to the plotting function.
额外的参数被传递到绘图功能。
参数:folder
a character string giving the name of the folder to which the plot should be saved. The default is the current directory.
一个字符串,给人的图应该被保存的文件夹的名称。默认值是当前目录。
参数:format
output format. Must be a subset of (“pdf”, “(e)ps”, “jp(e)g”, “png”, “bmp”, “tiff”, “emf”, “wmf”). The latter two can be used only on with a Windows OS. The default is to produce both an eps-file and a pdf-file. Can be abbreviated.
输出格式。必须是一个子集(“PDF”,“(五)PS”,“JP(E)G”,“PNG”,“BMP”,“TIFF”,“EMF”,“ WMF“)。与Windows操作系统,可以使用仅在后面的两个。默认生成的EPS文件和一个pdf文件。可以缩写。
参数:options
named list of options to be passed to the respective device driver. Each entry of the list is an option list for the device corresponding to the name of the list item.
命名的选项列表将被传递给相应的设备驱动程序。的列表中的每个条目是一个选项列表的列表项的名称相对应的设备。
参数:do.plot
logical. If TRUE (the default) the plot is displayed.
逻辑。如果TRUE(默认值)的图被显示出来。
参数:do.return
logical. If TRUE the return value of the plotting function is returned. Defaults to the value of the parameter do.plot.
逻辑。如果TRUE的绘图函数的返回值被返回。默认值的参数do.plot。
Details
详细信息----------Details----------
The purpose of this function is to produce a plot on the monitor and to save it to a file simultaneously.
这个功能的目的是产生积在监视器上,并同时保存到一个文件中。
The file name must be given without any file-suffix. Depending on the argument format the function then generates the respective file with the appropriate suffix. The path should not be included in the file name, since the location where the files should be saved to is controlled by the parameter folder.
必须没有任何文件后缀的文件名。根据的说法format的功能与相应的后缀,然后生成相应的文件。路径不应包含在文件名中,因为位置的文件应该被保存到控制参数folder。
The function needs a plotting function to be defined, which actually does the plotting itself. Additional arguments (e.g. further graphical parameters) can be passed to plotAndSave, which in turn, passes these arguments down to the plotting function,
该函数需要一个绘图功能来定义,这实际上是绘制本身。额外的参数(例如,进一步的图形参数)可以通过plotAndSave,这反过来,通过这些参数的绘图功能,
The parameters of devices are controlled by the arguments options.
的设备的参数所控制的参数options。
值----------Value----------
the return value of the plotting function.
的绘图函数的返回值。
注意----------Note----------
When using Trellis plots from package lattice one has to assure that the plotting function actually does the plotting. Since the default behaviour of Trellis plots is just to return the Trellis object, one should wrap the call to the particular lattice function in a call of the function print. The generic function print ensures that the plot is displayed and not just returned
当使用网格图,从包装lattice,以确保绘图功能实际上是绘图。由于网格图的默认行为是刚刚返回的格状物体,应该换的特定lattice函数调用在通话的功能print。通用功能print显示,该图而不是仅仅返回
(作者)----------Author(s)----------
Thorn Thaler
参见----------See Also----------
pdf, postscript, jpeg, png, bmp, tiff
pdf,postscript,jpeg,png,bmp,tiff
实例----------Examples----------
## Not run: [#不运行:]
## Plotting Function[#绘图功能]
# For 'lattice' graphics:[对于“格”的图形:]
# WRONG:[错误的:]
# f <- function(x, ...) xyplot(x~sin(x), ...)[f < - 函数(x,...)xyplot(X-SIN(X),...)]
# CORRECT:[更正:]
# f <- function(x, ...) print(xyplot(x~sin(x), ...))[F < - 函数(x,...)打印(xyplot(X~SIN(X),...))]
f <- function(x, ...) plot(x, sin(x), col=2, type="l", ...)
# Save the plot as "Sine_Function.pdf" in the current folder[保存当前文件夹中的图为“Sine_Function.pdf”]
# and add a title to the plot[添加标题的图]
plotAndSave(f, "Sine_Function", x=seq(-pi, pi, length=100),
main="Sine-Function", format="pd")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|