On Wed, 8 Dec 2004 [EMAIL PROTECTED] wrote: > On 08-Dec-04 Roger Bivand wrote: > > 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, > > How does one do that? None of the tools I can find on my (Linux) > system seem to include the possibility of PS->Xfig (or any other > vector format either, except of course PDF).
http://www.pstoedit.net/pstoedit currently maintained and fairly reliable. > > > 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). > > When I first saw Hinrich's post, I thought it was a hopeless > quest. Even if one had a PS file (rather than PDF), I think > it would only be feasible to write such a conversion if it > were guaranteed that the PS file used only "raw" PS language > in its simplest usage (i.e. one would be able to look out for, > and then interpret, the basic drawing commands like "moveto", > "rmoveto", "lineto", "rlineto", etc. with explicit numerical > coordinates). Unfortunately, many programs which output PS > have extended preambles in which all sorts of abbreviations > are defined to wrap up chunks of "raw" PS. So one would be > looking at writing a fully featured PS interpreter! > > When starting from a PDF file, however, even though this is > in a sense "reminiscent" of PS (and may have been converted > from a PS file), nevertheless PDF is a harder format to interpret > because of its hierarchical "modular" construction (in effect > a "tree of objects"). So I would be even less optimistic about > coverting PDF to a non-PS vector format. > > However, if I'm at all wrong about any of that I would be most > interested to be informatively corrected! > > On the other hand, there is the possibility to convert a bitmap > to a PS file where lines and curves are drawn using vector > graphics (giving the advantage that the result is as smooth as > the resolution of the ultimate raster device allows, and also > that the resulting file may be much smaller, since it only takes > a few bytes to define a line or curve, while the corresponding > bitmap may take many). > > A very useful program for this purpose is 'autotrace': see > > http://autotrace.sourceforge.net/ > > "Here is a short description of currently supported formats: > > * Inputformats BMP, TGA, PNM, PPM, PGM, PBM and those > supported by ImageMagick. > * Exportformat Postscript, svg, xfig, swf, pstoedit, emf, > dxf, cgm, mif, p2e and sk" > > I also received the following just over a year ago on the > 'autotrace' list, but the site does not respond now: > > > > What I really want, is a program like autotrace to output > > > a list of splines or some mathematical representation of > > > the image that I can manipulate mathematically. > > > > Maybe you'd like to have a look at this, to see what can be > > achieved with ~12 KB code (Don't laugh at me ;-) This program > > is actually used in production right now.) > > > > http://www.mesw.de/stencil/ > > The "image that I can manipulate mathematically" sounds like > the sort of thing that Hinrich is looking for! > > Best wishes to all, > [autotraced signature attached (PDF -- note the size!)] > > > -------------------------------------------------------------------- > E-Mail: (Ted Harding) <[EMAIL PROTECTED]> > Fax-to-email: +44 (0)870 094 0861 [NB: New number!] > Date: 08-Dec-04 Time: 13:47:12 > ------------------------------ XFMail ------------------------------ > -- 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: [EMAIL PROTECTED] ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
