usernancy
usernancy

Reputation: 33

continent outlines in R

is there a way to plot only the continental outlines of rworldmap in R (no countries, no data)?

There are two other questions close to this one, but they are to fill the continents with colors, and the commands are to plot data. How can I plot a continents map with R?

I only want to overlay the continental outlines without country lines and without requiring other data.

Upvotes: 3

Views: 2195

Answers (2)

Andy
Andy

Reputation: 1861

You could use the coastsCoarse data from rworldmap.

library(rworldmap)
data(coastsCoarse)
plot(coastsCoarse)

An example of overlaying on a gridded map.

mapGriddedData()
plot(coastsCoarse,add=TRUE,col='blue')

Upvotes: 2

lawyeR
lawyeR

Reputation: 7684

You can do the following, and modify many of the aspects of the plot (title, axis text, borders, grids, etc.)

library(ggplot2)
countries <- map_data("world")
ggplot(countries, aes(x=long, y=lat, group = group)) +
  geom_polygon(col=NA, lwd=3, fill = "white")

enter image description here

It may be possible to remove the country lines and yet keep the continent outlines if you use geom_path, but I tried several combinations of arguments and did not succeed:

ggplot(countries, aes(x=long, y=lat, group = group)) +
  geom_path(col="red", lwd=0, fill = "red")

Upvotes: 3

Related Questions