我一直在尝试使用 R 中的 highcharter packaga 创建这个简单的图表,但它不起作用。
我不知道是否必须将对象类更改为因子。
有什么帮助吗?
library(gapminder)
library(highcharter)
df <- gapminder::gapminder %>%
filter(continent == 'Americas', year == 2007)
df%>%
hchart(
'scatter',
names = 'SQUADS',
hcaes(y = country,
x = factor(lifeExp)
),
color = '#B55C64'
# colorByPoint = TRUE
) %>%
hc_yAxis(
type = 'category',
categories = df$country,
tickAmount = 20,
gridLineWidth = 0.5,
gridLineColor = 'gray',
gridLineDashStyle = "longdash",
title = list(text = ''))