小编pri*_*ian的帖子

ggplot2:为什么半透明+ pdflatex导致比正常更重要的PDF字体?

ggplot2:为什么半透明+ pdflatex导致比正常更重要的PDF字体?

我遇到了一个问题,其中pdf()在R中然后pdflatex-ing ggplot2图像导致与图像在同一页面上的所有文本变得粗壮,但仅在alpha<1 时.这是R中的最小示例:

require("ggplot2")
"%_%" <- function(a, b) paste(a, b, sep="")
test <- function(filename, alpha)
{
  pdf(filename %_% "-fig.pdf")
  p <- ggplot(mtcars, aes(wt, mpg)) + geom_point(alpha=alpha)
  print(p); dev.off()

  latexDocument <- c(
    "\\documentclass{article}",
    "\\usepackage{Sweave}",
    "%\\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}",
    "\\begin{document}",
    "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "\\begin{figure}",
    "\\includegraphics{" %_% filename %_% "-fig}",
    "  \\caption{Figure Caption}",
    "\\end{figure}",
    "\\end{document}")

  con <- file(filename %_% ".tex"); writeLines(latexDocument, con); close(con)
  system("pdflatex " %_% filename) …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

10
推荐指数
1
解决办法
1032
查看次数

标签 统计

ggplot2 ×1

r ×1