使用percent_format()

时间:2018-04-25 18:05:18

标签: r

`frequency <- gather(frequency, country, proportion, `North Korea`:`South Korea`)                                                         
ggplot(frequency, aes(x = `South Korea`, y = `North Korea`, color = difference)) +
geom_abline(color = "gray40", lty = 2) +
geom_jitter(alpha = 0.1, size = 2.5, width = 0.3, height = 0.3) +
geom_text(aes(label = word), check_overlap = TRUE, vjust = 1.5) +
scale_x_log10(labels = percent_format()) +
scale_y_log10(labels = percent_format()) +
scale_color_gradient(limits = c(0, 0.001), low = "darkslategray4", high = "gray75") +
#facet_wrap(~country, ncol = 2) +
theme(legend.position="none") +
labs(y = "North Korea proportion", x = "South Korea proportion")`

我正在尝试输出比较韩国和朝鲜之间的词频的散点图。但是,我一直收到错误:percent_format()中的错误:找不到函数“percent_format”。 当我不使用percent_format函数时,散点图会正确显示,但它不会像我希望的那样显示常用的单词及其比例。我使用的代码取自tidytextmining.com的第1章第5节。我正在使用ggplot包来显示散点图。谢谢!

0 个答案:

没有答案