[英]Axis Label Truncated in highcharter Barplot
This looks as expected:这看起来符合预期:
df <- structure(list(surveillance_diag = c("Meningitis", "Sepsis"),
y = c(1239L, 7850L), color = c("#1f78b4", "#e31a1c"),
freq = c(14, 86)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"))
library(highcharter)
library(magrittr)
highchart() %>%
hc_yAxis(title = "") %>%
hc_xAxis(categories = df$surveillance_diag) %>%
hc_add_series(data = df, type = "bar", hcaes(x = surveillance_diag, y = y, color = color))
But the same code with a data frame of only one row/category will cut the category label.但是只有一行/类别的数据框的相同代码将删除类别 label。
df <- df[1, ]
highchart() %>%
hc_yAxis(title = "") %>%
hc_xAxis(categories = df$surveillance_diag) %>%
hc_add_series(data = df, type = "bar", hcaes(x = surveillance_diag, y = y, color = color))
How can I ensure that the label is properly displayed regardless of the number of categories?无论类别数量如何,如何确保 label 正确显示?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.