我正在尝试创建一个折线图,rbokeh
其中 x 轴应该显示日期时间变量。
考虑以下示例:
data <- tibble(
time = as.POSIXct(c("2019-08-27 08:15:00",
"2019-08-27 10:30:00",
"2019-08-27 12:45:00")),
value = c(0.3, 0.6, 0.2)
)
figure(data = data) %>%
ly_lines(x = time,
y = value) %>%
ly_points(x = time,
y = value,
hover = value) %>%
x_axis(label = "Date"
# number_formatter = "numeral",
# format = list(hours = "%d %B %Y")
) %>%
y_axis(label = "Values",
number_formatter = "numeral",
format = list(percent = "0 %")) %>%
y_range(dat = c(0, 1))
这将产生以下图:
这不仅在 x 轴上显示了错误的值,而且它们的格式也很不方便。我尝试通过使用format
参数(在我的示例中已注释掉)将格式更改为更合适的方式,但这只会导致不再创建绘图。
这里发生了什么?