14.4 Editing a Vector Output File

14.4.1 Problem

You want to open a vector output file for final editing.

14.4.2 Solution

Sometimes you need to make final tweaks to the appearance of a graph for presentation. You can open PDF and SVG files with the excellent free program Inkscape, or with the commercial program Adobe Illustrator.

14.4.3 Discussion

Font support can be a problem when you open a PDF file with Inkscape. Normally, point objects drawn with the PDF device will be written as symbols from the Zapf Dingbats font. This can be problematic if you want to open the file in an editor like Illustrator or Inkscape; for example, points may appear as the letter q, as in Figure 14.1, because that is the corresponding letter for a solid bullet in Zapf Dingbats.

Bad conversion of point symbols after opening in Inkscape -- also notice that the spacing of the fonts is slightly off

Figure 14.1: Bad conversion of point symbols after opening in Inkscape – also notice that the spacing of the fonts is slightly off

To avoid this problem, set useDingbats = FALSE. This will make the circles be drawn as circles instead of as font characters:

pdf("myplot.pdf", width = 4, height = 4, useDingbats = FALSE)

# or
ggsave("myplot.pdf", width = 4, height = 4, useDingbats = FALSE)

Note

Older versions of Inkscape might have some issues with fonts as well. You may have noticed that the fonts in Figure 14.1 don’t look quite right. This is because Inkscape (version 0.48) couldn’t find Helvetica, and substituted the font Bitstream Vera Sans instead. A workaround is to copy the Helvetica font file to your personal font library. For example, on Mac OS X, run cp System/Library/Fonts/Helvetica.dfont ~/Library/Fonts/ from a Terminal window to do this, then, when it says there is a font conflict, click “Ignore Conflict.” After this, Inkscape should properly display the Helvetica font.