I am plotting 15 scatter plots which include regression lines. However, I would like to display on one page to visualize better. grid.arrange function helps to add multiple plots according to our interest however, I always face with an error. Error in gList(list(wrapvp = list(x = 0.5, y = 0.5, width = 1, height = 1, : only 'grobs' allowed in "gList" plots <- list() for
我绘制了15个包含回归线的散点图。 不过,我想在一个页面上展示以更好地形象化。 grid.arrange函数有助于根据我们的兴趣添加多个图,但是我总是面对一个错误。 gList中的错误(list(wrapvp = list(x = 0.5,y = 0.5,width = 1,height = 1,仅在'gList'中允许'grobs' plots <- list() for (i in 1:(ncol(xx2)-1)) { cn <- colnames(xx2) reg<-lm(xx2[,i]~xx2[,16], data=data.frame(xx2)
I created a few plots with the filled.contour function. Then I would like to plot two of the plots next to each other. Therefore I used the grid.arrange function. This is my code: install.packages("gridExtra") install.packages("lattice") install.packages("grid") library(lattice) library(gridExtra) library(grid) # Fake data x <- c(1:10) y <- c(1:10) z<-matrix(data=c(1:100), nrow=10
我用filled.contour函数创建了一些图。 然后我想绘制两个彼此相邻的情节。 因此我使用了grid.arrange函数。 这是我的代码: install.packages("gridExtra") install.packages("lattice") install.packages("grid") library(lattice) library(gridExtra) library(grid) # Fake data x <- c(1:10) y <- c(1:10) z<-matrix(data=c(1:100), nrow=10, ncol=10, byrow = FALSE) p1<-filled.contour(x,y,z, color =
In the following reproduceable example I try to create a function for a ggplot distribution plot and saving it as an R object, with the intention of displaying two plots in a grid. ggplothist<- function(dat,var1) { if (is.character(var1)) { var1 <- which(names(dat) == var1) } distribution <- ggplot(data=dat, aes(dat[,var1])) distribution <- distribut
在下面的可重现示例中,我尝试为ggplot分布图创建函数并将其保存为R对象,目的是在网格中显示两个图。 ggplothist<- function(dat,var1) { if (is.character(var1)) { var1 <- which(names(dat) == var1) } distribution <- ggplot(data=dat, aes(dat[,var1])) distribution <- distribution + geom_histogram(aes(y=..density..),binwidth=0.1,colour="black", fill="white")
I am modifying a graph built with ggplot by altering the data produced by ggplot_build (for a reason similar to Include space for missing factor level used in fill aesthetics in geom_boxplot). As far as I understand the help I found on this topic, I should be able to save the result by applying ggplot_gtable and arrangeGrob before calling ggsave on the results (Saving grid.arrange() plot to file
我正在通过修改由ggplot_build生成的数据修改一个使用ggplot构建的图形(出于类似于在geom_boxplot中填充美学所用的缺少因子级别包含空间的原因)。 据我了解我在这个主题上找到的帮助,我应该能够通过应用ggplot_gtable和arrangeGrob保存结果,然后对结果调用ggsave(将grid.arrange()图保存到文件中)。 但是,我得到一个错误“plot should ggplot2 plot”,也有这个简单的可重现的例子: require('ggplot2') require('grid
as a new ggplot2 user, I am a bit lost with the amount of possibilities, and struggle to find on the net a simple answer to what I consider a simple problem. I would like to display multiple plots from ggplot2 on a same sheet, BUT knowing that these plots come from a for loop. Following example does not compile, it is only to illustrate : for(i in c(1:n)){
作为一个新的ggplot2用户,我有点迷失了很多可能性,并且很难在网上找到我认为是一个简单问题的简单答案。 我想在同一张纸上显示ggplot2的多个图表,但知道这些图表来自for循环。 以下示例不编译,只是为了说明: for(i in c(1:n)){ for(j in c(1:m)){ .......... # some data production p <- ggplot(df.all) + geom_bar(aes_string(x=class.names[i],fill=var.names[j])
I am trying to plot multiple plots using ggplot2 , arranging them using grid.arrange() . Since I managed to find someone describing the exact problem I have, I have quoted from the problem description from link: When I use ggsave() after grid.arrange() , ie grid.arrange(sgcir1,sgcir2,sgcir3,ncol=2,nrow=2) ggsave("sgcirNIR.jpg") I do not save the grid plot but the last individual ggplot. Is
我正在尝试使用ggplot2绘制多个图,并使用grid.arrange()来排列它们。 由于我设法找到描述我确切问题的人,所以我从链接引用了问题描述: 当我在ggsave()之后使用grid.arrange() ,即 grid.arrange(sgcir1,sgcir2,sgcir3,ncol=2,nrow=2) ggsave("sgcirNIR.jpg") 我不保存网格图,而是保存最后一个单独的ggplot。 有没有什么方法可以通过grid.arrange()使用ggsave()或类似的东西来显示实际上保存的绘图? 除了使用旧的方式
I have a dataset from the world bank with some continuous and categorical variables. > head(nationsCombImputed) iso3c iso2c country year.x life_expect population birth_rate neonat_mortal_rate region 1 ABW AW Aruba 2014 75.45 103441 10.1 2.4 Latin America & Caribbean 2 AFG AF Afghanistan
我有一个来自世界银行的数据集,有一些连续的和分类的变量。 > head(nationsCombImputed) iso3c iso2c country year.x life_expect population birth_rate neonat_mortal_rate region 1 ABW AW Aruba 2014 75.45 103441 10.1 2.4 Latin America & Caribbean 2 AFG AF Afghanistan 2014 60.37 3162750
My question is twofold; I have a ggpairs plot with the default upper = list(continuous = cor) and I would like to colour the tiles by correlation values (exactly like what ggcorr does). I have this: I would like the correlation values of the plot above to be coloured like this: library(GGally) sample_df <- data.frame(replicate(7,sample(0:5000,100))) colnames(sample_df) <- c("KUM", "
我的问题是双重的。 我有一个ggpairs阴谋,默认的upper = list(continuous = cor) ,我想用相关值对瓷砖着色(就像ggcorr所做的一样)。 我有这个: 我希望上面的图的相关值可以像这样着色: library(GGally) sample_df <- data.frame(replicate(7,sample(0:5000,100))) colnames(sample_df) <- c("KUM", "MHP", "WEB", "OSH", "JAC", "WSW", "gaugings") ggpairs(sample_df, lower = list(continuous = "smooth")
The following code creates a correlation matrix visulization that is not very readable: 1) The text is too large and the numbers inside the cells are not readable 2) The ticks in the x and y axes do not offer information because they are too congested Could you advise me how to deal with these problems: The code is the following: library(GGally) library(ggplot2) library(data.table) libra
下面的代码创建了一个不太可读的关联矩阵可视化: 1)文字太大,单元格内的数字不可读 2)x轴和y轴上的刻度不提供信息,因为它们拥挤太多 你能否告诉我如何处理这些问题: 代码如下: library(GGally) library(ggplot2) library(data.table) library(ROSE) library(dplyr) #=================================================================================================================== # LOAD THE DATA #==
I have a simple question. How can I get totally blank spaces in the upper panel of a matrix using ggpairs? I am using this code: ggpairs(iris, columns = 2:4, title = "[1989]", upper = list (continuous = "blanck"), lower = list(continuous = "points"), diag = list(continuous = "blanck"), axisLabels = "show", legends = TRUE) I just want the 3 plots on the lower panel, b
我有一个简单的问题。 如何使用ggpairs在矩阵的上面板中获得完全空白的空间? 我正在使用此代码: ggpairs(iris, columns = 2:4, title = "[1989]", upper = list (continuous = "blanck"), lower = list(continuous = "points"), diag = list(continuous = "blanck"), axisLabels = "show", legends = TRUE) 我只想在下面板上绘制3个图,但在对角线和上部面板中都有代码打印网格和标签“不正确绘