1
$\begingroup$

This question already has an answer here:

I run Mathematica 10.0.2 on my Win7.

I'm trying to make a PDF for publication similar to figure below:

Screenshot of desired output

This is a figure containing a 4X3 image. The feature in image is irrelevant, my point is to align the ticks and labels.

I tried the code below to make a 2X2 figure:

plots = ListPlot[RandomReal[{0, 1}, {100, 2}], Frame -> True, 
ImageSize -> 250, FrameLabel -> {"x label", "y label"}, 
ImagePadding -> {{#[[1]], 0}, {#[[2]], 0}}, 
LabelStyle -> 
 Directive[Bold, Black, 20, 
  FontFamily -> "Times New Roman"]] & /@ {{60, 0}, {0, 0}, {60, 
60}, {0, 60}}

then export:

Export["D:\\...\\gridplottry1.pdf", 
Grid[Partition[plots, 2], Spacings -> {0, 0}]]

unfortunately, the output PDF looks like:

Screenshot of output PDF

There are two problems:

  1. The sizes of the images are not the same.

  2. The y label of second column, which was already cut, appears again in the PDF.

What should I do to fix these problem?

The method of Jen (Do I have to code each case of this Grid full of plots separately?) solves problem one.

 plotGrid[Partition[plots, 2], 500, 300, ImagePadding -> 50]

gives

enter image description here

which looks great but when I export it:

Export["D:\\...\\gridplottry_2.pdf", 
plotGrid[Partition[plots, 2], 500, 300, ImagePadding -> 50]]

The damn y label in second column appears again:

enter image description here

Why does this happen? Why does the PDF look different from output on the notebook?

$\endgroup$

marked as duplicate by Jason B., xzczd, LLlAMnYP, dr.blochwave, István Zachar Dec 21 '15 at 16:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ which option should I check? @E.Doroskevic $\endgroup$ – Harry Dec 21 '15 at 10:57
  • $\begingroup$ AbsoluteOptions[#, ImageSize] & /@ plots gives {{ImageSize -> 250.}, {ImageSize -> 250.}, {ImageSize -> 250.}, {ImageSize -> 250.}} after warning "{Automatic,Automatic} is not a valid tick specification." @E.Doroskevic $\endgroup$ – Harry Dec 21 '15 at 10:59
  • 5
    $\begingroup$ Is this the answer? 6877 $\endgroup$ – Kuba Dec 21 '15 at 11:11
  • $\begingroup$ ahhh...that's what I want...I copyed plotGrid from Jens's anwser, plotGrid[Partition[plots, 2], 500, 300, ImagePadding -> 50] then all looks fine!! $\endgroup$ – Harry Dec 21 '15 at 11:20
  • $\begingroup$ @E.Doroskevic "I would recommend to check assigned option values using AbsoluteOption" Are you serious? $\endgroup$ – xzczd Dec 21 '15 at 11:47