1

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?

Harry
  • 2,715
  • 14
  • 27
  • which option should I check? @E.Doroskevic – Harry Dec 21 '15 at 10:57
  • AbsoluteOptions[#, ImageSize] & /@ plots gives {{ImageSize -> 250.}, {ImageSize -> 250.}, {ImageSize -> 250.}, {ImageSize -> 250.}} after warning "{Automatic,Automatic} is not a valid tick specification." @E.Doroskevic – Harry Dec 21 '15 at 10:59
  • 5
    Is this the answer? 6877 – Kuba Dec 21 '15 at 11:11
  • 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!! – Harry Dec 21 '15 at 11:20
  • @E.Doroskevic "I would recommend to check assigned option values using AbsoluteOption" Are you serious? – xzczd Dec 21 '15 at 11:47
  • This question has been asked in different forms more times, than I can remember. The leftmost and bottom plots are a special case. You need to define the plots such, that each plot in one row has the same height and each plot in one column has the same width, as well as matching paddings (top and bottom in one row, left and right in one column). Of course, the non-leftmost/bottommost plots need to have no ticks or labels. – LLlAMnYP Dec 21 '15 at 13:01
  • @LLlAMnYP - that's what the plotGrid function does, works brilliantly, the only really bad part is the overlapping tick labels. Harry, I don't reproduce your PDF problems with the extra "y label"s coming through - for me the PDF looks the same as the notebook. – Jason B. Dec 21 '15 at 13:21

0 Answers0