- library(RColorBrewer)
- BFDeaths <- read.table(file="BirdfluDeaths.txt", header = TRUE)
- names(BFDeaths)
- str(BFDeaths)
- Deaths <- colSums(BFDeaths[,2:16])
- Deaths <- Deaths[order(Deaths)]
- pielegend <- sprintf("%s = %4.2f%s", names(Deaths),
- 100 * Deaths /sum(Deaths), "%")
- png("EX07_01_c.png")
- pie(Deaths, labels = NA,
- col = brewer.pal(7,"Set1"),
- radius = 1.0,
- clockwise = TRUE, main = "Deaths per Country")
- legend("left",legend=pielegend,bty="n",
- fill = brewer.pal(7,"Set1"))
- dev.off()
生成如下的图形:
请问如何把图例和图形分开,这样看起来更好些.
数据见附件.
BirdFluDeaths.txt
(354 Bytes)


雷达卡




京公网安备 11010802022788号







