I am attempting to export some figures and plots for a publication, and I decided to export the figures as the size they need to be without rescaling them. This would ensure that fonts and linewidths are all consistent between the figures.
I also wish to export the figures as PDF, since that is a vectorized format.
However, I have come across an issue. Some of my plots are wrapped in a Grid. I have discovered that these plots when rendered as a PDF are smaller than an equivalent without the Grid. This issue does not occur when I use PNG format - the Grid and no-Grid plots are the same scale in PNG, but different scales in PDF. I note that using ImageSizeMultipliers (as described here) has no effect.
The following code shows my issue with a minimal working example:
square1 = Graphics[Rectangle[], ImageSize -> 200]
square2 = Grid[{{square1}}]
Export["square1.pdf", square1];
Export["square2.pdf", square2];
Export["square1.png", square1];
Export["square2.png", square2];
(The four exported figures, rendered on the same page and labeled.)
Because the rescaling depends on the export format, this implies it is something wrong with the export format rather than the Grid or Graphics specifically.
Is there any way I can make Grid export as a PDF without it being rescaled so that it matches the scale of my other graphics?
If it is relevant, I am using Mathematica version 11.2.0.0 on Windows 10.
GraphicsGrid
instead ofGrid
, it keeps image size. Strange, but in help onGrid
one can read: "Grid will not change the size of graphics or other objects that have explicit ImageSize settings." $\endgroup$SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]
then try to export again. The setting will persist until you restart the notebook interface. $\endgroup$$FrontEnd
did not seem to help (but I'll verify when I am able). $\endgroup$$FrontEnd
, then the setting will be permanent. If you set it on$FrontEndSession
, it will be cleared when the front end is restarted. Otherwise, there is no difference. $\endgroup$