ggplot2 pdf import in Adobe Illustrator missing fo

2019-01-21 04:26发布

I created several simple ggplot2 plots and saved them to PDF files using the following commands:

p <- ggplot(plotobject, aes(x=Pos, y=Pval),res=300)
ggsave(plot=p,height=6,width=6,dpi=200, filename="~/example.pdf")

If I now open this example.pdf in Adobe Illustrator I get the following error:

The font AdobePiStd is missing. Affected text will be displayed using a substitute font.

Is there a way in ggplot2 to specify a font (I presume this is for the dots/points) that Adobe will understand or otherwise is there a way to get this font working in Adobe?

/edit just to clarify, the text/labels/titles are all just fine its the dots that are missing for the font /edit2 I got a working solution by just using the EPS output in ggsave, but still would love to find out a way to also be able to just open/import ggplot2 plots in PDF format directly in AI

8条回答
虎瘦雄心在
2楼-- · 2019-01-21 05:06

For dots or points that don't' display correctly in a pdf, I just substitute Zapf Dingbats for the missing font in Adobe Illustrator. For simple plot markers, this does the job most of the time.

查看更多
别忘想泡老子
3楼-- · 2019-01-21 05:07

Another option that in simple cases might solve the problem is to in illustrator select the textobjects not displayed correctly and change the font. Helvetica Neue works for me.

查看更多
Anthone
4楼-- · 2019-01-21 05:08

This seems to be a perverse problem in which Adobe Illustrator cannot find a font (AdobePiStd) that is distributed with Adobe Reader and thus is likely present.

If you search your computer, you are likely to find it. On my WindowsXP system, it was in: C:\Program Files\Adobe\Reader 10.0\Resource\Font

After finding it, you can install it and other fonts in that folder, which should enable Illustrator to find them.

For other font/pdf problems in R, the embedFonts function in grDevices package is useful.

查看更多
【Aperson】
5楼-- · 2019-01-21 05:11

I ran into this problem as well on Mac OS X 10.8.2.

This resolved the issue for me:

font='/Library/Application Support/Adobe/PDFL/10.9/Fonts/AdobePiStd.otf'
cp $font /Library/Fonts/

On your system, find the file with find:

find / -name AdobePiStd.otf 2>/dev/null

/Applications/Adobe Photoshop CC 2018/Adobe Photoshop CC 2018.app/Contents/Required/PDFL/Resource/Fonts/AdobePiStd.otf
/Applications/Adobe Illustrator CC 2018/Adobe Illustrator.app/Contents/Required/PDFL Resource/Resource/Fonts/AdobePiStd.otf
/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/Resource/Font/AdobePiStd.otf
查看更多
在下西门庆
6楼-- · 2019-01-21 05:11

EDIT 2018 The question under was for the initial confusion face. The answer to this question is pdf(useDingbats = FALSE) as stated in numerous answers above. I won't delete this answer, in case you want to read about fonts (which might become a problem too).

OLD ANSWER AI does not recognize Helvetica type fonts. In my computer it doesn't matter that much, since it automatically replaces the font with something suitable. Of course you'd want to change the font in some cases. I often do it manually in AI (just select all the text and change the font type). Here is a thread on how to change the font in ggplot2: Modifying fonts in ggplot2

Ps. There is also another thread that might be helpful: Fonts in R plots

查看更多
smile是对你的礼貌
7楼-- · 2019-01-21 05:12

Although changing the fonts used by AI works well, an alternative is to restrict ggplot2 from using Dingbats in the first place by adding the argument 'useDingbats' to your ggsave command eg:

ggsave(plot=p,height=6,width=6,dpi=200, filename="~/example.pdf", useDingbats=FALSE)
查看更多
登录 后发表回答