R 刻度上的断裂(x)连续不';好像不行

R 刻度上的断裂(x)连续不';好像不行,r,ggplot2,R,Ggplot2,我只是试图显示一个绘图(5,4,3,2,1,5)的x轴上的断点,但它不会显示.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

我只是试图显示一个绘图(5,4,3,2,1,5)的x轴上的断点,但它不会显示.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"))

标签没有数据很难回答,但如果您想显示所有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"))

请注意,无需使用此方法对剩余时间进行排序,也无需将标签按相反顺序排序。

请将部分或全部的
kobe\u vs_kawhi
提供给。我想你可能想要
scale\u x\u reverse()
而不是
scale\u continuous()
。我不知道如何编辑以提供数据,但我有一个带有以下数字(5,4,3,2,1,5)的时间数字变量,我希望在x轴上为每个数字都添加一个标签。它不想显示.5,我不知道如何将其添加到图表中。