gridextra

R suppressing rownames in grid table

蹲街弑〆低调 提交于 2020-01-03 07:09:04
问题 I can produce a table with gridExtra: eg: library(gridExtra) grid.table(head(iris)) But this produces a rownames column 1:6. Is there a way to be able to suppress the rownames column so that it does not appear in the table? Thank you for your help. 回答1: Just add rows = NULL : grid.table(head(iris), rows = NULL) Another solution could be setting show.rownames = FALSE grid.table(head(iris), show.rownames = FALSE) 来源: https://stackoverflow.com/questions/15045396/r-suppressing-rownames-in-grid

grid.table and tableGrob in gridExtra package

删除回忆录丶 提交于 2019-12-30 06:12:45
问题 I am trying to format the table using gridExtra package. The gridExtra package I have is 2.0 and R version is 3.2.1 I was going through answers here on stackoverflow about the formatting and the suggested options seem to work only with older version of the package. For example, grid.table(data, h.even.alpha = 1, h.odd.alpha = 0, v.even.alpha = 1, v.odd.alpha = 1, gpar.corefill, gpar.coretext) All of these options are shown as "unused arguments" in the latest version. Searching further, I

Remove white space between plots and table in grid.arrange

那年仲夏 提交于 2019-12-30 04:58:19
问题 I would like to remove the large spacing that is inserted by default between the plots and the table in a grid.arrange, as shown in the MWE hereafter: require(ggplot2) require(gridExtra) list1=data.frame(mtcars[1:3, ]) # Dummy data p1 = ggplot(list1, aes(mpg,cyl)) + geom_point() # Dummy plot p2 = ggplot(list1, aes(disp,hp)) + geom_point() # Dummy plot plots <- arrangeGrob(p1, p2,nrow=2) table <- tableGrob(list1) grid.arrange(plots, table) I suspect this behaviour is due to the tableGrob, but

How to add multi-sub-columns in gridExtra::tableGrob

会有一股神秘感。 提交于 2019-12-25 06:26:41
问题 I'm attempting to engineer an R function that will accept a list and plot a table with specialized formatting. Here is my data: pottery <- list( `Llanederyn` = c( 14.4, 13.8, 14.6, 11.5, 13.8, 10.9, 10.1, 11.6, 11.1, 13.4, 12.4, 13.1, 12.7, 12.5 ), `Caldicot` = c( 11.8, 11.6 ), `Island Thorns` = c( 18.3, 15.8, 18.0, 18.0, 20.8 ), `Ashley Rails` = c( 17.7, 18.3, 16.7, 14.8, 19.1 ) ) myTableGrob( pottery ) Here is the function I am feeding the data into: myTableGrob <- function( data, padding =

Shared legend 3x3 ggplots

被刻印的时光 ゝ 提交于 2019-12-25 03:39:50
问题 I need a 3x3 ggplot with a shared legend. The Controlling the plot layout when sharing legends between several ggplot2 graphs question and answers solve this for 1x4 plot (not 3x3 which is what I need). I have tried to modify the function for my needs, after many attempts, I must admit that baptistes function is much beyond my R-knowledge. Here is a MWE, based on the same example in the refered question (hope it is ok to borrow it). library(ggplot2) library(grid) library(gridExtra) dsamp <-

ggplot2 + facet_: Reverse axes for some facets?

眉间皱痕 提交于 2019-12-24 08:58:18
问题 I've got three subplots I want to put together into one plot, and faceting would be a natural way to do it. However, one of these subplots would be easier/more natural to read with a reversed x-axis (whereas I'd like to leave the others alone). Is there a way to accomplish this using facet_grid() or facet_wrap()? The other alternative I've considered is grid.arrange(), and the chief problem I've run into there is getting it to align the subplots based on plot area (inside the axes), rather

r - Why can't I send a group of plots in a grid to PowerPoint with officer?

大憨熊 提交于 2019-12-23 18:13:59
问题 I've created a grid of qicharts2 plots using gridextra but when I try to send it to PowerPoint using officer I get this error.. Error in doc_parse_raw(x, encoding = encoding, base_url = base_url, as_html = as_html, : StartTag: invalid element name [68] This is my code: library(qicharts2) library(gridExtra) library(officer) library(rvg) #24 random numbers from a normal distribution for example. y1 <- rnorm(24) y2 <- rnorm(24) yC1 <- qic(y1) yC2 <- qic(y2) grid <- grid.arrange(yC1,yC2) filename

Edit style of grid.arrange title. Bold, italic etc. R

回眸只為那壹抹淺笑 提交于 2019-12-23 10:54:34
问题 I am creating a multi plot in R using grid.arrange , and wanted to change my title so that it is bold (and italic if possible). As this is a general question, I will not include the code for my plots, but the code I am using to make my multi plot is: grid.arrange(g1, g3, g4+theme(legend.position="none"),mylegend, top="Test title", layout_matrix=matrix(c(1,1,2,3,4,4), ncol=2, byrow=TRUE),heights=c(1,1.5,0.3)) Are there any additional arguments which can be passed to the top argument to change

Incorrect left align using tableGrob

倾然丶 夕夏残阳落幕 提交于 2019-12-23 09:48:27
问题 When I create a tableGrob with left justified strings, the final result shows the strings clipped at the end. Is a bug or I missed something? library(gridExtra) slices <- c(10, 12, 4, 16, 8) lbls <- c("US", "UK", "long string left justified but is clipped at the end", "Germany", "France") z <- data.frame(lbls,slices) grid.newpage() grid.draw(tableGrob(z, core.just="left")) 回答1: It's a bug; the package author clearly doesn't understand text justification in grid. You can sort of fix it like so

Saving plots using grid_draw method instead of gridExtra

本小妞迷上赌 提交于 2019-12-22 09:46:24
问题 I have used gridExtra to create 2 plots next to each other and I can save the object using ggsave However, the plots are misaligned in gridExtra so I used this method #Method 2 - gtable require(gtable) #Extract Grobs g1<-ggplotGrob(left) g2<-ggplotGrob(right) #Bind the tables g<-gtable:::cbind_gtable(g1, g2, "first") #Remove a row between the plots g <- gtable_add_cols(g, unit(-1,"cm"), pos=ncol(g1)) #draw grid.newpage() grid.draw(g) this method is covered in this link The perils of aligning