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

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

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

                                        PDF Graphics Device
                                         PDF图形设备

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

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

pdf starts the graphics device driver for producing PDF graphics.
pdf开始制作PDF图形的图形设备驱动程序。


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


pdf(file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf"),
    width, height, onefile, family, title, fonts, version,
    paper, encoding, bg, fg, pointsize, pagecentre, colormodel,
    useDingbats, useKerning, fillOddEven, maxRasters, compress)



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

参数:file
a character string giving the name of the file. If it is of the form "|cmd", the output is piped to the command given by cmd.  If it is NULL, then no external file is created (effectively, no drawing occurs), but the device may still be queried (e.g., for size of text). For use with onefile = FALSE give a C integer format such as "Rplot%03d.pdf" (the default in that case). (See postscript for further details.)  Tilde expansion (see path.expand) is done.  
给文件名字符串。如果它的形式"|cmd",输出管道由cmd命令。如果是的话NULL,然后没有外部文件被创建(有效,没有发生图纸),但设备仍然可以进行查询(例如,文本大小)。为以onefile = FALSE给一个C整数格式,如使用"Rplot%03d.pdf"(在这种情况下,默认)。 (见postscript作进一步的细节。)TILDE扩张(见path.expand)完成。


参数:width, height
the width and height of the graphics region in inches.  The default values are 7.
英寸图形区域的宽度和高度。默认值是7。


参数:onefile
logical: if true (the default) allow multiple figures in one file.  If false, generate a file with name containing the page number for each page.  Defaults to TRUE.
逻辑:如果为true(默认),允许在一个文件中的多个数字。如果为false,生成一个文件名包含每一页的页码。 TRUE默认。


参数:family
the font family to be used, see postscript.  Defaults to "Helvetica".
要使用的字体家族,看到postscript。 "Helvetica"默认。


参数:title
title string to embed as the /Title field in the file.  Defaults to "R Graphics Output".
标题字符串嵌入文件中的/Title场。 "R Graphics Output"默认。


参数:fonts
a character vector specifying R graphics font family names for additional fonts which will be included in the PDF file. Defaults to NULL.
指定将包含在PDF文件中的其他字体ŕ图形字体系列名称的字符向量。 NULL默认。


参数:version
a string describing the PDF version that will be required to view the output.  This is a minimum, and will be increased (with a warning) if necessary.  Defaults to "1.4", but see "Details".
字符串描述将需要查看输出的PDF版本。这是一个最低限度,并将会增加(警告)如果有必要的。默认"1.4",但看到“详细资料”。


参数:paper
the target paper size.  The choices are "a4", "letter", "legal" (or "us") and "executive" (and these can be capitalized), or "a4r" and "USr" for rotated ("landscape"). The default is "special", which means that the width and height specify the paper size.  A further choice is "default"; if this is selected, the papersize is taken from the option "papersize" if that is set and as "a4" if it is unset or empty. Defaults to "special".  
目标纸张尺寸。选择"a4","letter","legal"("us")"executive"(而这些可以资本化),或"a4r"和 "USr"(风景)为旋转。默认是的"special",这意味着width和height指定的纸张尺寸。进一步的选择是"default";如果选择此选项,纸张大小选项"papersize"如果设置为"a4"如果是没有设置或者为空。 "special"默认。


参数:encoding
the name of an encoding file.  See postscript for details.  Defaults to "default".
编码文件的名称。看到postscript详情。 "default"默认。


参数:bg
the initial background color to be used.  Defaults to "transparent".
要使用的初始背景颜色。 "transparent"默认。


参数:fg
the initial foreground color to be used.  Defaults to "black".
要使用的初始前景色。 "black"默认。


参数:pointsize
the default point size to be used.  Strictly speaking, in bp, that is 1/72 of an inch, but approximately in points.  Defaults to 12.
要使用默认的点大小。严格地说,在BP,即1/72英寸,但约在点。 12默认。


参数:pagecentre
logical: should the device region be centred on the page? – is only relevant for paper != "special".   Defaults to TRUE.
逻辑:应在页面上为中心的设备区域? - 是有关paper != "special"。 TRUE默认。


参数:colormodel
a character string describing the color model: currently allowed values are "srgb", "gray" (or "grey") and "cmyk".  Defaults to "srgb".  See section "Color models".
字符串的颜色模型描述:目前允许值是"srgb","gray"(或"grey")"cmyk"的。 "srgb"默认。见节“颜色模式”。


