Does anyone have any ideas why this map glitches and how to fix it? I plotted it without my sample size variable and it worked fine. However, as soon as I added the fill all these lines appeared.
And
That's all the code I used:
map <- geojson_read("https://martinjc.github.io/UK-GeoJSON/json/sco/topo_lad.json", what = "sp")
map_fortified <- tidy(spdf, reigion="code")
ggplot() +
geom_polygon(data = map_fortified, aes( x = long, y = lat, group = group), fill="white", color="grey") +
theme_void() +
coord_map()
data2<-read.csv("location.csv", header = TRUE)
head(data2)
data2$id<-as.factor(data2$id)
map_fortified$id<-as.factor(map_fortified$id)
total <- merge(data2,spdf_fortified,by="id")
ggplot() +
geom_polygon(data = total, aes(fill = sample, x = long, y = lat, group = group)) +
theme_void() +
coord_map()