使用ggpubr :: lineplot的连续x轴问题

时间:2019-01-16 15:47:44

标签: r ggplot2 line-plot ggpubr

我正在使用ggpubr :: lineplot绘制线图。我的x轴是连续变量。

df <- data.frame(time=c(1, 5, 20),
                 len=c(4.2, 10, 29.5))
library(ggpubr)
ggline(df, x = "time", y = "len")

我的时间标签等距。似乎lineplot将时间视为因子而不是连续变量。

有人知道如何纠正吗?我想使用ggpubr :: lineplot,因为它具有许多其他功能。我知道如何用ggplot绘制线条。

1 个答案:

答案 0 :(得分:1)

numeric.x.axis参数正是用于此目的!

ggline(df, x = "time", y = "len", numeric.x.axis = TRUE)

enter image description here