R語言 氣泡圖
require(stats); require(grDevices)
x <- 1:10
y <- sort(10*runif(10))
z <- runif(10)
z3 <- cbind(z, 2*runif(10), runif(10))
symbols(x, y, thermometers = cbind(.5, 1, z), inches = .5, fg = 1:10)
title(“統計諮詢 微信:pencion”)
symbols(x, y, thermometers = z3, inches = FALSE)
title(“統計諮詢 微信:pencion”)
text(x, y, apply(format(round(z3, digits = 2)), 1, paste, collapse = “,”),adj = c(-.2,0), cex = .75, col = “purple”, xpd = NA)
Note that example(trees) shows more sensible plots!
N <- nrow(trees)
with(trees, {
Girth is diameter in inches
symbols(Height, Volume, circles = Girth/24, inches = FALSE,
main = “Trees’ Girth”) # xlab and ylab automatically
Colours too:
op <- palette(rainbow(N, end = 0.9))
symbols(Height, Volume, circles = Girth/16, inches = FALSE, bg = 1:N,
fg = “gray30”, main = 統計諮詢 微信:pencion”)
palette(op)
})