参数:useDingbats
logical.  Should small circles be rendered via the Dingbats font?  Defaults to TRUE, which produces smaller and better output.  Setting this to FALSE can work around font display problems in broken PDF viewers: although this font is one of the 14 guaranteed to be available in all PDF viewers, that guarantee is not always honoured.  
逻辑。应通过Dingbats字体呈现小圈子?默认的TRUE,产生更小,更好的输出。设置FALSE可以解决在破碎的PDF浏览器的字体显示问题:字体虽然这是一个保证在所有PDF查看器,保证并不总是荣幸14。


参数:useKerning
logical.  Should kerning corrections be included in setting text and calculating string widths?  Defaults to TRUE.
逻辑。字距更正应列入设置文本和字符串宽度计算? TRUE默认。


参数:fillOddEven
logical controlling the polygon fill mode:  see polygon for details.  Defaults to FALSE.
逻辑控制的多边形填充模式:看到polygon详情。 FALSE默认。


参数:maxRasters
integer.  Unused in R >= 2.14.0, previously the maximum number of raster images to be stored in this PDF document (default 64 in R < 2.13.2).
整数。未使用的R> = 2.14.0以前的光栅图像存储在这个PDF文档的最大数量(默认64在R <2.13.2)。


参数:compress
logical.  Should PDF streams be generated with Flate compression?  Defaults to TRUE.
逻辑。应Flate压缩生成的PDF流? TRUE默认。


Details

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

All arguments except file default to values given by pdf.options().  The ultimate defaults are quoted in the arguments section.
除了file默认pdf.options()给定值的所有参数。最终默认被引用的论据部分。

pdf() opens the file file and the PDF commands needed to plot any graphics requested are sent to that file.
pdf()打开文件“file”要求绘制任何图形所需的PDF的命令被发送到该文件。

The file argument is interpreted as a C integer format as used by sprintf, with integer argument the page number. The default gives files "Rplot001.pdf", ..., "Rplot999.pdf", "Rplot1000.pdf", ....
file参数被解释为一个C整数格式由sprintf整数参数,页码。默认给文件Rplot001.pdf,Rplot999.pdf,Rplot1000.pdf,....

The family argument can be used to specify a PDF-specific font family as the initial/default font for the device.  If additional font families are to be used they should be included in the fonts argument.
family参数可用于指定设备的初始/默认字体的PDF特定字体系列。如果要使用其他字体家庭,他们应该被包括在fonts参数。

If a device-independent R graphics font family is specified (e.g., via par(family=) in the graphics package), the PDF device makes use of the PostScript font mappings to convert the R graphics font family to a PDF-specific font family description.  (See the documentation for pdfFonts.)
如果设备的自主研发的图形字体家族指定(例如,通过par(family=)在图形包),PDF格式的设备使用PostScript字体的映射转换的R图形字体家族到PDF特定的字体家族说明。 (见文件pdfFonts。)

This device does not embed fonts in the PDF file, so it is only straightforward to use mappings to the font families that can be assumed to be available in any PDF viewer: "Times" (equivalently "serif"), "Helvetica" (equivalently "sans") and "Courier" (equivalently "mono"). Other families may be specified, but it is the user's responsibility to ensure that these fonts are available on the system and third-party software (e.g., Ghostscript) may be required to embed the fonts so that the PDF can be included in other documents (e.g., LaTeX): see embedFonts.  The URW-based families described for postscript can be used with viewers such as GSView which utilise URW fonts. Since embedFonts makes use of Ghostscript, it should be able to embed the URW-based families for use with other viewers.
此设备不嵌入在PDF文件中的字体,所以它只是简单的假设的字体可以在任何PDF浏览器提供的家庭使用映射:"Times"(等效"serif") "Helvetica"(等效"sans")"Courier"(等效"mono")。其他家庭可能会被指定,但它是用户的责任是对的系统和(例如,Ghostscript的)可能被要求嵌入的字体使PDF文件可以被其他文件中包含的第三方软件(这些字体例如,乳胶):embedFonts。可以用来描述了URWpostscript家庭与GSView程序,如观众,其中利用URW字体。自embedFonts的Ghostscript使用,它应该是能够嵌入了URW为基础的家庭,与其他观众一起使用。

See postscript for details of encodings, as the internal code is shared between the drivers.  The native PDF encoding is given in file "PDFDoc.enc".
看到postscript编码的详细信息,内部代码共享之间的司机。本机PDF编码在文件PDFDoc.enc。

The PDF produced is fairly simple, with each page being represented as a single stream (by default compressed and possibly with references to raster images).  The R graphics model does not distinguish graphics objects at the level of the driver interface.
产生的PDF是相当简单的,每一页都被作为一个单一的流(默认情况下,引用光栅图像压缩和可能)表示。在R图形模型不区分水平的驱动程序接口的图形对象。

