我需要在ggplot上方的标签上方放置标签.我曾经使用找到的方法(这里),但这似乎不再工作,因为我的ggplot2更新,因为我现在收到错误消息:
Error in continuous_scale(c("y", "ymin", "ymax", "yend", "yintercept", :
unused argument(s) (formatter = "percent")
Run Code Online (Sandbox Code Playgroud)
使用示例时,如何再次在条形图上方绘制数值:
df <- structure(list(A = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L,
3L), .Label = c("0-50,000", "50,001-250,000", "250,001-Over"), class = "factor"),
B = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("0-50,000",
"50,001-250,000", "250,001-Over"), class = "factor"), Freq = c(0.507713884992987,
0.258064516129032, 0.23422159887798, 0.168539325842697, 0.525280898876405,
0.306179775280899, 0.160958904109589, 0.243150684931507,
0.595890410958904)), .Names = c("A", "B", "Freq"), class = "data.frame", row.names = c(NA,
-9L)) …Run Code Online (Sandbox Code Playgroud) 我尝试绘制的数据结构如下:
Year Country Count
1: 2010 St. Vincent and the Grenadines 0
2: 1970 Ukraine 0
3: 1980 Yemen 1
4: 1970 Romania 0
5: 1950 Cyprus 0
6: 1950 Netherlands 0
7: 1980 Mauritania 0
8: 1980 Niger 0
9: 2010 Grenada 2
10: 1970 Israel 6
11: 1990 Suriname 0
12: 1990 Singapore 1
13: 1960 Russia 0
14: 1970 Barbados 0
15: 1950 Panama 0
16: 2010 Mali 3
17: 1980 Greece 11
18: 2010 Venezuela 15 …Run Code Online (Sandbox Code Playgroud)