i have piece of code:
ggplot(legend = false) + geom_polygon(data = map.df, size = 0.1, aes(long, lat, group = group, colour = "grey80", fill = ind_vul)) + scale_fill_gradient2(low = "blue", high = "red", midpoint = mean(map.df$ind_vul, na.rm = true)) + geom_point(data = puntos.df, aes(as.numeric(long), as.numeric(lat), colour = geografico), size = 2) + facet_wrap(~municipio, scales = "free") + tema.mapas and found several problems (obviously related ignorance of topic), problems following (all related, see ggplot throwing error in weird circumstances):
the size parameter in
geom_polygonworking oddly, outside ofaeshas no effect , inside of ignored, if there nocolourparameter.the
colourparameter ignored (again ingeom_polygon) in code above saidscolour="grey80"contour line of polygon in colour , "grey80" appears legend of points!
since colour='grey80' , size=0.1 not asking column of map.df should outside of aes call. in other words, when colour inside aes, ggplot thinks you're telling base color of plot on column in data, or if given literal string have here, create mapping between string , entry in usual color palette. mapping aesthetic literal string can useful technique in cases, different setting aesthetic value. outside of aes, color color named "grey80" , use specific color.
[adapted comments , expanded slightly]
Comments
Post a Comment