这在以前没有发生过,然后在某些时候我的尺寸函数就有点崩溃了,任何指定尺寸的尝试都会导致图像膨胀到一个荒谬的尺寸。这是我将大小设置为 0.1 的代码:
G <- ggplot(G1, aes(x=Week, y=YPA)) +
geom_hline(yintercept=7.4, linetype="dotted") +
geom_segment(mapping=aes(x=1, xend=1, y=6.2, yend=7.8), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=3, xend=3, y=7.730769231, yend=7.2), linetype="longdash", color = "red") +
geom_segment(mapping=aes(x=4, xend=4, y=5, yend=7), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=5, xend=5, y=7, yend=8.4), linetype="longdash", color = "red") +
geom_segment(mapping=aes(x=6, xend=6, y=5.5, yend=8), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=7, xend=7, y=5.5, yend=6.5), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=9, xend=9, y=8.3, yend=9), linetype="longdash", color = "red") +
geom_segment(mapping=aes(x=10, xend=10, y=6.689655172, yend=8), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=11, xend=11, y=3.095238095, yend=6.2), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=12, xend=12, y=6.46875, yend=8.1), linetype="longdash", color = "green") +
geom_segment(mapping=aes(x=13, xend=13, y=8.518518519, yend=8), linetype="longdash", color = "red") +
labs(title = "\nOU Opponent Passing Efficiency By Week - 2019\n",
y = "\nYards per Pass Attempt", x="Week\n",
caption = "Figure: @stevenplai | Data: ESPN | Images: ESPN") +
theme_minimal() +
theme(
plot.title = element_text(size=40, face = "bold", family = "Helvetica"),
plot.subtitle = element_text(size=25, family = "Helvetica"),
axis.ticks = element_line(),
axis.text = element_text(size=15),
axis.title = element_text(size=30),
plot.caption = element_text(size=20, family = "Helvetica"),
legend.position = "none",
) +
scale_x_continuous(labels = c(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, "CC"),
breaks=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)) +
scale_y_continuous(labels = c(4,5,6,7,"FBS Avg",8,9),
breaks=c(4,5,6,7,7.4,8,9)) +
geom_image(mapping=aes(image=logo, size=.1))
如果我只是从最后一行代码中删除“size=.1”,这就是它产生的结果
第二张图片更接近我想要的,但图片有点太小了,到目前为止我无法改变尺寸。
这以前从未发生在我身上,也没有发生过,所以我确信我只是做了一些愚蠢的事情。预先感谢您的帮助。
旁注:这是一个单独的问题,但我还是要问,因为这看起来很简单。有谁知道如何对每个 X 值中的一个图像进行着色/淡化?我尝试过的任何方法似乎都不起作用。