1
A
回答
4
這種類型的可視化被稱爲樹形圖。適當地,您可以使用treemap
包。你可以找到treemap
here的詳細教程,但我會告訴你的基本知識。下面我向你展示如何在ggplot2
中創建一個樹形圖。
樹形包
library(treemap)
cars <- mtcars
cars$carname <- rownames(cars)
treemap(
cars,
index = "carname",
vSize = "disp",
vColor = "cyl",
type = "value",
format.legend = list(scientific = FALSE, big.mark = " ")
)
GGPLOT2
還有GitHub上使用ggplot2
創建樹狀發育包。 Here's the repo用於安裝包裝。
library(tidyverse)
library("ggfittext")
library("treemapify")
cars <- mtcars
cars$carname <- rownames(cars)
cars <- mutate(cars, cyl = factor(cyl))
ggplot(cars, aes(area = disp, fill = cyl, label = carname)) +
geom_treemap() +
geom_treemap_text(
fontface = "italic",
colour = "white",
place = "centre",
grow = TRUE
)
+0
非常好的安德魯! – ryguy72
+0
謝謝@ ryguy72! –
相關問題
- 1. 廣場圖片比舞臺
- 2. 知道ggplot2圖的比例
- 3. 廣場
- 4. ggplot2 - 條形圖總和的比例
- 5. 倒車默認比例梯度GGPLOT2
- 6. 廣場要點
- 7. 廣場值
- 8. 廣場在C
- 9. 廣場圖庫
- 10. 修改ggplot2氣泡圖的圖例比例尺
- 11. 廣場上的JFreeChart
- 12. 廣場對象,SpriteKit
- 13. primefaces重裝廣場
- 14. 生成encryption_key廣場
- 15. Jquery廣場和Drupal
- 16. 導出縱向視頻廣場,但與scaleAspectFit比率
- 17. 正則表達式匹配後,廣泛的首場比賽
- 18. ggplot2合併圖例
- 19. 合併ggplot2圖例
- 20. GGPLOT2分組圖例
- 21. WebGL的一個廣場
- 22. 廣場功能的指令
- 23. VideoView作物到廣場
- 24. 廣場的Web API破
- 25. 廣場爲環形圖案
- 26. 鑽石廣場算法
- 27. CSS - 完美廣場網格
- 28. 廣場形象限制?
- 29. 廣場和總結列表
- 30. javascript scratchblocks廣場空間
學習如何使用樹地圖包也可能有助於你的情節轉換成GGPLOT2,爲便於與格式化之後。請參閱:https://stackoverflow.com/questions/42866566/converting-treemap-to-ggplot – jesstme