我来凑个热闹。[s:11]
link = "http://img.dafont.com/dl/?f=wm_people_1";<br />
download.file(link, "wmpeople1.zip", mode = "wb");<br />
unzip("wmpeople1.zip");</p>
<p>library(showtext);<br />
font.add("wmpeople1", "wmpeople1.ttf");</p>
<p>library(ggplot2);<br />
library(plyr);<br />
library(Cairo);</p>
<p>dat = read.csv(textConnection('<br />
edu,educode,gender,population<br />
未上过学,1,男,17464<br />
未上过学,1,女,41268<br />
小 学,2,男,139378<br />
小 学,2,女,154854<br />
初 中,3,男,236369<br />
初 中,3,女,205537<br />
高 中,4,男,94528<br />
高 中,4,女,70521<br />
大专及以上,5,男,57013<br />
大专及以上,5,女,50334<br />
'));</p>
<p>dat$int = round(dat$population / 10000);<br />
gdat = ddply(dat, "educode", function(d) {<br />
male = d$int[d$gender == "男"];<br />
female = d$int[d$gender == "女"];<br />
data.frame(gender = c(rep("男", male), rep("女", female)),<br />
x = 1:(male + female));<br />
});<br />
gdat$char = ifelse(gdat$gender == "男", "p", "u");</p>
<p>CairoPNG("edu.png", 600, 300, pointsize = 15);<br />
showtext.begin();<br />
ggplot(gdat, aes(x = x, y = educode)) +<br />
geom_text(aes(label = char, colour = gender),<br />
family = "wmpeople1", size = 7) +<br />
scale_x_continuous("人数(千万)") +<br />
scale_y_discrete("受教育程度",<br />
labels = unique(dat$edu[order(dat$educode)])) +<br />
scale_colour_manual("性别", values = c("#00BFC4", "#F8766D")) +<br />
ggtitle("2012年统计数据");<br />
showtext.end();<br />
dev.off();
</p>