2
$\begingroup$

I am trying to align a series of plots horizontally. They all share a vertical axis, but I only want to show the axis once on the leftmost plot. However, adding the vertical axis on one of the plots messes up the aspect ratio/scaling. For example, I can set it up this way

test = Reverse@Table[Table[i, {i, -1, 1, j}], {j, 0.1, 0.5, 0.1}];
len1 = Length@test[[All, 1]];
rule = {False, False};
GraphicsGrid[
 Partition[
  Table[
   Plot[test[[i]], {x, 0, .1}, ColorFunction -> "FallColors", 
    AspectRatio -> 3, Axes -> rule, 
    PlotLabel -> "N = " <> ToString[i]], {i, 1, len1}],
  len1],
 ImageSize -> Full]

The result looks like this:

no axis

However when I try to add the axis on the leftmost plot, by doing

test = Reverse@Table[Table[i, {i, -1, 1, j}], {j, 0.1, 0.5, 0.1}];
len1 = Length@test[[All, 1]];
GraphicsGrid[
 Partition[
  Table[If[i == 1, rule = {False, True}, rule = {False, False}];
   Plot[test[[i]], {x, 0, .1}, ColorFunction -> "FallColors", 
    AspectRatio -> 3, Axes -> rule, 
    PlotLabel -> "N = " <> ToString[i]], {i, 1, len1}],
  len1],
 ImageSize -> Full]

then the leftmost plot does gets compressed due to the fixed aspect ratio

with axis

any help appreciated, also I appreciate any suggestions for improving my plots. My plot looks like this:

enter image description here

$\endgroup$
  • $\begingroup$ maybe GraphicsGrid[ Partition[Table[If[i == 1, style = Automatic, style = Opacity[0]]; Plot[test[[i]], {x, 0, .1}, ColorFunction -> "FallColors", AspectRatio -> 3, Axes -> {False, True}, AxesStyle -> style, PlotLabel -> "N = " <> ToString[i]], {i, 1, len1}], len1], ImageSize -> Full]? $\endgroup$ – kglr Mar 31 '18 at 22:23
  • $\begingroup$ This works but creates I don't like the extra white space between the plots $\endgroup$ – Kai Mar 31 '18 at 22:39
  • $\begingroup$ How about this? Grid[Partition[ Table[If[i == 1, style = Automatic, style = Opacity[0]]; LogLinearPlot[test[[i]], {x, 0, .1}, ColorFunction -> "FallColors", AspectRatio -> 3, Axes -> {False, True}, AxesStyle -> style, PlotLabel -> "N = " <> ToString[i], ImageSize -> Medium], {i, 1, len1}], len1], Spacings -> -0.5] $\endgroup$ – OkkesDulgerci Mar 31 '18 at 22:44
  • $\begingroup$ It helps but the spacings are still much larger than shown in my figure above, and making it more negative does't seem to decrease it any further past -1 $\endgroup$ – Kai Mar 31 '18 at 22:52
  • $\begingroup$ How did you generate your last figure? In my case -2 works. Note I am using Grid $\endgroup$ – OkkesDulgerci Mar 31 '18 at 22:56
1
$\begingroup$

LevelScheme (or SciDraw) ....

After loading the package:

Quiet@Needs["LevelScheme`LevelScheme`"]

ofig = Figure[{
   Multipanel[{1, 5},
    XPlotRanges -> {0, .1},
    YPlotRanges -> {-1., 1.25},
    XFrameLabels -> None, BufferB -> 2.5,
    YFrameLabels -> None, BufferL -> 3,
    XFrameTicks -> None,
    XPanelSizes -> 1, XGapSizes -> .05,
    YPanelSizes -> 1],
   FigurePanel[{1, 1}, ShowPanelLetter -> False, Frame -> False],
   RawGraphics@
    Plot[test[[1]], {x, 0, .1}, ColorFunction -> "FallColors"],
   ScaledLabel[{.5, .95}, "N=1", FontFamily -> "Helvetica LT Std"],
   FigurePanel[{1, 2}, ShowPanelLetter -> False, Frame -> False],
   RawGraphics@
    Plot[test[[2]], {x, 0, .1}, ColorFunction -> "FallColors"],
   ScaledLabel[{.5, .95}, "N=2", FontFamily -> "Helvetica LT Std"],
   FigurePanel[{1, 3}, ShowPanelLetter -> False, Frame -> False],
   RawGraphics@
    Plot[test[[3]], {x, 0, .1}, ColorFunction -> "FallColors"],
   ScaledLabel[{.5, .95}, "N=3", FontFamily -> "Helvetica LT Std"],
   FigurePanel[{1, 4}, ShowPanelLetter -> False, Frame -> False],
   RawGraphics@
    Plot[test[[4]], {x, 0, .1}, ColorFunction -> "FallColors"],
   ScaledLabel[{.5, .95}, "N=4", FontFamily -> "Helvetica LT Std"],
   FigurePanel[{1, 5}, ShowPanelLetter -> False, Frame -> False],
   RawGraphics@
    Plot[test[[5]], {x, 0, .1}, ColorFunction -> "FallColors"],
   ScaledLabel[{.5, .95}, "N=5", FontFamily -> "Helvetica LT Std"]
   },
  ImageSize -> .5 72 {PAGELENGTH, PAGEWIDTH}
  ]

gets us

enter image description here

There are many options for customisation & efficiency.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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