'Plotting a Throw Trajectory in R
Here's the data
structure(list(ThrowSpeed = 73.01448, PopTime = 1.600322, ExchangeTime = 0.69207,
TimeToBase = 0.908252, CatchPositionX = -1.37782, CatchPositionY = 2.65907,
CatchPositionZ = 0.5019, ThrowPositionX = -4.6391, ThrowPositionY = 4.21092,
ThrowPositionZ = 3.75256, BasePositionX = 62.55366, BasePositionY = 3.48949,
BasePositionZ = 62.22463, ThrowTrajectoryXc0 = -4.58109,
ThrowTrajectoryXc1 = 81.31084, ThrowTrajectoryXc2 = -8.11795,
ThrowTrajectoryYc0 = 4.26976, ThrowTrajectoryYc1 = 13.99541,
ThrowTrajectoryYc2 = -16.32979, ThrowTrajectoryZc0 = 3.7578,
ThrowTrajectoryZc1 = 67.17178, ThrowTrajectoryZc2 = -3.07957), row.names = c(NA, -1L), class = "data.frame")
Essentially I want to make a graph where the catcher (CatchPosition) and Base (BasePosition) are visible with a visualization in R of the throw (ThrowTrajectory)
I understand this is rather open ended, so if you have any ideas or suggestions onto how to create an effective visual for this in R, it would be very helpful!
Solution 1:[1]
These variable names are not self explanatory, but here goes a shot:
library(ggplot2)
ggplot(df) +
geom_point(aes(CatchPositionX, CatchPositionY, color = "Catch")) +
geom_point(aes(BasePositionX, BasePositionY, color = "Base")) +
geom_segment(aes(x = ThrowTrajectoryXc1, xend = ThrowTrajectoryXc2,
y = ThrowTrajectoryYc1, yend = ThrowTrajectoryYc2),
color = "black", arrow = arrow())
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jon Spring |

