Dear users,

I am trying to draw a map with one variable on it. The problem that I have
is that I would like that this variable has some intervals e.g. "Under
63.93", "From 63.93 to 90", "From 90 to 200", "From 200 to 400", "From 400
to 600" and "Over 600". I am quiet new in the use of this technology so any
help is very welcome.

My code is as following:

library(raster)
china <- getData('GADM', country='CHN', level=1)     #Read and load the map
of China


var2<-c(173.96,400.23,216.97,
269.62,318.07,282.07,142.33,127.70,
282.07,316.08,769.25,229.34,259.90,235.05,287.10,285.21,580.43,
571.96,387.71,285.41,0.00,238.41,223.10,236.39,1177.15,261.71,
216.97,826.23,358.34,0.00,161.67,257.54)
#The variable to include in the map

china@data=data.frame(var2)
# Attached the variable to the map

cuts = seq(from=min(var2), to=max(var2),
by=200)                                          # The cuts but I don't
want this, I want intervals

spplot(china, c("var2"), col.regions=brewer.pal(6, "Set3"),colorkey =
list(space="bottom",labels = list(at = cuts)),
at = cuts, scales=list(draw =
TRUE))
# The plot in the format that I need


I was looking for some examples in this issue, and I found this:

library(classInt)
pal <- brewer.pal(6, "Set3")
var3<- classIntervals(china$var2, n = 6, style = "fisher")
var3

q5Colours <- findColours(var3, pal)
plot(china, col = q5Colours, pch = 19)
legend("bottom", fill = attr(q5Colours, "palette"),
 legend = names(attr(q5Colours, "table")), bty = "n")

But this have two problems that I don't know how to solve. First, the
legend covers the map, and in this sense it is not useful for me. In my
case is necessary that the legend appear like the one in spplot above, that
is, below the map or in some place that I can see the full map. The second
problem is that it appears the intervals of the values, but should be nicer
if the intervals that appear in the map follow something similar to "Under
63.93", "From 63.93 to 90", "From 90 to 200", "From 200 to 400", "From 400
to 600" and "Over 600", instead of the two pair of values that cover the
interval. is it possible to do it in R?

Thanks in advanced

	[[alternative HTML version deleted]]

