7
$\begingroup$

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?

$\endgroup$
1

2 Answers 2

8
$\begingroup$

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...

$\endgroup$
8
$\begingroup$

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}]
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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