I am plotting some data on a shapefile using R and
choropleth in package
I would like to modify my code below in order to assign custom breaks.
Using the World Borders Dataset, download from:
library(GISTools) library(rgdal) shape_file <- readOGR(dsn ="/home/hamid/TM_WORLD_BORDERS_SIMPL-0.3", layer = "TM_WORLD_BORDERS_SIMPL-0.3") shades <- auto.shading(shape_file@data$POP2005, cutter = quantileCuts, n=5, cols = brewer.pal(5, "Blues")) choropleth(shape_file, shape_file@data$POP2005, shading = shades) choro.legend(70.00000, 32.50000, shades)
Can anyone help please?
No errors in the code I have posted. What I would like to do is to use custom cuts instead of quantile cuts. I have trie the following:
cuts= c(0.1, 0.2, 0.3, 0.4, 0.6) shades <- shading(shape_file@data$POP2005, breaks = cuts) choropleth(shape_file, shape_file@data$POP2005, shading = shades)
which give the following error:
Error in findInterval(v, shading$breaks) : vec' must be sorted non-decreasingly`
Note that the values for the breaks are specific to my case which is not using the same data on the example.