# EZ Math Movie, Tutorials, Simple Graphics, Drawing a Point

### The point

Points can be drawn, or plotted, on the (x, y) graph. We will introduce three commands:

```setupGraph();
drawPoint(x, y);
stop();
```

Following is an explanation for each one of these.

### setupGraph();

Before we plot any points we usually need to set up the graph. Often, this entails something like the following lines, all with their obvious meanings:

```clearGraph();
drawGrid();
drawAxes();
drawOrigin();

setLineThickness(2);
setLineColor('black');

setAreaColor('yellow');
```

All of this, though, can be done with one command:

`setupGraph();`

### drawPoint(x, y);

In EZ Math Movie you plot a point with the command drawPoint.

Here is a programing line that plots a point at (3, 2):

`drawPoint(3, 2);`

In the above line 3 is the x-coordinate, and 2 is the y-coordinate.

Be sure to note the open and close parentheses, and the comma between the 3 and the 2, and the semi-colon at the end of the line.

### stop();

The looping section of EZ Math Movie is stopped with the command stop. When used, it should be placed as the last line in the loop code section. This command stops the program the same way that pressing the stop button would. It looks like this:

`stop();`

Besides showing how to plot a point, this tutorial example shows you how to write a program that does not loop. Just place stop at the end of the loop code section, and that section will only run once.

### The empty parentheses

You have probably figured out that all commands have parentheses after their name. In the case of drawPoint, the parentheses seem at first to be used as some type of container for the x- and y-coordinates. What about those empty parentheses in setupGraph and stop? What use are they?

The parentheses are empty, but still must be present. Technically, it's the parentheses that tell the computer to execute the command. They are not really containers for values. Sometimes they have values within them, sometimes not, but they have to be there to make anything happen, say, like setting up the graph.

### Running the example program

The following example program demonstrates the drawPoint command as well as the other commands explained here.

### The example program

0ptions

Go on input

Bounds:
Sorry, apparently this browser does not support HTML 5 canvas tag graphics.
Printer

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide

### And....

Next tutorial: Drawing a line segment

Here is a link to a related article at EZ Programing Demos:

### Other sites you may find interesting

Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Custom Search

Name:
Domain:

Name
0

Name:
Name
0