title: Some countries not colored in map() and no gradient fill in r
body: <p>I am working on creating a map of Latin America (including Spain) which fills in each country according to a number which is the average of certain speech features. The number is on a continuum, so having a gradient color fill (ie higher numbers are darker) would be perfect. Anyway, here's the code I'm doing:</p>
  
  <pre><code>loc &lt;- levels(data$country)
  cases &lt;- levels(as.factor(data$mean))
  frics &lt;- data.frame(loc,cases)
  m &lt;- map('worldHires',plot=F, xlim=c(-120,-35),ylim=c(-60,30), fill=T)
  stm &lt;- match.map(m, frics$loc)
  
  frics$rank &lt;- rank(as.numeric(frics$cases), ties='min')
  pal &lt;- brewer.pal(max(frics$rank),'Reds')
  color &lt;- pal[frics$rank]
  frics.color &lt;- color[stm]
  
  map(m,col=frics.color,fill=T, lty=0,boundary=F,interior=F) # fill regions
  map('worldHires',interior=T,add=T,col='grey30')
  </code></pre>
  
  <p>Also, here are the corresponding vectors for frics$loc and frics$cases:</p>
  
  <pre><code>structure(list(loc = structure(c(7L, 1L, 10L, 8L, 9L, 12L, 14L, 
  4L, 3L, 13L, 11L, 2L, 5L, 6L), .Label = c("Argentina", "Bolivia", 
  "Chile", "Colombia", "Dominican Republic", "Ecuador", "El Salvador", 
  "Guatemala", "Honduras", "Mexico", "Nicaragua", "Paraguay", "Puerto Rico", 
  "Spain"), class = "factor"), cases = c(765, 1582, 928, 1055, 
  608, 1780, 1976, 802, 1795, 530, 644, 1160, 633, 930)), .Names = c("loc", 
  "cases"), row.names = c(NA, -14L), class = "data.frame")
  </code></pre>
  
  <p>So, when I plot the map, it turns out that some countries are not being filled. Most notably, Ecuador, but other Central American Countries as well. I suspect it may be because the color palette I am using does not support 14 different colors. Or maybe something else.</p>