Consider scaling y-axis for unprojected map plots
See original GitHub issueFollowing the R&Py workshop https://github.com/rsbivand/ectqg19-workshop, we (me and @darribas) saw that in R, sf scales the y-axis for plotting as a function of the distance between the equator and the middle of the y range of the map https://github.com/r-spatial/sf/blob/8150edb7fbc1e7096526303a6d2876a7b5455260/R/plot.R#L529
#’ The default aspect for map plots is 1; if however data are not #’ projected (coordinates are long/lat), the aspect is by default set to #’ 1/cos(My * pi/180) with My the y coordinate of the middle of the map #’ (the mean of \code{ylim}, which defaults to the y range of bounding box). This #’ implies an \href{https://en.wikipedia.org/wiki/Equirectangular_projection}{Equirectangular projection}.
Unless I’m missing something, https://github.com/geopandas/geopandas/blob/29add0a735b00dc20c79e0fccc8e6a775c4997b0/geopandas/plotting.py#L414 sets 'equal'
in all cases. I haven’t found which function you use (through pyproj?) to determin whether the map object is known to be in geographical rather than projected coordinates. Also I don’t know whether a real valued aspect can be passed.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
Hi @rsbivand,
sorry for slow response. This is quite interesting! You are right that Geopandas currently set aspect to equal in all cases. In 0.6.1 we do not have an option to determine whether gdf is in geographical or projected coordinates. This will change in 0.7 with newly adopted pyproj.CRS (#1101). I think that once we have this change merged, we should definitely consider using the formula above.
I don’t think we support passing aspect either, but that could be done in the same PR.
Thanks!
Feel free to ignore my other post - after reading what @jorisvandenbossche wrote and re-reading the thread I understand better what is proposed. No issues from my end. 👍