I am using this R code:
library(rworldmap)
Data <- read.table("D:/Bla/Maps/Test.txt", header = TRUE, sep = "\t")
sPDF <- joinCountryData2Map(Data, joinCode = "ISO3",nameJoinColumn = "ISO3CountryCode")
mapCountryData(sPDF, nameColumnToPlot = "Data")
This produces a map but I get:
You asked for 7 quantiles, only 1 could be created in quantiles classification
I googled and it pointed me to this code
Not sure whether it is relevant.
This is the data I have used:
ISO3CountryCode Data
JPN 7
AUS 6
IND 6
CHN 5
GBR 5
CHE 4
IRN 4
DEU 3
EGY 3
ESP 3
LBY 3
TUN 3
USA 3
ARG 2
AUT开发者_Go百科 2
BRA 2
EST 2
GRC 2
ITA 2
TUR 2
URY 2
CHL 1
ETH 1
FRA 1
JOR 1
KEN 1
KOR 1
LTU 1
MEX 1
NLD 1
NZL 1
PER 1
POL 1
SAU 1
SRB 1
SVK 1
SVN 1
TZA 1
ZAF 1
It looks like by default mapCountryData()
tries to fit data to quantiles for binning. You'll need to help it along a little by tweaking the catMethod
parameter.
I'm not sure what your values 1 through 7 mean. If they are categories (and you want them all explicitly displayed in the legend), try:
mapCountryData(sPDF, nameColumnToPlot = "Data", catMethod="categorical")
If you want to treat all values equally on a continuous scale, try:
mapCountryData(sPDF, nameColumnToPlot = "Data", catMethod="fixedWidth")
If neither of these does do what you want, you might try altering numCats
and/or catMethod
see ?mapCountryData
for the possible values and their meaning.
精彩评论