The version argument declares the version of PDF that gets produced.  The version must be at least 1.2 when compression is used, 1.4 for semi-transparent output to be understood, and at least 1.3 if CID fonts are to be used: if any of these features are used the version number will be increased (with a warning).  (PDF 1.4 was first supported by Acrobat 5 in 2001; it is very unlikely not to be supported in a current viewer.)
version参数宣告被制作的PDF版本。版本必须至少1.2使用压缩时,半透明输出1.4可以理解,至少1.3,如果要使用CID字体:如果使用这些功能的版本将增加(与警告)。 (PDF 1.4的首次由Acrobat 5支持在2001年,它是不太可能在当前浏览器不支持。)

Line widths as controlled by par(lwd=) are in multiples of 1/96 inch.  Multiples less than 1 are allowed.  pch="." with cex = 1 corresponds to a square of side 1/72 inch, which is also the "pixel" size assumed for graphics parameters such as "cra".
作为控制线宽度par(lwd=)1/96英寸的倍数。允许比1的倍数。 pch="."用cex = 1对应到1/72英寸,这也是“像素大小图形参数,如"cra"假设边的平方。

The paper argument sets the /MediaBox entry in the file, which defaults to width by height.  If it is set to something other than "special", a device region of the specified size is (by default) centred on the rectangle given by the paper size: if either width or height is less than 0.1 or too large to give a total margin of 0.5 inch, it is reset to the corresponding paper dimension minus 0.5.  Thus if you want the default behaviour of postscript use pdf(paper="a4r", width=0, height=0) to centre the device region on a landscape A4 page with 0.25 inch margins.
paper参数设置文件中/MediaBox,默认widthheight。如果它被设置比"special"其他的东西,一个指定大小的装置区(默认)为中心的纸张尺寸的矩形:如果任width或height比0.1少或过大,给一个0.5英寸的总保证金的,它是复位相应的纸张尺寸减去0.5。因此,如果你想默认行为postscript用pdf(paper="a4r", width=0, height=0)一个0.25英寸的边距景观A4页面上的设备区域中心。

When the background colour is fully transparent (as is the initial default value), the PDF produced does not paint the background.  Most PDF viewers will use a white canvas so the visual effect is if the background were white.  This will not be the case when printing onto coloured paper, though.
当背景颜色是完全透明的(是初始默认值),产生的PDF不画背景。大多数PDF阅读器将使用白色画布,所以视觉效果,如果背景是白色的。这会不会是到彩色纸打印时,虽然。


颜色模型----------Color models----------

