Skip to main content

plotting - Align Array Plots


I have two ArrayPlots that I would like to align but my "tweaking" failed yet. I would like each "row" to be aligned.


lista = RandomReal[{0, 1}, 10];
listb = Table[RandomReal[{0, 1}, 10], {1000}];

Row[{ArrayPlot[{Table[0, {Length@lista}], lista}\[Transpose],
Frame -> False,
AspectRatio -> 6/1,

ImageSize -> {100, 700}],
ArrayPlot[listb\[Transpose],
AspectRatio -> 3.5/6,
ImageSize -> {1200, 700},
Frame -> False]}]

enter image description here



Answer



In this particular instance, you can align the two array plots within a row by specifying each ImageSize to have the form {Automatic, h}, for some common h, and also making PlotRangePadding and ImagePadding both be none, like so:


Row[{

ArrayPlot[List /@ lista, ImageSize -> {Automatic, 250},
Frame -> False,
PlotRangePadding -> None, ImagePadding -> None],
ArrayPlot[Transpose@listb, AspectRatio -> 1/GoldenRatio,
ImagePadding -> None, PlotRangePadding -> None,
ImageSize -> {Automatic, 250}, Frame -> None]}
]

This yields:


enter image description here



Comments