[R] vector graphics/ SVG plots via RSvgDevice

Sam McClatchie Sam.McClatchie at noaa.gov
Wed Oct 24 18:20:55 CEST 2007

System: 2.6.0
Linux kernel 2.6.15 Ubuntu dapper
R version 2.5.1
ESS 5.2.11 on Emacs 21.4.1

Hello Brian

Thanks for the tip. I upgraded to R 2.6.0., installed the package
RSvgDevice, and modified my R-code to produce a vector graphics .svg
file instead of postscript. The .svg file imported nicely into inkscape
and I could work with all elements of the figure, which was what I wanted.
The main problem that I have encountered is larger file size
(my .svg file is twice the size of my .ps file), and because there is a
lot of data in this figure, I have
a 2MB file.

I also found a description of how to configure LyX so you
can use the .svg files directly instead of converting to .ps or .eps for
LaTex output <http://wiki.lyx.org/Tips/UseInkscapeSVGImages>. This works
nicely, and saves a step, but I still have to find a converter for svg 
to dpi or pdf.

Best fishes

Sam McClatchie,
Fisheries oceanographer
Southwest Fisheries Science Center, NOAA,
8604 La Jolla Shores Drive
La Jolla, CA 92037-1508, U.S.A.
email <Sam.McClatchie at noaa.gov>
work phone: 858 546 7083
Cellular:  858 752 8495
Research home page <http://www.fishocean.info>

                 //// \\\\
               /////  \\\\\\
   >><(((°>   ...>><xX(°>O<°)Xx><<


Prof Brian Ripley wrote:

The R graphics model is low-level, and the problem is CorelDraw's limited
capabilities (Adobe Illustrator seems to do rather better with postscript
generated by R).  The XFig and SVG drivers may produce output that is more
easily editable, but ultimately the problem is that R graphics is done by
precise placement of basic elements (lines, rectangles, polygons, text)
and not designed to be post-processed.

One of my students had some success generating SVG plots via RSvgDevice
and editing with Inkscape: that has announced PDF import support, but I've
not yet tried it.

On Thu, 18 Oct 2007, Sam McClatchie wrote:

> System: Linux kernel 2.6.15 Ubuntu dapper R version 2.5.1 ESS 5.2.11 
> on Emacs 21.4.1 ------------------------- Colleagues
> Having read the posts on producing perfect graphs in R, or using 
> inkscape to edit R graphics output, I have a related question.
> Lately I am publishing in a journal that is very picky about their 
> graphics formats. It is more efficient for me to get the final picky
>  details of each graph done by our graphics department, who use 
> Windows CorelDraw. The problem is that I have not yet been able to 
> give them a vector graphics format that can be ungrouped in CorelDraw
>  for editing. Bitmaps cannot be ungrouped 
> <www.eatbywest.com/pub/vectorbitmap/>. The standard postscript that I
>  am producing in R cannot be ungrouped either, and comes into 
> CorelDraw looking fragmented. While I may be doing something odd in 
> the production of my postscript files, they look fine elsewhere, and 
> print well, so I don't think there is a problem.
> Can anyone tell me how to produce vector graphics in R that can be 
> ungrouped for editing in CorelDraw?
> Best fishes
> Sam

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list