0

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.

enter image description here

And

enter image description here

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()
jpsmith
  • 11,023
  • 5
  • 15
  • 36
  • 2
    Please edit your question to add data that makes this issue reproducible and only provide minimal code needed to reproduce the error – jpsmith Nov 16 '22 at 16:27
  • Guide for making [reproducible examples](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – nightstand Nov 16 '22 at 16:32

0 Answers0