I am trying to generate a figure produced by Graphics
command and export it to a pdf file having a fixed width. I followed the answer in these links, 1 and 2. These two solutions worked well with Plot
and ListPlot
as they are mentioned. However, they could not work in the same way in case of Graphics
.
A sample code used for testing is:
pts = {{0, 0}, {0, 1}, {1, 1}, {1, 0}, {0, 0}};
pts1 = Table[i + {0.5, 0.5}, {i, pts}];
Show[Graphics[{Line[pts], Line[pts1]}], ImageSize -> {9*72/2.54, Automatic}]
Export["test.pdf", %]
As mentioned in the comments, followed a slightly modified code as
Graphics[{Line[pts], Line[pts1]}]
Export["test1.pdf", Show[%, ImageSize -> {9*72/2.54, Automatic}]]
Both the pdf files have exactly the same sized images which is 11.5cm at 100% magnification!
In the case of Plot
and other commands, the same Show
and Export
commands have one scaling factor and a different one for the Graphics
function?
Using lower dimensions in the image size could result in the desired size one wants i.e. different scaling factors for different commands. But, How to understand this issue in a logical manner?
PS: I am working on Mathematica V 11.0.1.0
Show[{Plot[0, {x, 0, 1}, Axes -> None, PlotRange -> {{0, 1.7}, {0, 1.5}}, ImageSize -> {9*72/2.54, Automatic}], Graphics[{Line[pts], Line[pts1]}]}]
. Then Show inherits the properties of Plot. $\endgroup$ – Alexei Boulbitch Jul 26 '19 at 14:01