[R] Number formatting of labels in directlabels with stat_contour (ggplot2)
Dominic Roye
dominic.roye at gmail.com
Sun Apr 26 14:44:53 CEST 2015
How can I customize the number formatting of labels in directlabels?
It should be integer as in the original dataset.
p <- ggplot(temp,aes(lon,lat,z=Pres,colour=..level..))+
stat_contour(bins=30,size=0.5,colour="black")+theme_bw()
direct.label(p,list("top.pieces",cex=0.7,colour="red"))
Dataset:
dput(temp)
structure(list(lon = c(-30, -27.5, -25, -22.5, -20, -17.5, -15,
-12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30, -27.5, -25,
-22.5, -20, -17.5, -15, -12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5,
7.5, 10, -30, -27.5, -25, -22.5, -20, -17.5, -15, -12.5, -10,
-7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30, -27.5, -25, -22.5, -20,
-17.5, -15, -12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30,
-27.5, -25, -22.5, -20, -17.5, -15, -12.5, -10, -7.5, -5, -2.5,
0, 2.5, 5, 7.5, 10, -30, -27.5, -25, -22.5, -20, -17.5, -15,
-12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30, -27.5, -25,
-22.5, -20, -17.5, -15, -12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5,
7.5, 10, -30, -27.5, -25, -22.5, -20, -17.5, -15, -12.5, -10,
-7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30, -27.5, -25, -22.5, -20,
-17.5, -15, -12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30,
-27.5, -25, -22.5, -20, -17.5, -15, -12.5, -10, -7.5, -5, -2.5,
0, 2.5, 5, 7.5, 10, -30, -27.5, -25, -22.5, -20, -17.5, -15,
-12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10, -30, -27.5, -25,
-22.5, -20, -17.5, -15, -12.5, -10, -7.5, -5, -2.5, 0, 2.5, 5,
7.5, 10, -30, -27.5, -25, -22.5, -20, -17.5, -15, -12.5, -10,
-7.5, -5, -2.5, 0, 2.5, 5, 7.5, 10), lat = c(60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 57.5, 57.5,
57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5,
57.5, 57.5, 57.5, 57.5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
55, 55, 55, 55, 55, 55, 55, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5,
52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5,
50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
50, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5,
47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 42.5, 42.5, 42.5,
42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5,
42.5, 42.5, 42.5, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5,
37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5,
32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30), Pres = c(990, 992, 993,
995, 996, 997, 998, 1000, 1001, 1002, 1003, 1004, 1005, 1007,
1008, 1010, 1011, 998, 999, 1000, 1001, 1002, 1004, 1005, 1007,
1008, 1009, 1009, 1010, 1011, 1011, 1012, 1012, 1013, 1005, 1006,
1007, 1009, 1010, 1011, 1012, 1014, 1015, 1016, 1016, 1017, 1016,
1016, 1016, 1016, 1016, 1011, 1012, 1013, 1014, 1016, 1017, 1018,
1020, 1021, 1022, 1022, 1022, 1022, 1021, 1021, 1021, 1020, 1015,
1016, 1017, 1019, 1021, 1022, 1024, 1025, 1026, 1026, 1026, 1026,
1025, 1025, 1025, 1024, 1024, 1019, 1020, 1022, 1023, 1025, 1027,
1027, 1028, 1029, 1029, 1029, 1028, 1028, 1027, 1026, 1026, 1026,
1022, 1023, 1025, 1027, 1028, 1029, 1030, 1030, 1030, 1030, 1030,
1029, 1029, 1027, 1025, 1023, 1022, 1025, 1026, 1028, 1029, 1030,
1031, 1031, 1031, 1030, 1029, 1030, 1029, 1028, 1025, 1022, 1019,
1019, 1026, 1027, 1028, 1029, 1030, 1030, 1030, 1029, 1028, 1028,
1029, 1028, 1025, 1024, 1022, 1020, 1019, 1026, 1028, 1028, 1029,
1029, 1029, 1029, 1028, 1027, 1025, 1025, 1025, 1025, 1024, 1023,
1022, 1019, 1026, 1027, 1027, 1027, 1027, 1027, 1027, 1026, 1025,
1024, 1024, 1025, 1025, 1025, 1024, 1022, 1021, 1025, 1025, 1025,
1026, 1026, 1025, 1025, 1025, 1023, 1023, 1024, 1024, 1024, 1024,
1023, 1022, 1021, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1023,
1022, 1023, 1023, 1023, 1023, 1023, 1023, 1022, 1022)), .Names =
c("lon",
"lat", "Pres"), row.names = c(NA, -221L), class = "data.frame")
[[alternative HTML version deleted]]
More information about the R-help
mailing list