Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't Inkscape correctly read PDF files generated by R?

Very often, I draw graphs in R and export them in pdf or svg. Then I import them in Inkskape or Illustrator. Sometimes this generates weird results. For instance, when I generate a simple scatterplot with shapes (1 and 16), Inkscape in unable to read it and generate the following file. See my gist file. I suspect that this should be due to the default options of the pdf() graphics device but I'm not sure. Does anyone has a solution?

like image 403
PAC Avatar asked May 07 '14 17:05

PAC


People also ask

What type of PDF file does Inkscape use?

The PDF file format is a vector format that can also hold raster images. Inkscape can save directly to PDF. To do so, do File ‣ Save a Copy, and select Portable Document Format (*. pdf) from the list of available file formats at the bottom.

What file formats does Inkscape support?

Inkscape's native format is Scalable Vector Graphics (SVG), but it can also open most types of image files, including PDF, JPG, GIF, and PNG. With the addition of free, downloadable extensions, Inkscape can also open PostScript, Sketch, CorelDRAW, and other proprietary image formats.


1 Answers

This is a symptom of different fonts being used as the plotting symbols. Try creating the PDF file using:

   pdf("test.pdf", useDingbats = F) 
   plot(1:10, 10:1, pch=16 )
   dev.off()

Screenshot from Inkscape Screenshot from Inkscape

There is a long "Note" in ?pdf about why the authors of R think some pdf viewers (apparently Inkscape being one such) are failing and some configuration suggestions which I have not tested on my Mac.

like image 128
IRTFM Avatar answered Sep 22 '22 15:09

IRTFM