coord_sf - creating equal co-ordinates

Hi
I have the following at the start of a ggplot -

map_A <- ggplot() +
  geom_sf(data=roads_A, alpha=0.2, color=roads_A$FEATCODE) +
  coord_sf(datum=st_crs(27700))  ...............

I am looking to create square grids but cannot find an equivalent of coord_fixed(ratio=1) for coord_sf. Is there a way to achieve it, please?

now fallen back on workaround by cropping equally around a point

roads_cropped<- st_crop(roads_A, 
                              xmin = mypoint-500, 
                              xmax= mypoint+500, 
                              ymin = mypoint-500, 
                              ymax= mypoint+500)
                              
geom_sf(data=roads_cropped,......)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

You can do something like. I don't think there's a way to set the aspect ratio manually.

+ coord_sf(xlim=range(st_coordinates(df)[,1]), ylim=range(st_coordinates(df)[,2]))

https://ggplot2.tidyverse.org/reference/ggsf.html
https://github.com/tidyverse/ggplot2/issues/2651