小编M_V*_*len的帖子

R - 将多重绘图保存到文件

我非常感谢您对以下问题的帮助.我知道将单个绘图保存到文件的几种方法.我的问题是:如何正确保存的multiplot到一个文件?

首先,我不是一位经验丰富的R用户.我使用ggplot2创建我的图,我应该提到的另一件事是我使用RStudio GUI.使用 R Cookbook中的示例,我可以在一个窗口中创建多个绘图.

我想将这个所谓的多重时隙保存到一个文件(最好是jpeg),但不知何故不能这样做.

我正在创建如下的多时隙:

##define multiplot function
    multiplot <- function(..., plotlist=NULL, cols) {
        require(grid)

        # Make a list from the ... arguments and plotlist
        plots <- c(list(...), plotlist)

        numPlots = length(plots)

        # Make the panel
        plotCols = cols                          # Number of columns of plots
        plotRows = ceiling(numPlots/plotCols) # Number of rows needed, calculated from # of cols

        # Set up the page
        grid.newpage()
        pushViewport(viewport(layout = grid.layout(plotRows, plotCols)))
        vplayout <- function(x, y)
            viewport(layout.pos.row = …
Run Code Online (Sandbox Code Playgroud)

r save ggplot2

28
推荐指数
3
解决办法
2万
查看次数

标签 统计

ggplot2 ×1

r ×1

save ×1