Try now in the
Open Cloud »
(no sign-in required)

# Circlescapes

Make designs with random arrangements of circles.

Run the code to draw 100 random circles in a size 10 region. Try a different number of circles:

This draws a circle at coordinate {5,5}. PlotRange specifies the size of the drawing area:

 In[1]:= XGraphics[Circle[{5, 5}], PlotRange -> {{0, 10}, {0, 10}}]
 Out[1]=

Use RandomReal to draw circles at random positions.

This gives a random number between 0 and 10. Each time you run the code, you get a different number:

 In[2]:= XRandomReal[10]
 Out[2]=

This gives a list of two random numbers:

 In[3]:= XRandomReal[10, 2]
 Out[3]=

This draws a circle at a random position. Each time you run the code, the circle is drawn in a different place:

 In[4]:= XGraphics[Circle[RandomReal[10, 2]], PlotRange -> {{0, 10}, {0, 10}}]
 Out[4]=

Use Table to draw lots of circles. Table makes lists of things.

This gives a list of 10 random coordinate positions:

 In[5]:= XTable[RandomReal[10, 2], {10}]
 Out[5]=

This draws 10 circles in random coordinate positions:

 In[6]:= XGraphics[Table[Circle[RandomReal[10, 2]], {10}], PlotRange -> {{0, 10}, {0, 10}}]
 Out[6]=

If you dont specify a PlotRange, the output will be just large enough to contain all the circles:

 In[7]:= XGraphics[Table[Circle[RandomReal[10, 2]], {10}]]
 Out[7]=

 In[1]:= XGraphics[Table[Circle[RandomReal[10, 2]], {100}]]
 Out[1]=

Use circles with random radii up to 1.5. Try ranges of radii other than 1.5:

This draws a circle at {5,5} with a radius of 1.5:

 In[1]:= XGraphics[Circle[{5, 5}, 1.5], PlotRange -> {{0, 10}, {0, 10}}]
 Out[1]=

Use RandomReal to specify a random radius. Each time you run the code, you get a different size of circle with a radius between 0 and 1.5:

 In[2]:= XGraphics[Circle[{5, 5}, RandomReal[1.5]], PlotRange -> {{0, 10}, {0, 10}}]
 Out[2]=

Make both the positions and the radii of the circles random:

 In[3]:= XGraphics[Table[Circle[RandomReal[10, 2], RandomReal[1.5]], {100}]]
 Out[3]=

 In[1]:= XGraphics[Table[Circle[RandomReal[10, 2], RandomReal[1.5]], {100}]]
 Out[1]=

Use random colors, and use disks instead of circles. Try numbers of disks other than 100:

Use Disk instead of Circle to get a filled-in shape:

 In[1]:= XGraphics[Disk[{5, 5}]]
 Out[1]=

Make the disk red:

 In[2]:= XGraphics[{Red, Disk[{5, 5}]}]
 Out[2]=

Make the disk a random color. Each time you run the code, you get a different color of disk:

 In[3]:= XGraphics[{RandomColor[], Disk[{5, 5}]}]
 Out[3]=

Make disks with random colors, random positions, and random sizes:

 In[4]:= XGraphics[Table[{RandomColor[], Disk[RandomReal[10, 2], RandomReal[1.5]]}, {100}]]
 Out[4]=

 In[1]:= XGraphics[Table[{RandomColor[], Disk[RandomReal[10, 2], RandomReal[1.5]]}, {100}]]
 Out[1]=

Make each disk have 50% opacity. Try different opacities:

Add Opacity[.5] to make the disks 50% opaque (which is 50% transparent):

 In[1]:= XGraphics[Table[{RandomColor[], Opacity[.5], Disk[RandomReal[10, 2], RandomReal[1.5]]}, {100}]]
 Out[1]=

 In[1]:= XGraphics[Table[{RandomColor[], Opacity[.5], Disk[RandomReal[10, 2], RandomReal[1.5]]}, {100}]]
 Out[1]=

Share ItMake a website that gives a different circlescape each time its visited:

Deploy the circlescape code to the Wolfram Cloud where anyone with a browser can use it:

 In[1]:= XCloudDeploy[ Delayed[ExportForm[ Graphics[ Table[{RandomColor[], Opacity[.5], Disk[RandomReal[10, 2], RandomReal[1.5]]}, {100}]], "PNG"]], "Permissions" -> "Public" ]
 Out[1]=

Click the link in the output to visit the site. Refresh the page in your browser to get a new circlescape.

Share the link by right-clicking it and choosing Copy Address. Paste the link into an email, tweet, or other message.

 In[1]:= XCloudDeploy[ Delayed[ExportForm[ Graphics[ Table[{RandomColor[], Opacity[.5], Disk[RandomReal[10, 2], RandomReal[1.5]]}, {100}]], "PNG"]], "Permissions" -> "Public" ]
 Out[1]=