1

我正在使用 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")

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

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

4

1 回答 1

1

论据numeric.x.axis正是为此!

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

在此处输入图像描述

于 2019-01-16T15:56:54.030 回答