显示图,而不是保存它的PDF

c

我正处于R编程的第一步。为此使用Sublime Text 3。我正在尝试使用以下代码绘制一些数据:

cars <- c(1, 3, 6, 4, 9)
windows()
plot(cars)

我期望在按Ctrl + B后才能看到该图,但是刚才我注意到PDF文件随该图一起保存。

是否可以查看图形而不是保存文件?

尝试dev.off()我得到:

Error in dev.off() : cannot shut down device 1 (the null device) 
Execution halted

并尝试getOption("device")我得到:

function (file = if (onefile) "Rplots.pdf" else "Rplot%03d.pdf", 
    width, height, onefile, family, title, fonts, version, paper, 
    encoding, bg, fg, pointsize, pagecentre, colormodel, useDingbats, 
    useKerning, fillOddEven, compress) 
{
    initPSandPDFfonts()
    new <- list()
    if (!missing(width)) 
        new$width <- width
    if (!missing(height)) 
        new$height <- height
    if (!missing(onefile)) 
        new$onefile <- onefile
    if (!missing(title)) 
        new$title <- title
    if (!missing(fonts)) 
        new$fonts <- fonts
    if (!missing(version)) 
        new$version <- version
    if (!missing(paper)) 
        new$paper <- paper
    if (!missing(encoding)) 
        new$encoding <- encoding
    if (!missing(bg)) 
        new$bg <- bg
    if (!missing(fg)) 
        new$fg <- fg
    if (!missing(pointsize)) 
        new$pointsize <- pointsize
    if (!missing(pagecentre)) 
        new$pagecentre <- pagecentre
    if (!missing(colormodel)) 
        new$colormodel <- colormodel
    if (!missing(useDingbats)) 
        new$useDingbats <- useDingbats
    if (!missing(useKerning)) 
        new$useKerning <- useKerning
    if (!missing(fillOddEven)) 
        new$fillOddEven <- fillOddEven
    if (!missing(compress)) 
        new$compress <- compress
    old <- check.options(new, name.opt = ".PDF.Options", envir = .PSenv)
    if (!missing(family) && (inherits(family, "Type1Font") || 
        inherits(family, "CIDFont"))) {
        enc <- family$encoding
        if (inherits(family, "Type1Font") && !is.null(enc) && 
            enc != "default" && (is.null(old$encoding) || old$encoding == 
            "default")) 
            old$encoding <- enc
        family <- family$metrics
    }
    if (is.null(old$encoding) || old$encoding == "default") 
        old$encoding <- guessEncoding()
    if (!missing(family)) {
        if (length(family) == 4L) {
            family <- c(family, "Symbol.afm")
        }
        else if (length(family) == 5L) {
        }
        else if (length(family) == 1L) {
            pf <- pdfFonts(family)[[1L]]
            if (is.null(pf)) 
                stop(gettextf("unknown family '%s'", family), 
                  domain = NA)
            matchFont(pf, old$encoding)
        }
        else stop("invalid 'family' argument")
        old$family <- family
    }
    version <- old$version
    versions <- c("1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", 
        "2.0")
    if (version %in% versions) 
        version <- as.integer(strsplit(version, "[.]")[[1L]])
    else stop("invalid PDF version")
    onefile <- old$onefile
    if (!checkIntFormat(file)) 
        stop(gettextf("invalid 'file' argument '%s'", file), 
            domain = NA)
    .External(C_PDF, file, old$paper, old$family, old$encoding, 
        old$bg, old$fg, old$width, old$height, old$pointsize, 
        onefile, old$pagecentre, old$title, old$fonts, version[1L], 
        version[2L], old$colormodel, old$useDingbats, old$useKerning, 
        old$fillOddEven, old$compress)
    invisible()
}
<bytecode: 0x000000000f0e4c80>
<environment: namespace:grDevices>
K队

使用独立的R控制台或其他程序(例如RStudio),默认行为是显示绘图而不是将其另存为pdf。尝试使用dev.off()重置图形设备。

