3
$\begingroup$

I want to display a series of plots that are aligned, but with certain array positions being empty.

If I generate an array of plots like this:

multiplots = 
Partition[
Table[ListPlot[Prime[Range[25]], Frame -> True], 12], 
          3];
GraphicsGrid @multiplots

plotgrid1

I can use ReplacePart to swap out certain plots with an 'invisible' object, e.g.

blank = Graphics[{Directive[White], Rectangle[]}];
 GraphicsGrid@
  ReplacePart[multiplots, {{2, 2} -> blank, {3, 3} -> blank}]

plotgrid2

The result is fine but the method seems clunky. Is there a more elegant way to generate graphics arrays with empty elements?

$\endgroup$
  • 3
    $\begingroup$ You can also use Null instead of blank. $\endgroup$ – Henrik Schumacher May 18 '18 at 6:58
  • $\begingroup$ @Henrik I think that definitely qualifies as more elegant :) $\endgroup$ – geordie May 18 '18 at 7:47
  • 1
    $\begingroup$ The scientific publishing package SciDraw has replaced the earlier version of LevelScheme. SciDraw makes lots of these kinds of presentation thing much easier. $\endgroup$ – Jagra May 18 '18 at 13:27
1
$\begingroup$

I would use LevelScheme for this.

Quiet@Needs["LevelScheme`LevelScheme`"]

Figure[{
  SetOptions[SchemeObject, FontFamily -> "Helvetica LT Std", 
   FontSize -> 08],
  Multipanel[{4, 3},
   Margin -> 50,
   XPlotRanges -> {0, 25},
   YPlotRanges -> {0, 100},
   XFrameLabels -> None, BufferB -> 5,
   YFrameLabels -> None, BufferL -> 7,
   XFrameTicks -> Automatic,
   YFrameTicks -> Automatic,
   YGapSizes -> .05, XGapSizes -> .05,
   YPanelSizes -> 1,
   XPanelSizes -> 1,
   First -> "A",
   Order -> Horizontal
   ],
  FigurePanel[{1, 1}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{1, 2}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{1, 3}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{2, 1}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  (*FigurePanel[{2, 2}],*)
  FigurePanel[{2, 3}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{3, 1}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{3, 2}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  (*FigurePanel[{3, 3}],*)
  FigurePanel[{4, 1}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{4, 2}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True],
  FigurePanel[{4, 3}],
  RawGraphics@ListPlot[Prime[Range[25]], Frame -> True]
  },
 ImageSize -> 500
 ]

An extensive manual & examples allows lots of fine tuning of the resulting plot enter image description here

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