Попытка выяснить это, если highcharter позволяет отображать пузырьки по размеру в легенде.
Данные выглядят как
> dput(unbanked)
structure(list(country = c("DZ", "BJ", "BW", "BF", "CM", "CF",
"TD", "CD", "CG", "CI", "ET", "GA", "GH", "GN", "KE", "LS", "LR",
"MG", "MW", "ML", "MR", "MA", "MZ", NA, "NE", "NG", "RW", "SN",
"SL", "ZA", "SS", "TZ", "TG", "TN", "UG", "ZM", "ZW"), lat = c(28.033886,
9.30769, -22.328474, 12.238333, 7.369722, 6.611111, 15.454166,
-4.038333, -0.228021, 7.539989, 9.145, -0.803689, 7.946527, 9.945587,
-0.023559, -29.609988, 6.428055, -18.766947, -13.254308, 17.570692,
21.00789, 31.791702, -18.665695, -22.95764, 17.607789, 9.081999,
-1.940278, 14.497401, 8.460555, -30.559482, 4.8472, -6.369028,
8.619543, 33.886917, 1.373333, -13.133897, -19.015438), lon = c(1.659626,
2.315834, 24.684866, -1.561593, 12.354722, 20.939444, 18.732207,
21.758664, 15.827659, -5.54708, 40.489673, 11.609444, -1.023194,
-9.696645, 37.906193, 28.233608, -9.429499, 46.869107, 34.301525,
-3.996166, -10.940835, -7.09262, 35.529562, 18.49041, 8.081666,
8.675277, 29.873888, -14.452362, -11.779889, 22.937506, 31.59,
34.888822, 0.824782, 9.537499, 32.290275, 27.849332, 29.154857
), name = c("Algeria", "Benin", "Botswana", "Burkina Faso", "Cameroon",
"Central African Republic", "Chad", "Congo, Dem. Rep", "Congo, Brazzaville",
"Cote d'Ivoire", "Ethiopia", "Gabon", "Ghana", "Guinea", "Kenya",
"Lesotho", "Liberia", "Madagascar", "Malawi", "Mali", "Mauritania",
"Morocco", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda",
"Senegal", "Sierra Leone", "South Africa", "South Sudan", "Tanzania",
"Togo", "Tunisia", "Uganda", "Zambia", "Zimbabwe"), z = c(0.88,
1.37, 0.17, 2.1, 2.93, 0.52, 0.86, 3.77, 0.36, 2.1, 19.38, 0.22,
1.81, 1.08, 4.7, 0.14, 0.91, 0.44, 2.54, 2.15, 0.37, 1, 1.91,
0.06, 0.72, 23.57, 2.38, 1.6, 1.27, 8.4, 0.81, 3.4, 0.71, 0.2,
5.21, 1.05, 1.47)), class = c("spec_tbl_df", "tbl_df", "tbl",
"data.frame"), row.names = c(NA, -37L), spec = structure(list(
cols = list(country = structure(list(), class = c("collector_character",
"collector")), lat = structure(list(), class = c("collector_double",
"collector")), lon = structure(list(), class = c("collector_double",
"collector")), name = structure(list(), class = c("collector_character",
"collector")), z = structure(list(), class = c("collector_double",
"collector"))), default = structure(list(), class = c("collector_guess",
"collector")), skip = 1), class = "col_spec"))
Желаемый результат равен
Текущий статус здесь
@ JBKunst ответил мне в Твиттере, это определенно возможно с Highcharts, но как добавить его, если вы не .js человек?
Мой код
hcmap("custom/africa") %>%
hc_add_series(data = data, type = "mapbubble",
maxSize = '10%', color = "Red",
name = "Name", showInLegend = FALSE) %>%
hc_legend(enabled = FALSE)
Спасибо!
UPD
Я добавил
hc_legend(enabled = TRUE, layout = "vertical",
align = "right", bubbleLegend = list(enabled = TRUE))
, но это определенно далеко от совершенства.В идеале мне нужно 3 пузырька - минимальное, среднее, максимальное значение.
UPD2 Автор пакета создал проблему GitHub после моей проблемы