用分面視覺化字詞計數
上一題產生的 word_counts 已載入。現在讓我們把 Twitter 資料的字詞計數視覺化,並以是否為抱怨分成不同分面。
本練習屬於課程
R 文字分析入門
練習說明
- 加入與是否為抱怨相關聯的顏色對應屬性。
- 直方圖(長條圖)不要顯示圖例。
- 依推文是否屬於抱怨進行分面,並將 y 軸設為可自由縮放。
- 翻轉座標並加入標題:「Twitter Word Counts」。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Include a color aesthetic tied to whether or not its a complaint
ggplot(word_counts, aes(x = word2, y = n, ___)) +
# Don't include the lengend for the column plot
geom_col(___) +
# Facet by whether or not its a complaint and make the y-axis free
___(___, scales = ___) +
# Flip the coordinates and add a title: "Twitter Word Counts"
___() +
___(___)