3

The following is a minimal example that I intended to obtain a graph (RegionPlot) of image size 3cm:

cm = 72/2.54;
r = RegionPlot[x^2 + y^2 < 1, {x, -1, 1}, {y, -1, 1}, Frame -> True, 
  PlotRange -> {{-1, 1}, {-1, 1}}, FrameLabel -> {x, y}]
Export["test1.pdf", Show[r, ImageSize -> 3 cm]]

After opening test1.pdf by Adobe Acrobat reader, I found out that the real size of the pdf file is 2.19 * 1.98 cm. Why does not the size match, and how can I resolve this problem?

Laplacian
  • 1,053
  • 3
  • 8

1 Answers1

3

You are facing the problem described here. The simplest workaround is to evaluate

SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]

before exporting. Now it works as expected:

Export["test1.pdf", Show[r, ImageSize -> 3 cm]];
pg = Import["test1.pdf", "PageGraphics"][[1]];
Options[pg, ImageSize]
 {ImageSize -> {86., 76.}}
Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368