Last week I have experimented with coloring map of Poland in national colors. Vaidotas Zemlys improved on my effort by adding colors to map of Lithuania and posted a challenge to also add coat of arms to the plot. This proved to be a nice exercise of using pixmap and grImport packages.
I wanted to compare adding coat of arms of Poland as bitmap and as vector graphics to the plot. First task was to get the picture. It can be found as SVG file. Code for plotting of the map was given in my last post so I show here only the code that needs to be added to plot coat of arms.
To add bitmaps to R plots one can use pixmap package. First one needs to convert SVG to PPM format which can be done using GIMP. Then I added the following code:
The key problem was to get proper scaling of the picture. Here is the result:
For vector graphics package grImport is an option. This time SVG has to be converted to PS. I used Inscape to do it. The PS file can be added to the map using the following code:
grid.picture(herb, x=0.5, y=0.635, width = 0.25, height = 0.25)
Here an important thing to notice is the way picture is non-standard way of picture positioning on the plot. The result is:
In this case picture obtained using bitmap looks a bit better than the one obtained using vector graphics. This was a surprise.