facet

Adding sample size to a box plot at the min or max of the facet in ggplot

吃可爱长大的小学妹 提交于 2021-01-01 08:07:14
问题 There are plenty of explanations, including this good one, of how to label box plots with sample size. All of them seem to use max(x) or median(x) to position the sample size. I'm wondering if there is a way to easily position the labels at the top or bottom of the plot, especially when using the scale = "free_y" command in facet where the max and minimum value for the axis is picked automatically for each facet by ggplot. The reason is that I am creating multiple facets where the

Why does a commandLink within a facet within a composite component renders an error?

99封情书 提交于 2020-12-30 08:17:14
问题 When I create a composite component with a facet in it and place a command link within that facet, I get an error message: This link is disabled as it is not nested within a JSF form. A commandButton does not behave in the same way, so I am inclined to this this is a bug. index.xhtml : <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns

Why does a commandLink within a facet within a composite component renders an error?

Deadly 提交于 2020-12-30 08:16:26
问题 When I create a composite component with a facet in it and place a command link within that facet, I get an error message: This link is disabled as it is not nested within a JSF form. A commandButton does not behave in the same way, so I am inclined to this this is a bug. index.xhtml : <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns

different text in each facet window [duplicate]

左心房为你撑大大i 提交于 2020-08-26 10:37:05
问题 This question already has an answer here : Add text to individual facets in ggplot (1 answer) Closed 2 years ago . I am trying to add median and mean values to each facet window using the following code: library(dplyr) library(ggplot2) data(iris) setosa <- filter(iris, Species == "setosa") versicolor <- filter(iris, Species == "versicolor") virginica <- filter(iris, Species == "virginica") median1 <- round(median(setosa$Sepal.Length), 1) mean1 <- round(mean(setosa$Sepal.Length), 1) median2 <-

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,

Using facet tags and strip labels together in ggplot2

心不动则不痛 提交于 2020-06-25 21:14:27
问题 I'd like to create a figure using ggplot2 's facet_grid , like below: # Load ggplot2 library for plotting library(ggplot2) # Plot dummy data p <- ggplot(mtcars, aes(mpg, wt)) p <- p + geom_point() p <- p + facet_grid(gear ~ cyl) print(p) This is great, but since it's going in a journal article each panel also needs to be labelled with a, b, c, etc. The package egg has a great function for this called tag_facet , which is used as follows: # Load egg library for tagging library(egg) #> Warning:

ggplot2: add regression equations and R2 and adjust their positions on plot

大兔子大兔子 提交于 2020-06-25 03:26:12
问题 Using df and the code below library(dplyr) library(ggplot2) library(devtools) df <- diamonds %>% dplyr::filter(cut%in%c("Fair","Ideal")) %>% dplyr::filter(clarity%in%c("I1" , "SI2" , "SI1" , "VS2" , "VS1", "VVS2")) %>% dplyr::mutate(new_price = ifelse(cut == "Fair", price* 0.5, price * 1.1)) ggplot(df, aes(x= new_price, y= carat, color = cut))+ geom_point(alpha = 0.3)+ facet_wrap(~clarity, scales = "free_y")+ geom_smooth(method = "lm", se = F) I got this plot Thanks to @kdauria's answer to