0
我想繪製一張適當的餅圖。但是,此網站上的大多數以前的問題都是從stat = identity
中抽取的。如何繪製一個正常的餅圖,如圖2所示,角度與cut
的比例成正比?我正在使用ggplot2的diamonds
數據幀。在ggplot2中繪製餅圖
ggplot(data = diamonds, mapping = aes(x = cut, fill = cut)) +
geom_bar(width = 1) + coord_polar(theta = "x")
ggplot(data = diamonds, mapping = aes(x = cut, y=..prop.., fill = cut)) +
geom_bar(width = 1) + coord_polar(theta = "x")
ggplot(data = diamonds, mapping = aes(x = cut, fill = cut)) +
geom_bar()
這看起來像很多工作... – JetLag