如何在R中制作简单的名称与值图?

时间:2015-07-25 08:09:18

标签: r charts

我有下面的数据(在data.table中),我想要的是在x轴上绘制前二十rn个,在y轴上绘制相应的{{1} }。

看起来如下图所示,除了我想以某种方式指出哪个数据点是来自p的单词。也可以是另一种图表类型。

enter image description here

它可能会变成这样:

enter image description here

rn

1 个答案:

答案 0 :(得分:2)

union可以在几行中制作出这样的图表:

ggplot2

enter image description here

如果其他人想在这里播放数据我是如何复制的:

ggplot(tdmunidt, aes(x = reorder(rn, -p), y = p)) + 
    geom_bar(stat="identity") + xlab("") +
    theme(axis.text.x = element_text(angle = 45, hjust = 1))