I have soccer goal and assist coordinates in a data frame, which I've plotted by teams with a facet_wrap. I've added theme_solid() which is a part of ggthemes to remove all the extra crap that aren't really useful with these data. Except the titles for each plot, which would be the team names above each plot that are very much needed here. Is there an easy way to add just the titles back?
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
library('ggplot2')ggplot(data=data.frame(x=1,y=1),aes(x,y))+ ###grass: geom_rect(aes(xmin = -37, xmax = 37, ymin = -55.5, ymax = 55.5), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = 0, ymax = 6), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = 12, ymax = 18), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = 24, ymax = 30), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = 36, ymax = 41.5), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = 47, ymax = 52.5), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = -6, ymax = -12), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = -18, ymax = -24), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = -36, ymax = -30), fill = "darkolivegreen4", alpha = 0.7) + geom_rect(aes(xmin = -34, xmax = 34, ymin = -47, ymax = -41.5), fill = "darkolivegreen4", alpha = 0.7) + ###pitch: geom_path(data=data.frame(x=c(-34,-34,34,34,-34),y=c(-52.5,52.5,52.5,-52.5,-52.5)), colour = "white")+ ###halfway line: geom_path(data=data.frame(x=c(-34,34),y=c(0,0)), colour = "white")+ ###centre circle: geom_path(data=data.frame(x=c(-9150:(-1)/1000,1:9150/1000),y=c(sqrt(9.15^2-c(-9150:(-1)/1000,1:9150/1000)^2))),aes(x=x,y=y), colour = "white")+ geom_path(data=data.frame(x=c(-9150:(-1)/1000,1:9150/1000),y=-c(sqrt(9.15^2-c(-9150:(-1)/1000,1:9150/1000)^2))),aes(x=x,y=y), colour = "white")+ ##centre spot: geom_point(aes(x = 0, y = 0), size = 0.5, colour = "white") + ##penalty spots: geom_point(aes(x = 0, y = 41.5), size = 0.5, colour = "white") + geom_point(aes(x = 0, y = -41.5), size = 0.5, colour = "white") + ###penalty arc: geom_path(data=data.frame(x=c(-7280:(-1)/1000,1:7280/1000),y=c(41.5-sqrt(9.15^2-c(-7280:(-1)/1000,1:7280/1000)^2))),aes(x=x,y=y), colour = "white")+ geom_path(data=data.frame(x=c(-7280:(-1)/1000,1:7280/1000),y=-c(41.5-sqrt(9.15^2-c(-7280:(-1)/1000,1:7280/1000)^2))),aes(x=x,y=y), colour = "white")+ ###corner arcs: geom_path(data=data.frame(x=c(0:1000/1000)-34,y=c(52.5-sqrt(1^2-c(0:1000/1000)^2))),aes(x=x,y=y), colour = "white")+ geom_path(data=data.frame(x=c(0:1000/1000)-34,y=c(-52.5+sqrt(1^2-c(0:1000/1000)^2))),aes(x=x,y=y), colour = "white")+ geom_path(data=data.frame(x=c(0:1000/1000)+33,y=c(52.5-sqrt(1^2-c(-1000:0/1000)^2))),aes(x=x,y=y), colour = "white")+ geom_path(data=data.frame(x=c(0:1000/1000)+33,y=c(-52.5+sqrt(1^2-c(-1000:0/1000)^2))),aes(x=x,y=y), colour = "white")+ ###corner lines: geom_path(data=data.frame(x=c(-34,-34.5),y=c(43.35,43.35)), colour = "white") + geom_path(data=data.frame(x=c(-34,-34.5),y=c(-43.35,-43.35)), colour = "white") + geom_path(data=data.frame(x=c(34,34.5),y=c(43.35,43.35)), colour = "white") + geom_path(data=data.frame(x=c(34,34.5),y=c(-43.35,-43.35)), colour = "white") + geom_path(data=data.frame(x=c(-25.85,-25.85),y=c(52.5,53)), colour = "white") + geom_path(data=data.frame(x=c(25.85,25.85),y=c(52.5,53)), colour = "white") + geom_path(data=data.frame(x=c(-25.85,-25.85),y=c(-52.5,-53)), colour = "white") + geom_path(data=data.frame(x=c(25.85,25.85),y=c(-52.5,-53)), colour = "white") + ###6-yard box: geom_path(data=data.frame(x=c(-9.16,-9.16,9.16,9.16),y=c(-52.5,-47,-47,-52.5)), colour = "white")+ geom_path(data=data.frame(x=-c(-9.16,-9.16,9.16,9.16),y=-c(-52.5,-47,-47,-52.5)), colour = "white")+ ###goals geom_path(data=data.frame(x=c(-3.66,-3.66,3.66,3.66),y=c(-52.5,-53.5,-53.5,-52.5)), colour = "white")+ geom_path(data=data.frame(x=c(-3.66,-3.66,3.66,3.66),y=-c(-52.5,-53.5,-53.5,-52.5)), colour = "white")+ ###penalty areas: geom_path(data=data.frame(x=c(-20.15,-20.15,20.15,20.15),y=c(-52.5,-36,-36,-52.5)), colour = "white")+ geom_path(data=data.frame(x=c(-20.15,-20.15,20.15,20.15),y=c(52.5,36,36,52.5)), colour = "white")+ ###fix aspect ratio to 1:1 coord_fixed() + theme(line = element_blank(), text = element_text(family = "Verdana", face = "bold", colour = "black", size = 14, lineheight = 0.9, hjust = 0.5, vjust = 0.5, angle = 0, margin = margin(), debug = FALSE), rect = element_rect(fill = NA, size = 12, colour = NA, linetype = 0), panel.background = element_rect(fill = NA), axis.title.x = element_blank(), axis.title.y = element_blank(), axis.text.x = element_blank(), axis.text.y = element_blank(), strip.background = element_blank(), complete = TRUE) + geom_point(data = goals, aes(x=-20.15+x_ast, y=52.5-y_ast), colour = 'khaki1', size = 2) + geom_point(data = goals, aes(x=-20.15+x_goal, y=52.5-y_goal), colour = 'lightcoral', size = 2) + facet_wrap(~team, nrow = 2);
Is it possible for you to share your full code? I am curious how you did this.Sam
On Mon, Jan 2, 2017 at 2:11 PM, <jyr...@gmail.com> wrote:
Turns out it's easy enough to make a custom theme. For your viewing pleasure, the final result:
On Saturday, 31 December 2016 03:33:14 UTC+2, jyr...@gmail.com wrote:I have soccer goal and assist coordinates in a data frame, which I've plotted by teams with a facet_wrap. I've added theme_solid() which is a part of ggthemes to remove all the extra crap that aren't really useful with these data. Except the titles for each plot, which would be the team names above each plot that are very much needed here. Is there an easy way to add just the titles back?
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.