Closed
Description
When a I draw a square with geom_tile
in a plot with coord_sf(crs = 4326)
, the result appears taller than it is wide. Maybe there's a problem with geom_tile
, or maybe coord_sf(crs = 4326)
isn't actually using plate carrée (in which one degree of longitude is the same length as one degree of latitude). I'm not sure which.
#3654 is possibly related.
library(ggplot2)
crs = 4326 # https://epsg.io/4326
borders = rnaturalearth::ne_states(iso_a2 = "US", returnclass = "sf")
borders = borders[tolower(borders$postal) == "ny",]
ggplot() +
geom_tile(aes(x, y, width = 5, height = 5),
data = data.frame(y = 40.7831, x = -73.9712)) +
geom_sf(data = borders, fill = NA) +
coord_sf(datum = NA, crs = crs) +
theme_void()
ggsave("/tmp/test.png", width = 1, height = 1)