Aligning my images in Grid causes one of them to become smaller, despite specifying each of their sizes with ImageSize:
dat = Table[{x, y, RandomReal[]*x*y}, {x, 1, 50}, {y, 1, 50}];
img = ListContourPlot[Flatten[dat, 1], ImageSize -> {300, 300}];
oldspotlight =
Graphics[{}, Background -> Black, PlotRange -> {{1, 50}, {1, 50}},
ImageSize -> 300];
a=Show[img,
Graphics[{Circle[{90, 60}, 10]}, PlotRange -> {{1, 50}, {1, 50}},
ImageSize -> {300, 300}]]
b=ImageMultiply[img,
ImageAdd[oldspotlight,
Graphics[{ColorData["GrayTones"][10/20], Disk[{90, 60}, 10]},
Background -> Black, PlotRange -> {{1, 50}, {1, 50}},
ImageSize -> {300, 300}]]]
Grid[{{a,b}}]
Output:



Please note that I don't want to use GraphicsGrid. (The reason is because it doesn't cooperate with Dynamic, which is an unrelated question.)
Answer
One way to do it, which would be a minimal change to your current code, is just wrap image b in Show as you did with image a and give the ImageSize option to this second Show.
dat = Table[{x, y, RandomReal[]*x*y}, {x, 1, 50}, {y, 1, 50}];
img = ListContourPlot[Flatten[dat, 1], ImageSize -> {300, 300}];
oldspotlight =
Graphics[{}, Background -> Black, PlotRange -> {{1, 50}, {1, 50}},
ImageSize -> 300];
a = Show[img,
Graphics[{Circle[{90, 60}, 10]}, PlotRange -> {{1, 50}, {1, 50}},
ImageSize -> {300, 300}]];
b = Show[ImageMultiply[img,
ImageAdd[oldspotlight,
Graphics[{ColorData["GrayTones"][10/20], Disk[{90, 60}, 10]},
Background -> White, PlotRange -> {{1, 50}, {1, 50}}]]],
ImageSize -> {300, 300}];
Grid[{{a, b}}]

Comments
Post a Comment