举个例子,这个例子是《R语言实战》里的一个(这本书论坛也有,链接是:https://bbs.pinggu.org/a-1550341.html),
用的是mtcars的数据,就是这样的——
attach(mtcars)
r <- sqrt(disp/pi)
symbols(wt, mpg, r, inches=0.30, fg="white", bg="lightblue",
main="Bubble Plot with point size proportional to displacement",
ylab="Miles Per Gallon",
xlab="Weight of Car (lbs/1000)")
text(wt, mpg, rownames(mtcars), cex=0.6)
detach(mtcars)
par(opar)