我正在使用R中的highcharter
库处理一些可视化的水平条形图。但是,我发现图例没有根据group
变量定义的配色方案显示。
library(highcharter)
library(tidyverse)
df%>%
group_by(course_code) %>%
hchart("bar", hcaes(x = course_code, y = completion_rate,
color = Language, group = Language)) %>%
hc_add_theme(hc_theme_google()) %>%
hc_tooltip(pointFormat = "<b> Completion rate: </b> {point.completion_rate}") %>%
hc_title(text = "Course Completion Rates",
style = list(fontSize = "15px", fontWeight = "bold")) %>%
hc_xAxis(title = list(text = "Courses")) %>%
hc_yAxis(title = list(text = "Completion Rate"))
有办法解决这个问题吗?
数据:here
2条答案
按热度按时间ecbunoof1#
您将需要
fill
美学:f8rj6qna2#
您应该在
hcaes
参数之外调用colors
,如下所示:输出量: