datamaps icon indicating copy to clipboard operation
datamaps copied to clipboard

Add documentation for available values for "scope"

Open happyshows opened this issue 7 years ago • 4 comments

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.

happyshows avatar May 02 '18 19:05 happyshows

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};
                                   }')
    )

JohnCoene avatar May 03 '18 12:05 JohnCoene

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?

happyshows avatar May 03 '18 13:05 happyshows

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.

JohnCoene avatar May 03 '18 14:05 JohnCoene

echarts4r is very cool, thanks.

happyshows avatar May 03 '18 14:05 happyshows