**Advice:**
Plotting a sequence of points

Suppose you want to produce a plot by generating points one at a time, and plotting them. In a typical programming language such as C, you would probably build up the plot one point at a time, plotting each point as it is generated. This is not the way Maple works, however. In Maple a plot is a single object, whose image on the screen or in a file is "printed" as the result of one command (although this may use the results of several different plot commands, combined with
**display**
).

To plot a sequence of points, you build up a list or array of points and then plot it. In the case of a large list, an array can be more efficient. To take maximum advantage of the speed of hardware floating-point arithmetic, you can use an
**hfarray**
. Now the fastest way to proceed is to put this directly into a plot structure. The Maple Advisor Database procedure
**quickplot**
is a convenient way to do this. If you prefer to use one of Maple's own plotting procedures, you need to convert the
**hfarray**
to a list of lists using
**convert(..., listlist)**
. It is much faster to use
**pointplot**
in the
**plots**
package rather than
**plot**
with the
**style=POINT**
option. For a three-dimensional plot, use
**quickplot3d**
, or
**pointplot3d**
in the
**plots**
package.

Use the option
**symbol=POINT**
when plotting points to make each point be a single dot. The other possibilities are
**BOX**
,
**CIRCLE**
,
**CROSS**
and
**DIAMOND**
(which is the default).

**Examples:**

Here we generate a plot of 4000 successive points of the Hénon map
. To take maximum advantage of the speed of hardware floating-point arithmetic, we write a procedure to compute the points and put them in an
**hfarray**
, evaluate it using
**evalhf**
, and plot it using
**quickplot**
. The result is very fast.

`> `
**makearray:= proc()
local L, i, x, y, xp;
L := hfarray(1 .. 4000,1 .. 2);
x:= 0.6; y := 0.2;
for i to 400 do
xp := 1+y-1.4*x^2;
y := .3*x;
x := xp;
od;
for i to 4000 do
xp := 1+y-1.4*x^2;
y := .3*x;
x := xp;
L[i,1]:= x; L[i,2]:= y;
od;
L
end:**

`> `
**ti:= time():
L:= makearray():
quickplot(L,style=point,symbol=point);
time()-ti;**

1.565

It takes about twice as long on my computer if we convert the hfarray to a list of lists and use
**pointplot**
to plot it.

`> `
**ti:= time():
L:= makearray():
Ll:= convert(L,listlist):
plots[pointplot](Ll,symbol=POINT);
time()-ti;**

3.365

Using
**plot**
, it takes nearly 100 times as long as with
**quickplot**
.

`> `
**ti:= time():
plot(Ll,style=point,symbol=point);
time()-ti;**

148.373

**See also:**

__evalhf__
,
__hfarray__
,
__convert(listlist)__
,
__plot__
,
__plot(options)__
,
__pointplot__
,
__pointplot3d__
,
quickplot

**Maple Advisor Database, **
R. Israel 2000