1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
<HTML>
<HEAD>
<TITLE>A script to plot a curve with axes</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<P><font size="+2" color="green">A script to plot a curve with axes</font></P>
<P>
The script file, <TT>graph.pcm</TT>, listed below, reads two columns of
numbers, in free format, from a file. The name of the
file is passed to the script via the generalized parameter,
<code>?1</code>. The first column is stored in a
vector called <TT>X</TT> and the second column is stored in a vector called
<TT>Y</TT>. The script then produces an autoscaled graph
of <TT>Y</TT> versus <TT>X</TT> using joined plotting symbols.
Plotting symbol number one, a `box', is used. The plot is then labeled with
the date and time, positioned interactively. Note that
comments begin with a <code>!</code>.</P>
<p>
<font color="blue"><PRE>
! script file graph.pcm
!
READ ?1 X Y ! read two columns of numbers into vectors X and Y
SET PLOTSYMBOL 1 ! plotting symbol #1, joined
GRAPH X Y ! plot the data, autoscaled, with axes
TEXT DATE ! draw the current date using the graphics cursor
TEXT TIME ! draw the current time using the graphics cursor
</PRE></font></p>
<P>
The figure below was produced by entering the command:
<font color="blue"><code>@graph file.dat</code></font>
The data file, with two columns of numbers, is also shown below.</P>
<p>
<PRE>
1.1 2.2
1.2 2.4
1.3 2.6
1.4 3.1
1.5 4.5
1.6 5.1
</PRE></p>
<p>
<center><img src="graphex1.gif"></center></p>
<P>
<a href="basicexample.htm"><img src="../shadow_left.gif">
<font size="+1" color="olive">Basic example</font></a><br />
<a href="getaxisnums.htm"><img src="../shadow_right.gif">
<font size="+1" color="olive">Getting the axis numbers right</font></a>
</P>
</BODY>
</HTML>
|