我运行代码以使用patchwork库中的plot_layout函数,发现对于某些绘图,plot_layout会创建组合绘图视图,但也会显示一些以#>为前缀的消息。如何从R markdown文件中删除这些消息?有没有可以使用的块选项?
下面是我的重述:
``` r{corr-plots}库(Ggplot2)
库(MASS)
库(拼凑)
set.seed(123)
cor_100 <- as.data.frame(mvrnorm(100,mu = c(0,0),
Sigma = matrix(c(1 ,1, 1, 1), ncol = 2), empirical = TRUE))cor_70 <- as.data.frame(mvrnorm(100,mu = c(0,0),
Sigma = matrix(c(1,0.7,0.7,1), ncol = 2), empirical = TRUE))cor_100_plot <- ggplot(cor_100,aes(V1,V2)) + geom_point() +
实验室(title=“相关= 1",y= "y",x= "x") +
geom_hline(yintercept =平均值(cor_100$V2),lty = 2) +
geom_vline(xintercept =平均值(cor_100$V1),lty = 2) +
theme_minimal(base_size = 15)
cor_70_plot <- ggplot(cor_70,aes(V1,V2)) + geom_point() +
实验室(title=“相关= 0.7",y= "y",x= "x") +
geom_hline(yintercept =平均值(cor_70$V2),lty = 2) +
geom_vline(xintercept =平均值(cor_70$V1),lty = 2) +
theme_minimal(base_size = 15)
plot_layout(cor_100_plot + cor_70_plot)

#>
#> $nrow
#> NULL
#>
#> $byrow
#> NULL
#>
#> $widths
#> NULL
#>
#> $heights
#> NULL
#>
#> $guides
#> NULL
#>
#> $tag_level
#> NULL
#>
#> attr(,"class")
#> [1] "plot_layout"由reprex package于2018-08-24创建(v0.2.0)。
发布于 2018-08-25 06:19:33
Thomas Lin Pedersen在推特上回答了我的问题。我把plot_layout()的语法搞错了。应该是cor_100_plot + cor_70_plot + plot_layout()。
https://stackoverflow.com/questions/52011444
复制相似问题