Graphics Programs Reference
In-Depth Information
provided by GeoCommons. You want to size bubbles in proportion to
these rates.
The code is almost the same as when you mapped Costco locations, but
remember you just passed a vector of ones for circle size in the symbols()
function. Instead, we use the sqrt() of the rates to indicate size.
fertility <-
read.csv(“http://book.flowingdata.com/ch08/points/adol-fertility.csv”)
map('world', fill = FALSE, col = “#cccccc”)
symbols(fertility$longitude, fertility$latitude,
circles=sqrt(fertility$ad_fert_rate), add=TRUE,
inches=0.15, bg=”#93ceef”, fg=”#ffffff”)
FIGurE 8-9 Adolescent fertility rate worldwide
Figure 8-9 shows the output. Immediately, you should see that African
countries tend to have the highest adolescent fertility rates, whereas
european countries have relatively lower rates. From the graphic alone,
it's not clear what value each circle represents because there is no leg-
end. A quick look with summary() in R can tell you more.
summary(fertility$ad_fert_rate)
Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
3.20 16.20 39.00 52.89 78.20 201.40 1.00
Search WWH ::




Custom Search