dev2(grDevices)
dev2()所属R语言包:grDevices
Copy Graphics Between Multiple Devices
多台设备之间复制图形
译者:生物统计家园网 机器人LoveR
描述----------Description----------
dev.copy copies the graphics contents of the current device to the device specified by which or to a new device which has been created by the function specified by device (it is an error to specify both which and device). (If recording is off on the current device, there are no contents to copy: this will result in no plot or an empty plot.) The device copied to becomes the current device.
dev.copywhich或device(这是一个错误指定所指定的函数创建一个新的设备已指定的设备当前设备的图形内容复制which和device)。 (如果当前设备上的录音,有没有复制的内容:这将导致在没有图或一个空的图。)复制到该设备成为当前设备。
dev.print copies the graphics contents of the current device to a new device which has been created by the function specified by device and then shuts the new device.
dev.print当前设备的图形内容复制到一个新的设备已创建由device指定的函数,然后关闭新设备。
dev.copy2eps is similar to dev.print but produces an EPSF output file in portrait orientation (horizontal = FALSE). dev.copy2pdf is the analogue for PDF output.
dev.copy2eps是dev.print类似,但产生纵向EPSF输出文件(horizontal = FALSE)。 dev.copy2pdfPDF输出的模拟。
dev.control allows the user to control the recording of graphics operations in a device. If displaylist is "inhibit" ("enable") then recording is turned off (on). It is only safe to change this at the beginning of a plot (just before or just after a new page). Initially recording is on for screen devices, and off for print devices.
dev.control允许用户图形操作控制设备的录音。如果displaylist是"inhibit"("enable"),然后记录被关闭(上)。这是唯一安全的改变,在一个图的开始(之前或刚过了新的一页)。最初录制屏幕设备,打印设备。
用法----------Usage----------
dev.copy(device, ..., which = dev.next())
dev.print(device = postscript, ...)
dev.copy2eps(...)
dev.copy2pdf(..., out.type = "pdf")
dev.control(displaylist = c("inhibit", "enable"))
参数----------Arguments----------
参数:device
A device function (e.g., x11, postscript, ...)
设备的功能(例如,x11,postscript,...)
参数:...
Arguments to the device function above: for dev.copy2eps arguments to postscript and for dev.copy2pdf, arguments to pdf. For dev.print, this includes which and by default any postscript arguments.
以上参数device功能:dev.copy2eps参数postscript和dev.copy2pdf,参数pdf的。 dev.print,这包括which“默认任何postscript参数。
参数:which
A device number specifying the device to copy to.
复制到指定设备的设备数量。
参数:out.type
The name of the output device: only "pdf" is allowed on Windows.
输出设备的名称:只有"pdf"被允许在Windows上。
参数:displaylist
A character string: the only valid values are "inhibit" and "enable".
一个字符串:唯一有效的值是"inhibit"和"enable"。
Details
详情----------Details----------
Note that these functions copy the device region and not a plot: the background colour of the device surface is part of what is copied. Most screen devices default to a transparent background, which is probably not what is needed when copying to a device such as png.
请注意,这些功能的复制设备的区域,而不是一个图:在设备表面的背景颜色是什么被复制的一部分。大多数屏幕设备的默认为透明的背景下,这可能是没有什么是需要复制到设备png等时。
For dev.copy2eps and dev.copy2pdf, width and height are taken from the current device unless otherwise specified. If just one of width and height is specified, the other is adjusted to preserve the aspect ratio of the device being copied. The default file name is Rplot.eps or Rplot.pdf, and can be overridden by specifying a file argument.
dev.copy2eps和dev.copy2pdf,width和height从当前设备,除非另有规定。如果只是一个width和height被指定,另一种是调整,以保持被复制设备的宽高比。默认的文件名是Rplot.eps或Rplot.pdf,可以通过指定一个file参数覆盖。
Copying to devices such as postscript and pdf which need font families pre-specified needs extra care – R is unaware of which families were used in a plot and so they will need to manually specified by the fonts argument passed as part of .... Similarly, if the device to be copied from was opened with a family argument, a suitable family argument will need to be included in ....
复制到如postscript和pdf需要预先指定的需求格外小心字体家庭设备 - R是不知道其中的家庭图,所以他们将需要手动指定由 fonts参数,通过作为...的一部分。同样,如果要复制从设备被打开了family参数,一个合适的family参数将需要包括在...。
The default for dev.print is to produce and print a postscript copy. This will not work unless options("printcmd") is set suitably and you have a PostScript printer: see postscript for how to set this up. Windows users may prefer to use dev.print(win.print).
dev.print默认是生产和打印的PostScript副本。这不会工作,除非options("printcmd")设置适当的和你有一个PostScript打印机:postscript如何设置此。 Windows用户可能更喜欢使用dev.print(win.print)。
dev.print is most useful for producing a postscript print (its default) when the following applies. Unless file is specified, the plot will be printed. Unless width, height and pointsize are specified the plot dimensions will be taken from the current device, shrunk if necessary to fit on the paper. (pointsize is rescaled if the plot is shrunk.) If horizontal is not specified and the plot can be printed at full size by switching its value this is done instead of shrinking the plot region.
dev.print产生PostScript打印(默认)时,则适用以下是最有用的。除非file指定,该图将被打印出来。除非width,height和pointsize被指定的图尺寸将采取从目前的设备,如果有必要,以适应纸张上的缩水。 (pointsize重新调整,如果该图缩水。)如果horizontal没有被指定的图,可以打印开关它的价值,在全尺寸做到这一点,而不是缩小图区域。
If dev.print is used with a specified device (even postscript) it sets the width and height in the same way as dev.copy2eps. This will not be appropriate unless the device specifies dimensions in inches, in particular not for png, jpeg, tiff and bmp unless units="inches" is specified.
如果dev.print用指定的device(即使postscript)以同样的方式设置宽度和高度为dev.copy2eps。这会不会是适当的,除非该设备指定英寸的尺寸,特别是不png,jpeg,tiff和bmp除非units="inches"指定。
值----------Value----------
dev.copy returns the name and number of the device which has been copied to.
dev.copy返回已被复制到该设备的名称和编号。
dev.print, dev.copy2eps and dev.copy2pdf return the name and number of the device which has been copied from.
dev.print,dev.copy2eps和dev.copy2pdf返回已复制设备的名称和数量。
注意----------Note----------
Most devices (including all screen devices) have a display list which records all of the graphics operations that occur in the device. dev.copy copies graphics contents by copying the display list from one device to another device. Also, automatic redrawing of graphics contents following the resizing of a device depends on the contents of the display list.
大多数设备(包括所有屏幕设备)有一个显示列表记录所有发生在设备的图形操作。 dev.copy复制的图形内容从一个设备复制到另一台设备的显示列表。此外,设备调整后的图形自动重绘内容取决于显示列表的内容。
After the command dev.control("inhibit"), graphics operations are not recorded in the display list so that dev.copy and dev.print will not copy anything and the contents of a device will not be redrawn automatically if the device is resized.
该命令后dev.control("inhibit"),图形操作不记录显示列表中,使dev.copy和dev.print不会复制任何东西,如果自动设备,设备的内容将不会重绘调整。
The recording of graphics operations is relatively expensive in terms of memory so the command dev.control("inhibit") can be useful if memory usage is an issue.
图形操作的记录是在内存方面相对昂贵,所以命令dev.control("inhibit")可能是有用的,如果内存使用是一个问题。
参见----------See Also----------
dev.cur and other dev.xxx functions.
dev.cur和其他dev.xxx的函数。
举例----------Examples----------
## Not run: [#无法运行:]
x11()
plot(rnorm(10), main="Plot 1")
dev.copy(device=x11)
mtext("Copy 1", 3)
dev.print(width=6, height=6, horizontal=FALSE) # prints it[打印]
dev.off(dev.prev())
dev.off()
## End(Not run)[#结束(不运行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|