Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

ggplot specify longitude/latitude axis breaks

$
0
0

I am using the following code to create a map of one 'trial_area' from a shapefile and overlaying a coastline and 'prod_areas' from a second shapefile. I'm then using the coord_sf to zoom the map to the st_bbox of the trial_area polygon. However for some areas (see the example below) the axis tick text labels end up overlapping, is there a way that i can specify the axis tick mark intervals to avoid this (e.g. .1 for latitude and .5 for longitude)?

poly <- trial_areas %>% 
filter(Id==5) 
ext <- st_bbox(poly)

plot_SoundOfSleat <- ggplot() +
theme(panel.background = element_rect(fill = 'light blue'),element_line()) +
geom_sf(data=poly)+
geom_sf(data=prod_areas,fill=mycol) +
geom_sf(data = Scot, aes(),
        fill = "lightgreen",col="darkgreen") +
coord_sf(xlim = c(ext[1], ext[3]), ylim = c(ext[2], ext[4]))  +
ggtitle("Sound of Sleat Trial Area 5") +
geom_sf_text(aes(label = Producti_1), data=prod_areas,size=3,hjust=0, vjust=0) +
labs(x = "Longitude", y= "Latitude")

plot_SoundOfSleat

enter image description here


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>