Possible Duplicate:
1 Plot, 2 Scale/Axis
Do I have to code each case of this Grid full of plots separately?
What's the most straightforward way to share an axis between two plots in Mathematica? Here's an example, showing the x-axis being shared between the 1st and 2nd, and the 2nd and 3rd plots: Gridding plots in Mathematica is already a challenge, and the standard trick for doing so seems to be giving all the images being gridded the same ImagePadding option (as is done here). This doesn't really work well when trying to have two plots share the same axis, and typically requires much fine-tuning on my part to get things looking good, with problems involving superflous tick labels that are hidden beneath other plots, and clipping of the y-axis tick labels.
Answer
Using my linked answer to the duplicate question, you can make grids of plots with shared axis in any arrangement you wish, e.g.:
plots = Table[
Plot[Cos[2 Pi m x + Pi/4] Sin[2 Pi n x], {x, -1, 1}, Frame -> True,
Axes -> {True, False}, Filling -> Axis, FrameTicks -> All,
PlotRangePadding -> .2, PlotRange -> {-1.1, 1.1}], {m, 1, 4}, {n,
1, 4}];
plotGrid[plots, 700, 300]
Comments
Post a Comment