Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for available values for "scope" #1

Open
happyshows opened this issue May 2, 2018 · 4 comments
Open

Add documentation for available values for "scope" #1

happyshows opened this issue May 2, 2018 · 4 comments

Comments

@happyshows
Copy link

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.

@JohnCoene
Copy link
Owner

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

@happyshows
Copy link
Author

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?

@JohnCoene
Copy link
Owner

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.

@happyshows
Copy link
Author

echarts4r is very cool, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants