Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.1 KB

06_Simple_Features_SF.md

File metadata and controls

46 lines (32 loc) · 1.1 KB

A Basic Rendering


ggplot(data = world) +
    geom_sf()

Adding Titles and Subtitles

A title and a subtitle can be added to the map using the function ggtitle, passing any valid character string (e.g. with quotation marks) as arguments. Axis names are absent by default on a map, but can be changed to something more suitable (e.g. “Longitude” and “Latitude”), depending on the map.


ggplot(data = world) +
    geom_sf() +
    xlab("Longitude") + ylab("Latitude") +
    ggtitle("World map", subtitle = "with labels")

Using Colour


ggplot(data = world) + 
    geom_sf(color = "black", fill = "lightgreen")

chloropleths


ggplot(data = world) +
    geom_sf(aes(fill = pop_est)) 

A more elaborate version can be made with additional code (outside the scope of the workshop)


ggplot(data = world) +
    geom_sf(aes(fill = pop_est)) +
    scale_fill_viridis_c(option = "plasma", trans = "sqrt")

References