The default color model ("srgb") is sRGB.  Model "gray" (or "grey") maps sRGB colors to greyscale using perceived luminosity (biased towards green).  "cmyk" outputs in CMYK colorspace.  The simplest possible conversion from sRGB to CMYK is used (http://en.wikipedia.org/wiki/CMYK_color_model#Mapping_RGB_to_CMYK), and raster images are output in RGB.
默认的颜色模型("srgb")是sRGB。模型"gray"(或"grey")地图sRGB颜色灰度使用感知光度(对绿色偏颇)。 "cmyk"输出的CMYK色彩。使用尽可能简单的sRGB到CMYK的转换(#Mapping_RGB_to_CMYK http://en.wikipedia.org/wiki/CMYK_color_model),光栅图像是RGB输出。

Also available for backwards compatibility is model "rgb" which uses uncalibrated RGB and corresponds to the model used with that name in R prior to 2.13.0.  Some viewers may render some plots in that colorspace faster than in sRGB, and the plot files will be smaller.
也可用于向后兼容模式"rgb"使用未校准的RGB和对应R中使用该名称之前2.13.0模型。有些观众可能会导致一些图,在这速度比在sRGB色彩和图形文件会更小。


公约----------Conventions----------

This section describes the implementation of the conventions for graphics devices set out in the &ldquo;R Internals Manual&rdquo;.
本节介绍的“R内部手册”所载的图形设备的公约的执引号况。

The default device size is 7 inches square.
默认设备大小为7英寸见方。

Font sizes are in big points.
字体大小大点。

The default font family is Helvetica.
默认字体是黑体。

Line widths are as a multiple of 1/96 inch, with a minimum of 0.01 enforced.
线宽是多了1/96英寸的最低执行0.01。

Circles of any radius are allowed.  Unless useDingbats =       FALSE, opaque circles of less than 10 big points radius are rendered using char 108 in the Dingbats font: all semi-transparent and larger circles using a B閦ier curve for each quadrant.
允许任何半径的圆。除非useDingbats =       FALSE,少于10个大点的不透明圈半径呈现在Dingbats字体字符108:半透明和更大的圈子,使用B贝塞尔曲线为每个象限。

Colours are by default specified as sRGB.
颜色是由指定的默认为sRGB。

At very small line widths, the line type may be forced to solid.
在非常小的线宽,线类型可能会被迫固体。


注意----------Note----------

If you see problems with PDF output, do remember that the problem is much more likely to be in your viewer than in R.  Try another viewer if possible.  Symptoms for which the viewer has been at fault are apparent grids on image plots (turn off graphics anti-aliasing in your viewer if you can) and missing or incorrect glyphs in text (viewers silently doing font substitution).
如果你看到的PDF输出的问题,千万要记得,这个问题是更可能是在您的浏览器尝试使用其他浏览器如果可能的话比在R。观众故障的症状有明显的网格影像图(关掉你的浏览器,如果你能在图形反走样)和文本中缺少或不正确的字形(观众默默地做字体替换)。

Unfortunately the default viewers on most Linux and Mac OS X systems have these problems, and no obvious way to turn off graphics anti-aliasing.
不幸的是,大多数Linux和Mac OS X系统的默认观众有这些问题,并没有明显的方式,关闭抗锯齿的图形。

Acrobat Reader does not use the fonts specified but rather emulates them from multiple-master fonts.  This can be seen in imprecise centering of characters, for example the multiply and divide signs in Helvetica.  This can be circumvented by embedding fonts where possible.  Most other viewers substitute fonts, e.g. URW fonts for the standard Helvetica and Times fonts, and these too often have different font metrics from the true fonts.
Acrobat Reader软件不使用指定的字体,而是模拟由多个主字体。这可以看出,在不精确的字符,例如,围绕在黑体的乘法和除法的迹象。这可以通过嵌入字体在可能的情况下规避。其他大多数观众替代字体,例如URW字体为标准黑体和Times字体,而这些往往有真正的字体不同的字体度量。

Acrobat Reader can be extended by "font packs", and these will be needed for the full use of encodings other than Latin-1 (although they may be downloaded as needed).  See http://www.adobe.com/downloads/updates for Reader 9 and X, and http://www.adobe.com/products/acrobat/acrrasianfontpack.html for Reader 6 to 8.
Acrobat Reader软件,可以延长“字体包”,这些将需要充分利用比的Latin-1编码的(虽然他们可以根据需要下载)。请读者9和X http://www.adobe.com/downloads/updates,http://www.adobe.com/products/acrobat/acrrasianfontpack.html阅读6到8个。

The TeXworks PDF viewer is one of those which has been seen to fail to display Dingbats correctly.  Whereas on other platforms the problems seen are incorrect output, on Windows points are silently omitted.  One workaround is to use the argument useDingbats = FALSE: another it to use a better PDF viewer.
TEXworks的PDF阅读器是那些一直被视为无法正确显示Dingbats之一。而在其他平台上看到的问题是不正确的输出,在Windows上的点,静静地省略。一种解决方法是使用参数useDingbats = FALSE:另一个,它使用一个更好的PDF阅读器。


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

pdfFonts, pdf.options, embedFonts, Devices, postscript.
pdfFonts,pdf.options,embedFonts,Devices,postscript。

cairo_pdf and (on Mac OS X only) quartz for other devices that can produce PDF.
cairo_pdf(只在Mac OS X)quartz其他的设备,可以生成PDF。

More details of font families and encodings and especially handling text in a non-Latin-1 encoding and embedding fonts can be found in
字体家庭和编码的更多细节,尤其是处理非Latin-1编码和嵌入字体的文本中可以找到

Paul Murrell and Brian Ripley (2006) Non-standard fonts in PostScript and PDF graphics. R News, 6(2):41&ndash;47. http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf.
保罗的Murrell和布赖恩·里普利(2006)非标字体,PostScript和PDF格式的图形。 &#341;新闻,6(2):41-47。 http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf。


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


## Not run: [#无法运行:]
## Test function for encodings[#编码测试功能]
TestChars <- function(encoding="ISOLatin1", ...)
{
    pdf(encoding=encoding, ...)
    par(pty="s")
    plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="",
         xaxs="i", yaxs="i")
         title(paste("Centred chars in encoding", encoding))
    grid(17, 17, lty=1)
    for(i in c(32:255)) {
        x <- i %% 16
        y <- i %/% 16
        points(x, y, pch=i)
    }
    dev.off()
}
## there will be many warnings.[#会有很多的警告。]
TestChars("ISOLatin2")
## this does not view properly in older viewers.[#这并不正确查看在年纪大的观众。]
TestChars("ISOLatin2", family="URWHelvetica")
## works well for viewing in gs-based viewers, and often in xpdf.[#基于GS-观众在观看作品,并经常在xpdf的。]


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 22:49 , Processed in 0.023456 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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