Displaying images in a grid layout?

What I’m after is a Julia equivalent to Matlab’s “subplots”, that allows images to be displayed in arbitrary grids. I can “stitch” two images of the same size with

[img1 img2]

as the last line of an IJulia cell. But this shows the two images as one single, larger image, which is not what I want. I’m looking for something like

plot(img1, img2, layout=(1,2)) 

in which the sizes of the two images are irrelevant. The best I can find so far is

plot(plot(img1,seriestype=:image),plot(img2,seriestype=:image))

but this resizes the images so that they’re displayed with the same size. Again, that’s not quite what I want.

What’s my best option here?

Thanks,
Alasdair

MosaicViews.jl provided a helper function mosaic for this feature. This package is reexported by ImageCore so using ImageCore also gives you mosaic.

If Gnuplot.jl is an option, you may try:

using Gnuplot
img1 = randn(100, 200);
img2 = randn(150, 50);
@gp "set multiplot layout 1,2" "set autoscale fix" "set size ratio -1" :-
@gp :- 1 img1 "w image notit" 2 img2 "w image notit"

which would produce the following:

Further info here.

Many thanks - it does seem that mosaicview works well, especially if you use the npad and fillvalue options.

1 Like