Plot certain variations of the Cantor set

In the post graph of the Cantor set in Mathematica, there are many nice plots of the Cantor set.

It is possible to use Mathematica to produce

• the plot of a $$360°$$ rotation of the Cantor set around the point $$1/2$$?
• the plot of the set obtained by putting Cantor sets continuously "side by side" in the $$[0,1] \times [0,1]$$ square? That is, just "replacing the dots" in the Cantor set with vertical lines of length one
• The answers to both questions are Yes. Are you looking for a free coding service? Commented May 3, 2019 at 19:59

If I understand the question correctly, we could make a mesh with CantorMesh, convert it to lines with MeshPrimitives, then use a replacement rule to convert the lines to either annuli or rectangles to be wrapped in Graphics.

Rotated 360 degrees around $$(1/2,0)$$:

Graphics[MeshPrimitives[CantorMesh[6], 1] /.
{Line[{{x1_}, {x2_}}] :> Annulus[{0.5, 0}, Sort[Abs[{0.5, 0.5} - {x1, x2}]]]}]

Extended vertically to the unit square:

Graphics[MeshPrimitives[CantorMesh[6], 1] /.
Line[{{x1_}, {x2_}}] :> Rectangle[{x1, 0}, {x2, 1}]]

• That's great. Thanks.
– Riku
Commented May 7, 2019 at 18:23

Here's one way to make 2D Cantor plots:

CantorMesh[4, 2]

Change the first number to plot at higher levels. Change the second number to 3 for a 3D plot:

CantorMesh[2, 3]

• Thank you. But in the second part of the question I actually didn't mean a multi-dimensional cantor dust, but just "replacing the dots" in the cantor set with vertical lines of lenght one.
– Riku
Commented May 3, 2019 at 20:39
• I answered the question you asked, not the one you intended to ask. Commented May 3, 2019 at 20:41
• Technically you didn't: that picture is not "the plot of the set obtained by putting Cantor sets continuously "side by side" in the $[0,1] \times [0,1]$ square". Thanks anyway for the effort, though.
– Riku
Commented May 3, 2019 at 20:47