ropensci / osmplotr

Data visualisation using OpenStreetMap objects
https://docs.ropensci.org/osmplotr
135 stars 21 forks source link

use coord_map() instead of coord_equal() #28

Closed ThierryO closed 6 years ago

ThierryO commented 6 years ago

works with the setup below

Session info -------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.2 (2017-09-28)
 system   x86_64, linux-gnu           
 ui       RStudio (1.1.330)           
 language nl_BE:nl                    
 collate  nl_BE.UTF-8                 
 tz       Europe/Brussels             
 date     2017-10-04                  

Packages -----------------------------------------------------------------------------------------------------
 package        * version    date       source                        
 abind            1.4-5      2016-07-21 CRAN (R 3.4.0)                
 BH               1.65.0-1   2017-08-24 CRAN (R 3.4.1)                
 class            7.3-14     2015-08-30 CRAN (R 3.4.0)                
 colorspace       1.3-2      2016-12-14 CRAN (R 3.4.0)                
 curl             2.8.1      2017-07-21 cran (@2.8.1)                 
 deldir           0.1-14     2017-04-22 CRAN (R 3.4.0)                
 dichromat        2.0-0      2013-01-24 CRAN (R 3.4.0)                
 digest           0.6.12     2017-01-27 CRAN (R 3.4.0)                
 e1071            1.6-8      2017-02-02 CRAN (R 3.4.0)                
 ggm              2.3        2015-01-21 CRAN (R 3.4.1)                
 ggplot2          2.2.1      2016-12-30 CRAN (R 3.4.2)                
 goftest          1.1-1      2017-04-03 CRAN (R 3.4.0)                
 graphics       * 3.4.2      2017-09-29 local                         
 grDevices      * 3.4.2      2017-09-29 local                         
 grid             3.4.2      2017-09-29 local                         
 gtable           0.2.0      2016-02-26 CRAN (R 3.4.0)                
 httr             1.3.1      2017-08-20 CRAN (R 3.4.1)                
 igraph           1.1.2      2017-07-21 CRAN (R 3.4.1)                
 irlba            2.2.1      2017-05-17 CRAN (R 3.4.0)                
 jsonlite         1.5        2017-06-01 cran (@1.5)                   
 labeling         0.3        2014-08-23 CRAN (R 3.4.0)                
 lattice          0.20-35    2017-03-25 CRAN (R 3.4.1)                
 lazyeval         0.2.0      2016-06-12 CRAN (R 3.4.0)                
 lubridate        1.6.0      2016-09-13 CRAN (R 3.4.0)                
 magrittr         1.5        2014-11-22 CRAN (R 3.4.0)                
 MASS             7.3-47     2017-04-21 CRAN (R 3.4.0)                
 Matrix           1.2-11     2017-08-16 CRAN (R 3.4.1)                
 methods        * 3.4.2      2017-09-29 local                         
 mgcv             1.8-22     2017-09-19 CRAN (R 3.4.2)                
 mime             0.5        2016-07-07 CRAN (R 3.4.0)                
 munsell          0.4.3      2016-02-13 CRAN (R 3.4.0)                
 nlme             3.1-131    2017-02-06 CRAN (R 3.4.0)                
 openssl          0.9.7      2017-09-06 CRAN (R 3.4.2)                
 osmdata          0.0.5      2017-08-13 CRAN (R 3.4.1)                
 osmplotr       * 0.3.0      2017-10-04 local                         
 pkgconfig        2.0.1      2017-03-21 CRAN (R 3.4.0)                
 plyr             1.8.4      2016-06-08 CRAN (R 3.4.0)                
 polyclip         1.6-1      2017-03-22 CRAN (R 3.4.0)                
 R6               2.2.2      2017-06-17 CRAN (R 3.4.0)                
 RColorBrewer     1.1-2      2014-12-07 CRAN (R 3.4.0)                
 Rcpp             0.12.13    2017-09-28 CRAN (R 3.4.2)                
 reshape2         1.4.2      2016-10-22 CRAN (R 3.4.0)                
 rgeos            0.3-25     2017-09-25 CRAN (R 3.4.2)                
 rlang            0.1.2      2017-08-09 cran (@0.1.2)                 
 rpart            4.1-11     2017-04-21 CRAN (R 3.4.0)                
 rvest            0.3.2      2016-06-17 CRAN (R 3.4.1)                
 scales           0.5.0.9000 2017-09-20 Github (hadley/scales@d767915)
 selectr          0.3-1      2016-12-19 CRAN (R 3.4.1)                
 sp               1.2-5      2017-06-29 CRAN (R 3.4.1)                
 spatstat         1.52-1     2017-08-16 CRAN (R 3.4.1)                
 spatstat.utils   1.7-1      2017-09-23 CRAN (R 3.4.2)                
 stats          * 3.4.2      2017-09-29 local                         
 stringi          1.1.5      2017-04-07 CRAN (R 3.4.0)                
 stringr          1.2.0      2017-02-18 CRAN (R 3.4.0)                
 tensor           1.5        2012-05-05 CRAN (R 3.4.0)                
 tibble           1.3.4      2017-08-22 cran (@1.3.4)                 
 tools            3.4.2      2017-09-29 local                         
 utils          * 3.4.2      2017-09-29 local                         
 viridisLite      0.2.0      2017-03-24 CRAN (R 3.4.0)                
 xml2             1.1.1      2017-07-27 Github (hadley/xml2@4be4590)  
mpadge commented 6 years ago

Thanks for the contribution Thierry, but unless something has changed the comment still pertains in the code you've now deleted. However, I have since read somewhere about how this can be achieved, so will dig around and find that. As is, your PR would fail on a clean vanilla environment (notably one that did not have mapproj installed).

Aside from that, it's great that you put the missing NAMESPACE imports fields in from ggplot2 - an oversight on my part that they weren't there. I nevertheless prefer to double up and use explicit namespaces as well, so could you please reinstate all of these in the actual code (so ggplot2::aes instead of aes, for example). You do that; i'll find out how to get mapproj dependency in without directly calling it, and we'll be good.

ThierryO commented 6 years ago

I think I can solve the mapproj dependency problem. I'll update the PR.

mpadge commented 6 years ago

it turns out there isn't really a neat solution, but what we could do is to simply directly use mapproj::maproject in a dummy function. Just put this somewhere in the code as a single line:

junk <- mapproj::mapproject(1:10,1:10)

It doesn't need to be wrapped in a function or anything. Just an interpretative comment to explain why it's there, then we can @importFrom mapproj mapproject and all should be good.

codecov-io commented 6 years ago

Codecov Report

Merging #28 into master will increase coverage by 1.76%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   85.56%   87.33%   +1.76%     
==========================================
  Files          21       21              
  Lines        2418     2369      -49     
==========================================
  Hits         2069     2069              
+ Misses        349      300      -49
Impacted Files Coverage Δ
R/add-osm-objects.R 77.59% <ø> (ø) :arrow_up:
R/add-colourbar.R 98.82% <ø> (ø) :arrow_up:
R/add-osm-groups.R 96.05% <ø> (ø) :arrow_up:
R/add-osm-surface.R 96.03% <ø> (ø) :arrow_up:
R/add-axes.R 100% <ø> (ø) :arrow_up:
R/osm-basemap.R 96.77% <100%> (ø) :arrow_up:
R/line2poly.R 0% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 00d4ebb...dc75778. Read the comment docs.