【发布时间】:2020-07-08 09:21:38
【问题描述】:
当我将 y-max 设为大于 500 时,我在右侧得到了很大的余量,但当 ymax 低于 500 时,它看起来很好。
请参阅下面的 MWE:
library(highcharter)
library(data.table)
tmp.df.agg <- data.table(ContractName_interval = factor(c("Republican1",
"Republican2",
"Republican3",
"No Market1",
"Democratic3",
"Democratic2",
"Democratic1")),
votes = c(15,73,38,337,9,56,10),
color = c("#9f0000",
"#cf0000",
"#f9adad",
"#d3d3d3",
"#b5cacf",
"#81b5c0",
"#578b96"))
p <- highchart() %>%
hc_add_series(type = "bar",
data = tmp.df.agg,
hcaes(y = votes, group = ContractName_interval),
dataLabels = list(
enabled = TRUE,
style = list(textOutline = FALSE, fontSize = 20)
)) %>%
hc_colors(tmp.df.agg$color) %>%
hc_xAxis(visible = FALSE, min = -1, max = 1) %>%
hc_legend(enabled = FALSE) %>%
hc_plotOptions(series=list(stacking='normal')) %>%
hc_chart(backgroundColor = "transparent")
p %>%
hc_yAxis(visible = FALSE, min = 1, max = 501)
p %>%
hc_yAxis(visible = FALSE, min = 1, max = 500)
当我根本不使用轴限制时,右边距也太大了。
【问题讨论】:
标签: r graph highcharts margin r-highcharter