[R] Importing vector graphics into R

Roger Bivand Roger.Bivand at nhh.no
Wed Dec 8 13:08:26 CET 2004


On Tue, 7 Dec 2004, Hinrich Göhlmann wrote:

> Dear R users,
> 
> I know of the possibility to import bitmaps via the nice pixmap library. 
>     But if you later on create a PDF it is somewhat disappointing to 
> have such graphics bitmapped. Is there a trick (via maps?) to import a 
> vector graphic and have them plotted onto a graph? My searching attempts 
> in the searchable r-help archive did not seem to result in anything 
> useful...

No, nothing obvious. If you have an Xfig file - or convert to one from PS,
you may be able to extract the lines with their attributes by hand (the
file is just text, so you can "see" the vector graphics), and write an R
function to plot them (rescaled) onto the device if you need a single
graphical element many times. Otherwise, perhaps edit the graphics file
after R has completed its work. None of the vector map formats is easy to
use for this kind of trick, especially because you probably need
attributes on the lines (thickness, colour).

> 
> Cheers,
> hinrich   d8-)
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the R-help mailing list