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

Draw a Polygon

Get started with 2D graphics by drawing a polygon.

Run the code to draw a polygon. Try other coordinate values:

SHOW/HIDE DETAILS

Draw a polygon with vertices at coordinate positions {0,0}, {2,0}, and {0,1}:

In[1]:=
X
Out[1]=

Turn on axes so you can see the coordinate values:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Draw a house shape. Try drawing other shapes:

SHOW/HIDE DETAILS

Get particular shapes by choosing appropriate coordinate values:

In[1]:=
X
Out[1]=

It may help to turn on the axes:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make it red. Try other colors, like Orange or Green:

SHOW/HIDE DETAILS

Make the polygon red. Enclose the color and polygon in a list (indicated by the curly braces):

In[1]:=
X
Out[1]=

HIDE DETAILS
In[1]:=
X
Out[1]=