I am plotting a map with different study sites of malaria parasite drug resistance. The points of the study sites are sized relative to how many malaria parasites were sampled and the fill of the points is a gradient from 0 to 1 of the proportion of malaria parasites that were drug resistant. The following code reveals the map below:
###GENERATING AFRICA MAP###
africa = readOGR("/Users/transfer/Documents/Mapping Files/Africa Countries/Africa_SHP", layer="dissolved")
#FIXING THE NON-NODED INTERSECTS#
africa = gBuffer(africa, width=0, byid=TRUE)
#CREATING DATA FRAME FOR GGPLOT#
africa.map = fortify(africa, region="ID")
###PLOTTING SPM.437###
#SCALING THE SAMPLE SIZE USING CUBE-ROOT#
size = d.spm.437$Tot437^(1/3)
#PLOTTING#
ggplot(africa.map, aes(x = long, y = lat, group = group)) +
geom_polygon(colour="black", size=0.25, fill="white", aes(group=group)) +
geom_point(data = d.spm.437, aes(x = long, y = lat, fill=Frc437, group=NULL, size=Tot437),
size=size, shape=21, colour="black", size=0.5)

I tried using a color option but it did not work:
ggplot(africa.map, aes(x = long, y = lat, group = group)) +
geom_polygon(colour="black", size=0.25, fill="white", aes(group=group)) +
geom_point(data = d.spm.437, aes(x = long, y = lat, colour="red", fill=Frc437, group=NULL, size=Tot437),
size=size, shape=21, colour="black", size=0.5)
Anybody know how to get the color of the fill to show a scale of red, lighter being 0 and darker being 1?
As I mentioned in my comment, I think you’re a little confused about setting vs mapping aesthetics.
You map aesthetics to a variable in your data frame inside of
aes(). So,aes(color = var)maps the color aesthetic to the variable var, and you get a legend to show how color varies with var. If you set color, outside ofaes(), to a single value, then you are simply setting all points to be a single color:color = "red".The reason I suspect you’re confused is that you have
size=Tot437inside ofaes(), and then bothsize=sizeandsize=0.5outside ofaes().Finally, to change the color palette, you need to be aware of the
scale_color_*functions (as well asscale_fill_*, scale_size_*etc). Here’s a simple example to get you started:How did I come up with that crazy looking color specification? Just from the first few lines of
scale_fill_continuousand then poking around in the munsell package a bit.Edit: I completely missed that you were actually using
pch = 21which is basically the only point shape for while thefillaesthetic makes sense, so I’ve edited to remove my comments on that score.