The 'grImport' package can help with getting the SVG into R (see
http://www.jstatsoft.org/v30/i04).
First step is to convert the SVG to PostScript (I used InkScape - you can
play around with how the text comes across, but I'm going to ignore that and
concentrate on the map regions).
Having done that, the following code loads the map into R and draws it ...
library(grImport)
PostScriptTrace("Austria-Map-withFonts.ps", charpath=FALSE)
map <- readPicture("Austria-Map-withFonts.ps.xml")
grid.picture(map)
... (the orientation may be 90 degrees out and you may get some warnings
about character encodings; ?the former is easy to fix [see below] and the
latter can just be ignored for now because we are ignoring the text). ?The
next code shows the breakdown of the map into separate "paths" ...
grid.newpage()
picturePaths(map)
... from which we can see that the regions are the first 10 paths ...
grid.newpage()
grid.picture(map[1:10], use.gc=FALSE)
At this point, you can use grImport to draw the regions with different fill
colours, or you can just extract the x,y coordinates of the regions and
go-it-alone. ?The following code takes the latter path, setting up 10
different colours, and drawing each region using grid.polygon(). ?The
orientation is fixed by pushing a rotated viewport first ...
colours <- hcl(240, 60, seq(30, 80, length=10))
grid.newpage()
pushViewport(viewport(angle=-90),
? ? ? ? ? ? grImport:::pictureVP(map[1:10]))
mapply(function(p, col) {
? ? ? ? ? grid.polygon(p$x, p$y, default.units="native",
? ? ? ? ? ? ? ? ? ? ? ?gp=gpar(fill=col))
? ? ? },
? ? ? regions, colours)
Hope that helps.
Paul
Thanks for your help,
Thomas