Posts

The strategy to draw a court is to define the different lines and use geom_path to draw each segment. For circles, we use the following function to create the x-y coordinates. For lines, we just define x-y start and end coordinates. library(ggplot2) draw_circle <- function(center = c(0, 0), diameter = 1, npoints = 12000, start = 0, end = 2){ tt <- seq(start*pi, end*pi, length.out = npoints) data.frame( x = center[1] + diameter / 2 * cos(tt), y = center[2] + diameter / 2 * sin(tt) ) } Now, we can define each line of the court.