I'm using plotrix in R to draw NBA court features for plotting basketball shots. I'm having trouble getting the arc of the 3pt line exactly the way I want it. Using draw.arc and draw.circle allows the top of the arc to float. The top of the arc should always be at 29ft. draw.ellipse seems to solve this problem. However, when I segment the ellipse it leaves a "cross line" through the middle of the court depiction that I'd like to remove. However, I must segment the ellipse or it will extend past where it needs to. Any ideas?
Code used:
setwd("~")
library("plotrix", lib.loc="~/R/win-library/3.1")
library("RColorBrewer", lib.loc="~/R/win-library/3.1")
korver <- read.csv("Korver_XY_Test.csv", header = TRUE)
x <- (korver$x)
y <- (korver$y)
plot(x,y, cex=.7, col=brewer.pal(3, "Greens"))
#Draw 3pt Line
segments(3,0,3,14.19777, lwd=3)
segments(47,0,47,14.19777, lwd=3)
draw.ellipse(x=25, y=5.25, deg=TRUE, angle=0, arc.only= TRUE, segment=rbind(c(22,0),c(158,360)), a=23.75, b=23.75, border=1, nv=200, lwd=3)
#Draw Half Court Line
segments(0,47,50,47, lwd=4)
#Draw Court Boundaries
abline(v=0, lwd=5)
abline(v=50, lwd=5)
abline(h=94, lwd=5)
abline(h=0, lwd =5)
#draw lane
segments(17,0,17,19, lwd=3)
segments(33,0,33,19, lwd=3)
segments(19,0,19,19, lwd=3)
segments(31,0,31,19, lwd=3)
segments(17,19,33,19, lwd=3)
draw.circle(25,19,6,100,lwd=3)
#draw hoop
draw.circle(25,5.25, 0.75, 200, lwd=2)
#draw backboard
segments(22,4,28,4, lwd=4)