Geom_polygon does not fill with correct data

126 views Asked by At

I am trying to plot a zipcode map of the Netherlands and fill it, but my 'fill' is the same for every variable I try to fill it with, which is not correct. My code looks like this:

ggplot(data = df1, aes(x = long, y = lat)) +
  geom_polygon(aes(fill="variable1", group="zipcode"))

My dataframe is a SpatialPolygonsDataframe and the variables I tried to fill are either numerical or factors.

The code above gives me the following map, which looks the same, no matter which variable I place after fill

enter image description here

0

There are 0 answers