The “p” problem in R plots, or when a dot is a font in inkscape

Author
Published

January 6, 2015

My graphics/figure workflow generally involves plotting something in R, saving it as a pdf (+png if writing a report with Rmarkdown), followed by some manual editing with Inkscape. Inkscape is a free, as in speech and beer, vector graphics editor - think of a non-commercial Illustrator - and it has very very useful since most of the time I don’t have access to Illustrator, through a combination of working mostly in Linux and the groups not paying for a license. No matter as Inkscape serves me well, including for personal use.

Problem

Back to the science. There is a quick with R plots: by default plots save symbols as fonts dingbats font. This means that when opening a pdf created with R in Inkscape (or Illustrator), points are (correctly) displayed as “p”. Even though this is technically correct, it is a nightmare when editing a figure last minute before a presentation.

Solution

Set set the option r useDingbats = FALSE when saving the plot:

dat <- sample(1:1000,100)  
plot(dat)  
pdf("plot.pdf", useDingbats = FALSE)  
plot(dat)  
dev.off()  

Or even better, make use of Rprofile for more than witty R quotes, adding to it the line grDevices::pdf.options(useDingbats = FALSE). Like this, you will not have to remember this every time a plot is saved. And if you are like me, this will happen often - both the saving and the forgetting.

Source1
Source2

Reuse

Citation

BibTeX citation:
@online{domingues2015,
  author = {Domingues, António},
  title = {The “p” Problem in {R} Plots, or When a Dot Is a Font in
    Inkscape},
  date = {2015-01-06},
  url = {https://amjdomingues.com/posts/2015-01-06-the-p-problem-in-r-plots-or-when-a-dot-is-a-font-in-inkscape/},
  langid = {en}
}
For attribution, please cite this work as:
Domingues, António. 2015. “The ‘p’ Problem in R Plots, or When a Dot Is a Font in Inkscape.” January 6, 2015. https://amjdomingues.com/posts/2015-01-06-the-p-problem-in-r-plots-or-when-a-dot-is-a-font-in-inkscape/.