Open happyshows opened 6 years ago
arcs <- data.frame(from = "USA", to = "CHN")
arcs %>%
datamaps(width = 600, height = 600) %>%
add_arcs_name(from, to) %>%
set_projection(htmlwidgets::JS('function() {
var projection = d3.geo.mercator()
.rotate([150,0])
.scale(600 / 2 / Math.PI)
.translate([600 / 2, 600 / 2]);
var path = d3.geo.path().projection( projection );
return {path: path, projection: projection};
}')
)
Maybe there's some issue with the transformation function, it's pointing to Canada at the moment.
Also, is it possible to mark multiple airport in china and point to multiple airports in US?
Indeed. I will investigate this.In the meantime it looks like you might need a more powerful library for what you want to do, I have echarts4r which, though not on CRAN, has been thoroughly tested and includes much more powerful functions for what you want to do, the gallery includes a good example of connected airports. Will let you know about datamaps arcs when I have the time.
echarts4r is very cool, thanks.
Is there any scope like 'pacific' which allow me to have a arc from China to US?
World may be to much for the above use case.