失败的话,您打电话getOption("device")怎么办?

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Matlab:将频谱图保存在变量中并显示它

来自分类Dev

如何提示保存pdf而不是使用fpdf打开它

来自分类Dev

如何以模态显示pdf而不是在react js中在新窗口中打开它

来自分类Dev

保存gnuplot图而不显示图

来自分类Dev

显示pdf而不保存?

来自分类Dev

Edge / IE下载Servlet而不是显示它

来自分类Dev

Edge / IE下载Servlet而不是显示它

来自分类Dev

如何显示JQPLOT图而不是长文本

来自分类Dev

dbContext没有保存它显示的更改

来自分类Dev

绘制热图仅显示图像并保存

来自分类Dev

Python:保存图而不在GUI中打开它

来自分类Dev

Python:保存图而不在GUI中打开它

来自分类Dev

在浏览器中打开PDF而不是下载它

来自分类Dev

Angular + jQuery产生“未捕获对象”错误而不是显示它

来自分类Dev

show()方法从dom中删除html元素,而不是显示它

来自分类Dev

Dropbox链接显示了我的PHP文件的代码,而不是执行它

来自分类Dev

show()方法从dom中删除html元素,而不是显示它

来自分类Dev

python将多个子图数字保存为pdf

来自分类Dev

使用matplotlib将图保存为pdf文件

来自分类Dev

使用matplotlib将图保存为pdf文件

来自分类Dev

R:ggplot:图显示垂直线而不是时程

来自分类Dev

Python图在x轴上显示数字而不是日期

来自分类Dev

在RStudio窗口而不是浏览器中显示闪亮的图

来自分类Dev

在tensorboard中显示matplotlib图而不是转储到文件

来自分类Dev

崇高地打开文件,并显示它需要保存

来自分类Dev

Xcode内存图-显示增加的内存使用量-它到底显示什么?

来自分类Dev

MATLAB:如何使用faceAlpha保存地理显示图?

来自分类Dev

matplotlib for循环以显示,保存和重绘所有图

来自分类Dev

保存到eps的Seaborn图不显示网格

Related 相关文章

  1. 1

    Matlab:将频谱图保存在变量中并显示它

  2. 2

    如何提示保存pdf而不是使用fpdf打开它

  3. 3

    如何以模态显示pdf而不是在react js中在新窗口中打开它

  4. 4

    保存gnuplot图而不显示图

  5. 5

    显示pdf而不保存?

  6. 6

    Edge / IE下载Servlet而不是显示它

  7. 7

    Edge / IE下载Servlet而不是显示它

  8. 8

    如何显示JQPLOT图而不是长文本

  9. 9

    dbContext没有保存它显示的更改

  10. 10

    绘制热图仅显示图像并保存

  11. 11

    Python:保存图而不在GUI中打开它

  12. 12

    Python:保存图而不在GUI中打开它

  13. 13

    在浏览器中打开PDF而不是下载它

  14. 14

    Angular + jQuery产生“未捕获对象”错误而不是显示它

  15. 15

    show()方法从dom中删除html元素,而不是显示它

  16. 16

    Dropbox链接显示了我的PHP文件的代码,而不是执行它

  17. 17

    show()方法从dom中删除html元素,而不是显示它

  18. 18

    python将多个子图数字保存为pdf

  19. 19

    使用matplotlib将图保存为pdf文件

  20. 20

    使用matplotlib将图保存为pdf文件

  21. 21

    R:ggplot:图显示垂直线而不是时程

  22. 22

    Python图在x轴上显示数字而不是日期

  23. 23

    在RStudio窗口而不是浏览器中显示闪亮的图

  24. 24

    在tensorboard中显示matplotlib图而不是转储到文件

  25. 25

    崇高地打开文件,并显示它需要保存

  26. 26

    Xcode内存图-显示增加的内存使用量-它到底显示什么?

  27. 27

    MATLAB:如何使用faceAlpha保存地理显示图?

  28. 28

    matplotlib for循环以显示,保存和重绘所有图

  29. 29

    保存到eps的Seaborn图不显示网格

热门标签

归档