Format the ggplot2 map

て烟熏妆下的殇ゞ 提交于 2019-12-04 07:35:09

In regard to changing the colorscale, ggplot2 has a uniform way of handling scales. The function you are looking for always has the format scale_{which_scale}_{scale_type}, where which_scale is an aesthetic (what you use in aes(), for example fill or size), and scale_type can be continuous or discrete, etc. What you are looking for if you want to tweak the fill scale is scale_fill_continuous, scale_fill_gradient, or scale_fill_gradient2. Have a look at the documentation of those functions.

A code example:

m2 <- m1 + geom_polygon(aes(x=long, y=lat, group=group, fill=rendapc))
m2 + scale_fill_gradient(low = "blue", high = "red")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!