[R] Plotting lines to sets of points

lawnboy34 jay.pare at gmail.com
Sat Sep 8 01:01:22 CEST 2007


I am using R to plot baseball spray charts from play-by-play data. I have
used the following command to plot the diamond:

plot (0:250, -250:0, type="n", bg="white")
	lines(c(125,150,125,100,125),c(-210,-180,-150,-180,-210), col=c("black"))

I have also plotted different hit locations using commands such as the
following:

points(subset(framename$hit_x, framename$hit_traj=="line_drive"),
subset(-framename$hit_y, framename$hit_traj=="line_drive"), pch=20,
col=c("red"))

My question: Is there any easy way to plot a line from the origin (home
plate) to each point on the graph? Preferably the line would share the same
color as the dot that denotes where the ball landed. I have tried searching
Google and these forums, and most graphing questions have to do with
scatterplots or other varieties of graphs I am not using. Thanks very much
in advance.

-Jason
-- 
View this message in context: http://www.nabble.com/Plotting-lines-to-sets-of-points-tf4404235.html#a12564704
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list