[英]Save text as curves with ggplot ggsave
The following code will create a plot in a PDF
file以下代码将在
PDF
文件中创建绘图
library(ggplot2)
ggplot(data=mtcars, aes(x=cyl, y=hp))+
geom_point() +
ggsave(filename="test1.pdf")
There are only very few characters, but they are fragile as long they are not curves.人物很少,但只要不是曲线,就很脆弱。 I want to conserve the appeareance.
我想保留外观。
$ 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
How can I convert the text and symbols to curves?如何将文本和符号转换为曲线?
running R 2.15 on debian squeeze
Copied from https://tex.stackexchange.com/questions/27327/how-to-convert-text-in-a-pdf-file-from-fonts-text-to-outlines : I called this script pdfsquash
复制自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"
I ran your code, then (outside of R, although you could also use system()
):我运行了你的代码,然后(在 R 之外,虽然你也可以使用
system()
):
pdfsquash test1.pdf test1S.pdf
The original:原本的:
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
New:新的:
pdffonts test1S.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.