在r markdown中生成的图形太大并且被截断

时间:2019-01-09 22:54:48

标签: r rstudio r-markdown

我今天开始在R降价中使用相关图,与其他图不同,它们在R降价输出中被切除。如果在“笔记本输出”窗口中将它们打开,或者将它们复制并粘贴到其他程序中,它们将保持截止状态。我看到整个图形的唯一方法是在控制台中调用它,在“图形”选项卡中查看它,然后缩小它。任何想法如何解决这个问题?下面的代码。谢谢!

编辑:该图形在html knitr输出中看起来完全正常。

screencap of cut-off graph

df <- structure(list(C = c(0, 0, 1, 0, 1, 1, 0, 0, 0, 5, 0, 0, 0, 0, 
0, 0, 0, 0, 1, 0, 0, 1, 5, 0, 0, 0, 0, 8, 0, 0, 2, 0, 0, 1, 0, 
0, 3, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 5, 0, 0, 17, 
0, 9, 0, 1, 2, 5, 0, 0, 4, 1, 1, 0, 0, 1, 2, 0, 0, 16, 0, 19, 
0, 1, 2, 1, 0, 0, 0, 0, 18, 0, 1, 1, 0, 0, 0, 13, 0, 8, 0, 0, 
2, 0, 4, 0, 4, 1, 13, 0, 2, 2, 1, 0, 2, 17, 0, 2, 0, 4, 0, 0, 
2, 0, 2, 0, 3, 0, 5, 2, 1, 1, 6, 11, 0, 2, 0, 1, 2, 0, 0, 0, 
12, 0, 1, 0, 2, 6, 0, 3, 0, 1, 0, 4, 0, 0), P = c(0, 0, 0, 0, 
0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 1, 0, 
0, 0, 2, 0, 0, 2, 0, 3, 0, 0, 0, 7, 0, 0, 0, 0, 4, 2, 0, 0, 6, 
0, 0, 0, 0, 2, 1, 0, 0, 8, 0, 1, 1, 0, 1, 7, 0, 0, 0, 0, 2, 0, 
0, 0, 0, 0, 0, 0, 0, 24, 0, 2, 3, 0, 0, 0, 9, 0, 6, 0, 0, 0, 
0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 7, 0, 2, 0, 0, 0, 0, 0, 0, 
2, 0, 2, 0, 0, 0, 0, 0, 0, 25, 0, 8, 0, 4, 1, 0, 0, 1, 9, 0, 
3, 0, 0, 0, 0, 0, 0, 18, 0, 1, 0, 1, 0, 0, 0, 0, 14, 0, 3, 0, 
0)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-149L), .Names = c("C", "P"))

ccf(x = df$C, y = df$P,lag.max = 10)

1 个答案:

答案 0 :(得分:0)

尝试通过以下方式更改打印边距:

```{r }
par(mar=c(3,3,3,0))
ccf(x = df$C, y = df$P,lag.max = 10, main="foo") 
```

已回答here