【发布时间】:2021-08-15 00:24:26
【问题描述】:
下面是我当前的代码
target <- c("BallCalled", "StrikeCalled","StrikeSwinging")
TMData <- Trackman %>% filter(PitchCall %in% target)
plateframe <- 17+2*(9/pi)
strikezone <- ggplot(NULL, aes(x = px, y = pz)) +
geom_rect(xmin = -(plateframe/2)/12,
xmax = (plateframe/2)/12,
ymin = 1.5,
ymax = 3.6,
color = "black") +
coord_equal() +
scale_x_continuous("Horizontal Plate Location (ft.)",
limits = c(-2,2) +
scale_y_continuous("Vertical Plate Location (ft.)",
limits = c(0,5))
strikezone %+% sample_n(TMData, 264) +
aes(color = PitchCall) +
geom_point()
我遇到了不间断的错误。目前,这是我的图表
这是棒球数据。我按照教科书的说明画了一个打击区。然后,我在它上面绘制了位置。这是一些示例代码,它是垂直和水平位置
目前,它不会在我的代码中绘制所有 256 行数据。如果我不包括方框图,它确实绘制得很好。但是,我需要那个盒子。请帮忙
What I want is this, but with the box of the strike zone on top of it.
那只是一个带有 geom_point 的 ggplot(TMData, aes(x = px, y = pa) 图。我不知道为什么我不能将两者重叠。
【问题讨论】: