我只是试图在图表的x轴上显示中断点(5,4,3,2,1,.5),但不会显示.5。当我尝试在下面进行编码时,结果导致没有显示任何x标记,我也不知道为什么。
labels <- c(5,4,3,2,1,.5)
ggplot(kobe_vs_kawhi, aes(desc(Time_Left), FG_Percentage, color = Player)) +
geom_point() +
geom_smooth() +
scale_x_continuous(breaks = labels) +
scale_color_manual(values = c("red4", "gold2"))
答案 0 :(得分:0)
没有数据很难回答,但是如果您想显示所有这些x轴值并反过来尝试:
ggplot(kobe_vs_kawhi, aes(Time_Left, FG_Percentage, color = Player)) +
geom_point() +
geom_smooth() +
scale_x_reverse(breaks = labels) +
expand_limits(x = c(0, 5) +
scale_color_manual(values = c("red4", "gold2"))
请注意,使用此方法无需Time_Left
排序或labels
以相反的顺序排序。