5
Using ArrayPad + Fold + Nest + MatrixPlot
ClearAll[padMat]
padMat = Fold[ArrayPad[#, RotateLeft[{{0}, {Length @ #, 0}}, #2 - 1], 1 + Max @ #] &,
#, {1, 2}] &;
Examples:
With[{n = 6}, MatrixPlot[Nest[padMat, {{1}}, n] /. x_Integer :> ColorData[97][x],
ImageSize -> 600, Frame -> False, Mesh -> All]]
Grid @ Partition[#, 3] & @ ...
4
We can also use affine transformations of the unit rectangle to get the desired picture:
ClearAll[rectangleCoords]
rectangleCoords[n_] := Module[{mod = Mod[Range[0, n - 2], 2],
sy = 2^Floor[Range[0, n - 2]/2], rcoords = {{0, 0}, {1, 1}}},
Through[(Reverse @ Prepend[Identity][AffineTransform[{{{#, 0}, {0, #2}}, {##3}}] & @@@
(Transpose[{(1 + ...
1
We can also recursively divide the bottom-right rectangle into three rectangles as follows:
ClearAll[threerects, step, rectlist]
threerects = # /. Rectangle[{a_, b_}, {c_, d_}] :>
{Rectangle[{a, (b + d)/2}, {c, d}],
Rectangle[{a, b}, {a + c, b + d}/2],
Rectangle[{(a + c)/2, b}, {c, (b + d)/2}]} &;
Graphics[MapIndexed[{{Red, Green,...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
manipulate × 1754plotting × 487
dynamic × 255
graphics × 156
gui-construction × 148
differential-equations × 98
animation × 96
list-manipulation × 74
graphics3d × 74
evaluation × 44
locator × 44
scoping × 40
slider × 40
functions × 38
performance-tuning × 37
export × 36
equation-solving × 32
programming × 29
warning-messages × 29
interactive × 24
output-formatting × 23
color × 23
cdf-format × 23
calculus-and-analysis × 20
front-end × 20