0

I have a group of 15-20 plots produced using facet_wrap

P <- Data_Backs %>% 
ggplot(aes(x=Period, y=M_Min, colour = Day_Week)) + 
geom_point(alpha = .3, size = 2)+
geom_line(aes(group=`Day Name`)) +
geom_hline(yintercept = 120, show.legend = T)+
facet_grid(facets =  Position~Player.Name) + 
geom_smooth()+
theme(plot.title = element_text(size=.1)) 

I need to be able to print off the plots but this produces them in a very cramped small manner. Ideally I need 6 plots per A4 page (2x3 grid per page) I've tried using the answer here: Segment facet_wrap into multi-page PDF But was unable to change the script enough for my situation?

Is this possible?? Thanks

EDIT: Added data

Data_Backs = structure(list(Season = c(1718, 1718, 1718, 1718, 1718, 1718, 
1718, 1718, 1718, 1718), Week = c("Wk 40 Newcastle_H", "Wk 40 Newcastle_H", 
"Wk 40 Newcastle_H", "Wk 40 Newcastle_H", "Wk 40 Newcastle_H", 
"Wk 40 Newcastle_H", "Wk 40 Newcastle_H", "Wk 40 Newcastle_H", 
"Wk 40 Newcastle_H", "Wk 40 Newcastle_H"), Day_Week = c("Wk 40 Newcastle_H 
A_League_Newcaslte", 
"Wk 40 Newcastle_H A_League_Newcaslte", "Wk 40 Newcastle_H 
A_League_Newcaslte", 
"Wk 40 Newcastle_H A_League_Newcaslte", "Wk 40 Newcastle_H 
A_League_Newcaslte", 
"Wk 40 Newcastle_H A_League_Newcaslte", "Wk 40 Newcastle_H 
A_League_Newcaslte", 
"Wk 40 Newcastle_H A_League_Newcaslte", "Wk 40 Newcastle_H 
A_League_Newcaslte", 
"Wk 40 Newcastle_H A_League_Newcaslte"), Date = structure(c(1522627200, 
1522627200, 1522627200, 1522627200, 1522627200, 1522627200, 1522627200, 
1522627200, 1522627200, 1522627200), class = c("POSIXct", "POSIXt"
), tzone = "UTC"), Day = c("Mon", "Mon", "Mon", "Mon", "Mon", 
"Mon", "Mon", "Mon", "Mon", "Mon"), `Training/Match` = c("Match_A", 
"Match_A", "Match_A", "Match_A", "Match_A", "Match_A", "Match_A", 
"Match_A", "Match_A", "Match_A"), `Day Name` = c("A_League_Newcaslte", 
"A_League_Newcaslte", "A_League_Newcaslte", "A_League_Newcaslte", 
"A_League_Newcaslte", "A_League_Newcaslte", "A_League_Newcaslte", 
"A_League_Newcaslte", "A_League_Newcaslte", "A_League_Newcaslte"
), `Full Match/Training/Quarters` = c("Q_1", "Q_1", "Q_1", "Q_1", 
"Q_1", "Q_1", "Q_1", "Q_2", "Q_2", "Q_2"), `Squad Classification` = 
c("Academy", 
"Senior", "Senior", "Academy", "Academy", "Senior", "Academy", 
"Academy", "Senior", "Senior"), `Forward/Back` = c("Backs", "Backs", 
"Backs", "Backs", "Backs", "Backs", "Backs", "Backs", "Backs", 
"Backs"), Position = structure(c(8L, 6L, 5L, 8L, 7L, 8L, 7L, 
8L, 6L, 5L), .Label = c("Prop", "Hooker", "Second Row", "Back Row", 
"Scrum Half", "Fly Half", "Centre", "Wing/FullBack"), class = "factor"), 
Player.Name = c("Hearle Alex", "Jones Dorian", "Hart Grayson", 
"David Nick", "Lawrence Ollie", "Howe Tom", "Butler Will", 
"Hearle Alex", "Jones Dorian", "Hart Grayson"), Period = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Min_1", 
"Min_2", "Min_3", "Min_4", "Min_5", "Min_6", "Min_7", "Min_8", 
"Min_9", "Min_10"), class = "factor"), M_Min = c(167.1708, 
147.061866666667, 153.61675, 169.90125, 141.748647746244, 
133.883, 162.0338, 121.41225, 158.517633333333, 167.148414023372
)), .Names = c("Season", "Week", "Day_Week", "Date", "Day", 
"Training/Match", "Day Name", "Full Match/Training/Quarters", 
"Squad Classification", "Forward/Back", "Position", "Player.Name", 
"Period", "M_Min"), row.names = c(NA, -10L), class = c("tbl_df", 
"tbl", "data.frame"))
bdemarest
  • 14,397
  • 3
  • 53
  • 56
NColl
  • 757
  • 5
  • 19
  • 1
    Check out the [`ggplus` package](https://github.com/guiastrennec/ggplus). – eipi10 Apr 16 '18 at 18:24
  • 1
    Alternatively, have a look at `facet_wrap_paginate()` from the [`ggforce` package](https://cran.r-project.org/web/packages/ggforce/vignettes/Visual_Guide.html#pagination). – markus Apr 16 '18 at 18:25
  • @eipi10 I get the following error when I go to load either `ggplus` or `ggforce`, `Error: package or namespace load failed for ‘ggforce’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace ‘rlang’ 0.2.0 is already loaded, but >= 0.2.0.9001 is required` . Not sure what it means but looks like my version of R is out of date? – NColl Apr 16 '18 at 18:32
  • Fixed above issue with ggforce/ggplus – NColl Apr 16 '18 at 18:37
  • Can you `dput(head(Data_Backs, 10))` your data instead for us to easily copy and paste in our environments? – Parfait Apr 16 '18 at 18:44
  • @Parfait Added dput, thanks – NColl Apr 16 '18 at 18:48

0 Answers0