簡體   English   中英

使用 ggplot ggsave 將文本另存為曲線

[英]Save text as curves with ggplot ggsave

以下代碼將在PDF文件中創建繪圖

library(ggplot2)

ggplot(data=mtcars, aes(x=cyl, y=hp))+
  geom_point() +
ggsave(filename="test1.pdf")

人物很少,但只要不是曲線,就很脆弱。 我想保留外觀。

$ pdffonts test1.pdf 
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
ZapfDingbats                         Type 1            no  no  no      10  0
Helvetica                            Type 1            no  no  no      11  0

如何將文本和符號轉換為曲線?

running R 2.15 on debian squeeze

圖片解釋了文本到曲線的含義

復制自https://tex.stackexchange.com/questions/27327/how-to-convert-text-in-a-pdf-file-from-fonts-text-to-outlines :我稱這個腳本為pdfsquash

#!/bin/sh

if [ "x$1" = "x" -o "x$2" = "x" ]; then
    echo Usage: `basename "$0"` "<input.pdf>" "<output.pdf>" >&2
    exit 1
fi
gs -sDEVICE=pswrite -dNOCACHE -sOutputFile=- -q \
   -dbatch -dNOPAUSE -dQUIET "$1" -c quit | ps2pdf - "$2"

我運行了你的代碼,然后(在 R 之外,雖然你也可以使用system() ):

pdfsquash test1.pdf test1S.pdf

原本的:

pdffonts test1.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
ZapfDingbats                         Type 1            no  no  no      10  0
Helvetica                            Type 1            no  no  no      11  0

新的:

pdffonts test1S.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM