更多 ggnetwork 繪圖選項
就像上一課所做的,ggnetwork 也提供能快速產生漂亮圖形的方法。請記得每個套件都有自己的風格,可能合你胃口,也可能不合。回想一下,ggnetwork 的做法是把圖形轉成 dataframe,讓 ggplot2 來繪圖。因此,你熟悉的各種參數設定都能使用。這帶來很大的彈性,但也可能需要多花一些功夫,才能達到你想要的視覺效果。我們會重做前一課的練習,不過這次改用 ggnetwork。這能讓你有良好的對照依據,幫助你決定自己最喜歡哪一個套件。
你在上一個練習建立的中心性與社群歸屬屬性仍然存在。
本練習屬於課程
案例研究:R 的網路分析
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
ggplot(
# Draw a ggnetwork of retweet_graph_smaller
ggnetwork(___, arrow.gap = 0.01),
aes(x = x, y = y, xend = xend, yend = yend)
) +
geom_edges(
arrow = arrow(length = unit(6, "pt"), type = "closed"),
curvature = 0.2, color = "black"
) +
# Add a node layer, mapping color to comm and setting the size to 4
___(aes(color = ___), size = ___) +
theme_blank()