如何在yaxis轴标签上放置字母?
我希望yaxis标签为(a,e,i,o,u)而不是(0,25,50,75,100),但是我得到的是(a,25,50,75,100)
我正在尝试以下
highchart() %>%
hc_chart(type="bar",zoomType="x") %>%
hc_yAxis(
categories = c("a","e","i","o","u"),
title='',
tickInterval=25,
min=0,
max=100)%>%
...
谢谢
答案 0 :(得分:1)
这不是问题,categories
中的hc_yAxis
是按顺序分配的,因此在您的情况下,它将从0
替换为5
(包括)。您可以使用seq
修改并替换。
categories_list <- list("0"="a","25"="e","50"="i","75"="o","100"="u")
categories <- seq(0, 100)
for (v in names(categories_list)) {
categories[[as.integer(v) + 1]] <- categories_list[[v]]
}
highchart() %>%
hc_add_series(name = "Tokyo", data = citytemp$tokyo) %>%
hc_add_series(name = "New York", data = citytemp$new_york) %>%
hc_add_series(name = "Berlin", data = citytemp$berlin) %>%
hc_chart(type="bar",zoomType="x") %>%
hc_yAxis(
categories = categories,
title='',
tickInterval=25,
min=0,
max=100)
结果: