r-grid

Exact dimensions of linetype spacing and size

孤人 提交于 2020-08-07 09:51:38
问题 This is mostly a follow-up question on a previous one. Given that in ggplot2 and grid there are different linetypes and spacings vary between line sizes, what is their relationship? There are two things I do not quite understand. How is the line size defined? If I were to draw a straight vertical line and substitute it by a rectangle, what should be the width of the rectangle to get the equivalent of the line's size? Especially, how does the lwd = 1 or lwd = 10 I pass to par() / gpar() relate

Exact dimensions of linetype spacing and size

与世无争的帅哥 提交于 2020-08-07 09:51:26
问题 This is mostly a follow-up question on a previous one. Given that in ggplot2 and grid there are different linetypes and spacings vary between line sizes, what is their relationship? There are two things I do not quite understand. How is the line size defined? If I were to draw a straight vertical line and substitute it by a rectangle, what should be the width of the rectangle to get the equivalent of the line's size? Especially, how does the lwd = 1 or lwd = 10 I pass to par() / gpar() relate

Combine multiple facet strips across columns in ggplot2 facet_wrap

筅森魡賤 提交于 2020-07-06 23:25:48
问题 The bounty expires in 4 days . Answers to this question are eligible for a +50 reputation bounty. Björn wants to draw more attention to this question: It would be great to see a solution using grid & gtable without using additional packages. I am trying to combine facet strips across two adjacent panels (there is always two adjacent ones with the same first ID variable, but with two different scenarios, let's call them "A" and "B"). I am not particularly wedded to the gtable + grid solution I

Combine multiple facet strips across columns in ggplot2 facet_wrap

淺唱寂寞╮ 提交于 2020-07-06 23:25:11
问题 The bounty expires in 4 days . Answers to this question are eligible for a +50 reputation bounty. Björn wants to draw more attention to this question: It would be great to see a solution using grid & gtable without using additional packages. I am trying to combine facet strips across two adjacent panels (there is always two adjacent ones with the same first ID variable, but with two different scenarios, let's call them "A" and "B"). I am not particularly wedded to the gtable + grid solution I

How to increase space among different boxes created for the facet labels using `facet_nested`?

£可爱£侵袭症+ 提交于 2020-07-03 09:36:10
问题 I have a plot like this below: library(ggplot2) library(ggh4x) # remotes::install_github("teunbrand/ggh4x") df1 <- data.frame(x = rep(1:12, times=4, each=1), y = rep((1:12)^2, times=4, each=1), Variable1 = rep(c("A","B"), times=1, each=24), Variable2 = rep(c("C","D"), times=4, each=12)) g<-ggplot(df1, aes(x=x, y=y)) + geom_point(size=1.5) + theme(strip.background = element_rect(colour = "black", fill = "white", size = 1.5, linetype = "solid"), axis.title.x =element_text(margin = margin(t = 2,

How to increase space among different boxes created for the facet labels using `facet_nested`?

为君一笑 提交于 2020-07-03 09:36:06
问题 I have a plot like this below: library(ggplot2) library(ggh4x) # remotes::install_github("teunbrand/ggh4x") df1 <- data.frame(x = rep(1:12, times=4, each=1), y = rep((1:12)^2, times=4, each=1), Variable1 = rep(c("A","B"), times=1, each=24), Variable2 = rep(c("C","D"), times=4, each=12)) g<-ggplot(df1, aes(x=x, y=y)) + geom_point(size=1.5) + theme(strip.background = element_rect(colour = "black", fill = "white", size = 1.5, linetype = "solid"), axis.title.x =element_text(margin = margin(t = 2,

R: ggplot background gradient coloring

隐身守侯 提交于 2020-05-25 07:43:40
问题 I would like to generate ggplot’s with gradient coloring, filling both plot panel and its background, as herein shown. As you can see the gradient background coloring encompasses both plot panel and its background. At the moment, only an "approximation" of the required solution is known to me: library(ggplot2) library(grid) library(gridExtra) reds <- c("#7B0664", "#E32219") g <- rasterGrob(reds, width = unit(1, "npc"), height = unit(1, "npc"), interpolate = TRUE) ggplot(data = economics, aes