开始使用免费开始使用

使用分面可视化词频

上一练习中的 word_counts 已加载。现在请将 Twitter 数据的词频可视化,并为投诉与非投诉分别使用分面。

本练习是课程的一部分

R 文本分析入门

查看课程

练习说明

  • 添加与是否为投诉相关联的颜色美学映射。
  • 列形图不显示图例。
  • 按推文是否来自投诉进行分面,并将 y 轴设为可变(free)。
  • 翻转坐标并添加标题:"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"
  ___() +
  ___(___)
编辑并运行代码