Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to combine 3 ListContourPlots to obtain a 3 in-row panel figure in Mathematica 7, to export in one single eps file. One of the plots has also its own legend. I am using GraphicsGrid, as suggested in Mathematica help. The problem is that the panels in the final figure are not aligned and the actual plot area is different from panel to panel. This fact has probably something to do with Mathematica considering as dimensions of each plot the entire occupied are, including also axis labels, and aligning the plots according to them as opposed to with respect to the axis themselves.

How can I get the panels to align on the axes?

share|improve this question
2  
Can you please make an example with some simple test graphics where you show the problem? Also see these related questions: stackoverflow.com/questions/5818888/… and mathematica.stackexchange.com/questions/2058/… –  Szabolcs Feb 25 '12 at 23:39
add comment

2 Answers

Since you give no example, I'm only guessing:

ip = {{30, 10}, {30, 50}};
a = ListContourPlot[
   Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}], 
   ImageSize -> 200, ImagePadding -> ip];
b = ListContourPlot[
   Table[{x = RandomReal[{-2, 2}], y = RandomReal[{-2, 2}], 
     Sin[x y]}, {1000}], 
   FrameLabel -> {"abc", "def", Style["BIG TEXT", 30]}, 
   ImageSize -> 200, ImagePadding -> ip];
c = ListContourPlot[RandomReal[1, {10, 10}], InterpolationOrder -> 3, 
   ImageSize -> 200, ImagePadding -> ip];
GraphicsGrid[{{a, b, c}}, Spacings -> {-30, Automatic}]

enter image description here

Here I played with:

  • ImagePadding -> to make padding around each plot independent of their legends and labels
  • Spacings -> to approach the plots to each other on the grid (see here)

But there are other ways of doing it. If you give an example, I can probably be more specific...

share|improve this answer
add comment

Here is how I would combine sub-panels using graphics (and later save the output as an eps file). Note that exact alignment requires a little experimenting.

figa = Plot[x, {x,1,2}, Frame->True, AspectRatio->1];
figb = Plot[Cos[x], {x,1,2}, Frame->True, AspectRatio->1];
Graphics[
   {Inset[figa, {0.25, 0.25}, Automatic, 0.45],
    Inset[figb, {0.75, 0.245}, Automatic, 0.47]},
   PlotRange->{{0,1},{0,0.5}}]

output

You can also add labels or other graphical objects using:

Inset[Text[ Style["my label"]], {0.25, 0.25}, {0, 0}]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.