我正在使用ApexCharter
库来制作饼图,我想将显示的标签更靠近中心,因为它们看起来太"偏离"了.
我try 在ax_dataLabels和Pie_opts中使用负值调整Offset和extAnchor参数,但这并没有改变任何东西.我是否使用了错误的参数或将其放在了错误的位置?
这是我的最新try :
library(dplyr)
library(apexcharter)
dummy_data <- tibble(Fruit = c("Orange", "Apple", "Tomato", "Blueberry"),
n = c(6, 4, 3, 5))
dummy_plot <- apex(dummy_data, type = "pie", mapping = aes(x = Fruit, y = n)) %>%
ax_dataLabels(textAnxhor = "start", offsetX = -50, enabled = TRUE, style = list(fontSize = "16px")) %>%
ax_title(text = "Dummy Render", align = "top", style = list(fontSize = "18px")) %>%
ax_legend(position = "bottom") %>%
ax_colors(c('#EE9B00', '#116702', '#AE2012', '#0034FF')) %>%
ax_plotOptions(pie_opts(dataLabels = list(offset = -50)))
dummy_plot