# Scaling and Stretching a Mesh

I have a Voronoi mesh, given by

L1 = 5; L2 = 5; ar = Automatic;
pts = Flatten[Table[{3/2 i, Sqrt[3] j + Mod[i, 2] Sqrt[3]/2}, {i, L2}, {j, L1}],1] // N;
mesh = VoronoiMesh[pts, AspectRatio -> ar]


If instead we set the aspect ratio ar = 1, we get

which is slightly different. This makes sense since AspectRatio is with respect to the image box size.

My goal is to scale this first image in the horizontal (or vertical) direction by a factor scale. At first I thought about using something like AspectRatio -> scale, but it doesn't work because of the Automatic inconsistency. Any ideas around this? Ideally I would like scale = 1 to correspond to the first image, and then stretch the image from here.

I know about Scale and Scaled for a Graphics object, so maybe I could convert the mesh to a Graphics object? Any ideas?

This is a sketch of what I want

You can use the special form ImageSize -> 1 -> {a,b} for setting image size:

Row[Table[Labeled[
VoronoiMesh[pts, PlotRangePadding -> 0, Frame -> True, ImageSize -> 1 -> 20 {s, 1}],
"s = " <> ToString[s], Top], {s, { .8, 1, 1.3, 2}}], Spacer[5]]


• So as far as I understood, a and b work as scaling factors in the x and y directions? – sam wolfe Feb 19 at 13:02
• @samwolfe, that's right. – kglr Feb 19 at 13:16
• Just getting one annoying thing: whenever I evaluate the cell, select one of the output images and zoom in or out with the corner and side interactive widgets, the image gets automatically descaled, and I can't get it back to normal. Any way around this? – sam wolfe Feb 19 at 15:48
• @sam, It may be a version/os-related issue. Interactive re-sizing works as expected in version 11.3 (windows 10 -64 bit) – kglr Feb 19 at 18:13
• @sam, sorry spoke too soon. I had tried the panel with s=1. In other panels I have the same issue. To fix the issue add the option AspectRatio -> Full. – kglr Feb 19 at 19:29

What if you scale underlying points of MeshRegion? That way you have complete control and you can use geometric transformation functions like ScalingTransform, RotationTransform, etc.

(* mesh comes form OP's code *)
newCrds = ScalingTransform[{2, 1}] /@ MeshCoordinates[mesh]
MeshRegion[newCrds, MeshCells[mesh, 2], Frame -> True]