summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pstricks/psd-basi.tex
blob: 0d9f5ccea8b51c6dd3d5f683062a363b9afd534e (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
%% BEGIN psd-basi.tex

\part{Basic graphics objects\label{P-graphics}}

\Section{Lines and polygons\label{S-lines}}

The objects in this section also use the following parameters:
\begin{description}
  \pitem[linearc=dim] The radius of arcs drawn at the corners of lines by the
  \n\psline{} and \n\pspolygon{} graphics objects. <dim> should be positive.
  \pitem[framearc=num] In the \n\psframe{} and the related box framing macros,
  the radius of rounded corners is set, by default, to one-half <num> times
  the width or height of the frame, whichever is less. <num> should be between
  0 and 1.
  \pitem[cornersize=relative/absolute] If \p{cornersize} is "relative", then
  the \p{framearc} parameter determines the radius of the rounded corners for
  \n\psframe, as described above (and hence the radius depends on the size of
  the frame). If \p{cornersize} is "absolute", then the \p{linearc} parameter
  determines the radius of the rounded corners for \n\psframe{} (and hence the
  radius is of constant size).
\end{description}


Now here are the lines and polygons:
\begin{description}

\oitem  \psline`{arrows}(\x0,\y0)'(\x1,\y1)`\ldots(\x n,\y n)'

  This draws a line through the list of coordinates. For example:
\begin{MEx*}(4,2)
  \psline[linewidth=2pt,linearc=.25]{->}(4,2)(0,1)(2,0)
\end{MEx*}

\mitem  \qline(coor0)(coor1)

  This is a streamlined version of \n\psline{} that does not pay attention to
the \p{arrows} parameter, and that can only draw a single line segment. Note
that both coordinates are obligatory, and there is no optional argument for
setting parameters (use \n\psset{} if you need to change the \p{linewidth}, or
whatever). For example:
\begin{MEx*}(2,1)
  \qline(0,0)(2,1)
\end{MEx*}

\oitem  \pspolygon`(\x0,\y0)'(\x1,\y1)(\x2,\y2)`\ldots(\x n,\y n)'

  This is similar to \n\psline, but it draws a closed path. For example:
\begin{MEx*}(4,2)
  \pspolygon[linewidth=1.5pt](0,2)(1,2)
  \pspolygon*[linearc=.2,linecolor=darkgray](1,0)(1,2)(4,0)(4,2)
\end{MEx*}

\oitem  \psframe`(\x0,\y0)'(\x1,\y1)

  \n\psframe{} draws a rectangle with opposing corners \c0 and \c1. For
example:
\begin{MEx*}(4,2)
  \psframe[linewidth=2pt,framearc=.3,fillstyle=solid,
    fillcolor=lightgray](4,2)
  \psframe*[linecolor=white](1,.5)(2,1.5)
\end{MEx*}

\oitem  \psdiamond`\c0'\c1

  \n\psdiamond{} draws a diamond centered at \c0, and with the half width and
height equal to \x1\ and \y1, respectively.
\begin{MEx*}(4,2)
  \psdiamond[framearc=.3,fillstyle=solid,
    fillcolor=lightgray](2,1)(1.5,1)
\end{MEx*}

The diamond is rotated about the center by
\begin{Ex}
  \Par{gangle=gangle}
\end{Ex}

\oitem  \pstriangle`\c0'\c1

  \n\pstriangle{} draws an isosceles triangle with the base centered at \c0,
and with width (base) and height equal to \x1{} and \y1, respectively.
\begin{MEx*}(4,2)
  \pstriangle*[gangle=10](2,.5)(4,1)
\end{MEx*}

\end{description}

\Section{Arcs, circles and ellipses}

\begin{description}

\oitem  \pscircle`(\x0,\y0)'{radius}

This draws a circle whose center is at \c0 and that has radius <radius>. For
example:
\begin{MEx*}[-1,-1](2,2)
  \pscircle[linewidth=2pt](.5,.5){1.5}
\end{MEx*}

\mitem  \qdisk(coor){radius}

  This is a streamlined version of \n{\pscircle*}. Note that the two arguments
are obligatory and there is no parameters arguments. To change the color of
the disks, you have to use \n\psset:
\begin{MEx}[1.9,2.9](2.1,3.1)
  \psset{linecolor=gray}
  \qdisk(2,3){4pt}
\end{MEx}

\oitem  \pswedge`(\x0,\y0)'{radius}{angle1}{angle2}

  This draws a wedge whose center is at \c0, that has radius <radius>, and
that extends counterclockwise from <angle1> to <angle2>. The angles must be
specified in degrees. For example:
\begin{MEx*}(2,2)
  \pswedge[linecolor=gray,linewidth=2pt,fillstyle=solid]{2}{0}{70}
\end{MEx*}

\oitem  \psellipse`(\x0,\y0)'(\x1,\y1)

\c0 is the center of the ellipse, and \x1 and \y1 are the horizontal and
vertical radii, respectively. For example:
% D.G. modification begin - Mar.  3, 2003
%\begin{MEx*}[-1,-1.5](2,1)
% D.G. modification end
\begin{MEx*}[-1,-1](2,1)
  \psellipse[fillcolor=lightgray](.5,0)(1.5,1)
\end{MEx*}

\oitem  \psarc`{arrows}\c~'{radius}{angleA}{angleB}

  This draws an arc from <angleA> to <angleB>, going counter clockwise, for a
circle of radius <radius> and centered at \c{}. You must include either the
{arrows} argument or the \c{} argument. For example:
\begin{MEx*}(3,2)
  \psarc*[showpoints=true](1.5,1.5){1.5}{215}{0}
\end{MEx*}
See how \p{showpoints=true} draws a dashed line from the center to the arc;
this is useful when composing pictures.

\n\psarc{} also uses the parameters:
\begin{description}

\pitem[arcsepA=dim](0pt)

  <angleA> is adjusted so that the arc would just touch  a line of width <dim>
that extended from the center of the arc in the direction of <angleA>.

\pitem[arcsepB=dim](0pt) This is like \p{arcsepA}, but <angleB> is adjusted.

\pitem[arcsep=dim] This just sets both \p{arcsepA} and \p{arcsepB}.
\end{description}
These parameters make it easy to draw two intersecting lines and then use
\n\psarc{} with arrows to indicate the angle between them. For example:
\begin{MEx*}(4,3)
  \SpecialCoor
  \psline[linewidth=2pt](4;50)(0,0)(4;10)
  \psarc[arcsepB=2pt]{->}{3}{10}{50}
\end{MEx*}

\oitem  \psarcn`{arrows}\c~'{radius}{angleA}{angleB}

  This is like \n\psarc, but the arc is drawn \emph{clockwise}. You can achieve
the same effect using \n\psarc{} by switching <angleA> and <angleB> and the
arrows.\footnote{%
However, with \n\pscustom{} graphics object, described in Part \ref{P-custom},
\n\psarcn{} is not redundant.}

\oitem  \psellipticarc`{arrows}(\x0,\y0)'(\x1,\y1){angleA}{angleB}

  This draws an elliptic from <angleA> to <angleB>, going counter clockwise,
with \c0 the center of the ellipse and \x1 and \y1 the horizontal and
vertical radii, respectively. For example:
\begin{MEx*}[-1,-1](2,1)
  \psellipticarc[showpoints=true,arrowscale=2]{->}(.5,0)(1.5,1){215}{0}
\end{MEx*}
See how \p{showpoints=true} draws a dashed line from the center to the arc;
this is useful when composing pictures.

Like \n\psarc, \n\psellipticarc{} use the \p{arcsep}/\p{arcsepA}/\p{arcsepB}
parameters.

Unlike \n\psarc, \n\psellipticarc use the
\p{dimen}=\p{inner}/\p{middle}/\p{outer} parameter.

\oitem  \psellipticarcn`{arrows}(\x0,\y0)'(\x1,\y1){angleA}{angleB}

  This is like \n\psellipticarc, but the arc is drawn \emph{clockwise}. You can
achieve the same effect using \n\psellipticarc{} by switching <angleA> and
<angleB> and the arrows.\footnote{%
However, with \n\pscustom{} graphics object, described in Part \ref{P-custom},
\n\psellipticarcn{} is not redundant.}

\end{description}


\Section{Curves}

\begin{description}

\oitem  \psbezier`{arrows}(\x0,\y0)'(\x1,\y1)(\x2,\y2)(\x3,\y3)

  \n\psbezier{} draws a bezier curve with the four control points. The curve
starts at the first coordinate, tangent to the line connecting to the second
coordinate. It ends at the last coordinate, tangent to the line connecting to
the third coordinate. The second and third coordinates, in addition to
determining the tangency of the curve at the endpoints, also ``pull'' the
curve towards themselves. For example:
\begin{MEx}(4,4)
  \psbezier[linewidth=2pt,showpoints=true]{->}(0,0)(1,4)(2,1)(4,3.5)
\end{MEx}
\p{showpoints=true} puts dots in all the control points, and connects them by
dashed lines, which is useful when adjusting your bezier curve.

\oitem  \parabola`{arrows}'\c0\c1

  Starting at \c0, \n\parabola{} draws the parabola that passes through \c0 and
whose maximum or minimum is \c1. For example:
\begin{MEx*}(4,3)
  \parabola*(1,1)(2,3)
  \psset{xunit=.01}
  \parabola{<->}(400,3)(200,0)
\end{MEx*}
\end{description}

The next three graphics objects interpolate an open or closed curve through
the given points. The curve at each interior point is perpendicular to the
line bisecting the angle ABC, where B is the interior point, and A and C are
the neighboring points. Scaling the coordinates \emph{does not} cause the curve
to scale proportionately.

The curvature is controlled by the following parameter:
\begin{description}
\pitem[curvature=num1 num2 num3]

  You have to just play around with this parameter to get what you want.
Individual values outside the range -1 to 1 are either ignored or are for
entertainment only. Below is an explanation of what each number does. A, B and
C refer to three consecutive points.

 Lower values of <num1> make the curve tighter.

 Lower values of <num2> tighten the curve where the angle ABC is greater than
45 degrees, and loosen the curve elsewhere.

 <num3> determines the slope at each point. If <num3>=0, then the curve is
perpendicular at B to the bisection of ABC. If <num3>=-1, then the curve at B
is parallel to the line AC. With this value (and only this value), scaling the
coordinates causes the curve to scale proportionately. However, positive
values can look better with irregularly spaced coordinates. Values less than
-1 or greater than 2 are converted to -1 and 2, respectively.
\end{description}

Here are the three curve interpolation macros:
\begin{description}

\oitem  \pscurve`{arrows}'\c1`\ldots\cn'

  This interpolates an open curve through the points. For example:
\begin{MEx*}(4,2)
  \pscurve[showpoints=true]{<->}(0,1.3)(0.7,1.8)
    (3.3,0.5)(4,1.6)(0.4,0.4)
\end{MEx*}
Note the use of \p{showpoints=true} to see the points. This is helpful when
constructing a curve.

\oitem  \psecurve`{arrows}'\c1`\ldots\cn']

  This is like \n\pscurve, but the curve is not extended to the first and last
points. This gets around the problem of trying to determine how the curve
should join the first and last points. The "e" has something to do with
``endpoints''. For example:
% D.G. modification begin - Mar.  3, 2003
%\begin{MEx*}[0,-.9](4,4)
% D.G. modification end
\begin{MEx*}(4,4)
  \psecurve[showpoints=true](.125,8)(.25,4)(.5,2)
    (1,1)(2,.5)(4,.25)(8,.125)
\end{MEx*}

\oitem  \psccurve`{arrows}'\c1`\ldots\cn'

This interpolates a closed curve through the points. "c" stands for
``closed''. For example:
\begin{MEx*}(4,1)
  \psccurve[showpoints=true]
    (.5,0)(3.5,1)(3.5,0)(.5,1)
\end{MEx*}
\end{description}

\Section{Dots\label{S-dots}}

The graphics objects
\begin{Ex}
  \object  \psdot`*[par](\x1,y1)'
  \object  \psdots`*[par]'(\x1,\y1)`(\x2,\y2)\ldots(\x n,\y n)'
\end{Ex}
put a dot at each coordinate.

What a ``dot'' is depends on the value of the
\begin{Ex}
  \Par{dotstyle=style}
\end{Ex}
parameter. This also determines the dots you get when \p{showpoints=true}.

The dot styles are also pretty intuitive:%
\newbox\dottable
\setbox\dottable=\hbox{%
  \psset{fillcolor=lightgray}
  \def\mydots#1{%
    \psdots[dotstyle=#1](.1,1ex)(.55,1ex)(1,1ex)(1.45,1ex)(1.9,1ex)}%
  \hfill
  \begin{tabular}{cl}%
    \emph{Style} & \hbox to 2cm{\emph{Example}\hss} \\[2pt]
    "*"         & \mydots{*}\\
    "o"         & \mydots{o}\\
    "Bo"        & \mydots{Bo}\\
    "x"         & \mydots{x}\\
    "+"         & \mydots{+}\\
    "B+"        & \mydots{B+}\\
    "asterisk"  & \mydots{asterisk}\\
    "Basterisk" & \mydots{Basterisk}\\
    "oplus"     & \mydots{oplus}\\
    "otimes"    & \mydots{otimes}\\
    "|"         & \mydots{|}\\
    "B|"        & \mydots{B|}
  \end{tabular}%
  \hfill
  \begin{tabular}{cl}
    \emph{Style} & \hbox to 2cm{\emph{Example}\hss} \\[2pt]
    "square"    & \mydots{square}\\
    "Bsquare"   & \mydots{Bsquare}\\
    "square*"   & \mydots{square*}\\
    "diamond"   & \mydots{diamond}\\
    "diamond*"  & \mydots{diamond*}\\
    "triangle"  & \mydots{triangle}\\
    "Btriangle" & \mydots{Btriangle}\\
    "triangle*" & \mydots{triangle*}\\
    "pentagon"  & \mydots{pentagon}\\
    "Bpentagon" & \mydots{Bpentagon}\\
    "pentagon*" & \mydots{pentagon*}\\
  \end{tabular}%
  \hfill}%
\addtoquickref{center}{%
  {\large\textbf{Dot styles}}\par
  \leavevmode\hbox to \hsize{\unhbox\dottable}}
\begin{center}
  \leavevmode
  \hbox to \hsize{\unhcopy\dottable}%
\end{center}

Except for "diamond", the center of dot styles with a hollow center is colored
\p{fillcolor}.

Here are the parameters for changing the size and orientation of the dots:
\begin{description}

\pitem[dotsize=dim `num']
  The diameter of a circle or disc is <dim> plus <num> times \p{linewidth}
(if the optional <num> is included). The size of the other dots styles is
similar (except for the size of the "|" dot style, which is set by the
\p{tbarsize} parameter described on page \pageref{p+tbarsize}).

\pitem[dotscale=num1 `num2']
The dots are scaled horizontally by <num1> and vertically by <num2>. If you
only include <num1>, the arrows are scaled by <num1> in both directions.

\pitem[dotangle=angle]
  After setting the size and scaling the dots, the dots are rotated by <angle>.

\end{description}


\Section{Grids\label{S-grids}}

PSTricks has a powerful macro for making grids and graph paper:
  \Mac  \psgrid`(\x0,\y0)(\x1,\y1)(\x2,\y2)'
\n\psgrid{} draws a grid with opposing corners \c1 and \c2. The intervals are
numbered, with the numbers positioned at \x0 and \y0. The coordinates are
always interpreted as Cartesian coordinates. For example:
\begin{MEx}[-1,-1](3,2)
  \psgrid(0,0)(-1,-1)(3,2)
\end{MEx}
(Note that the coordinates and label positioning work the same as with
\n\psaxes.)

The main grid divisions occur on multiples of \p{xunit} and \p{yunit}.
Subdivisions are allowed as well. Generally, the coordinates would be given as
integers, without units.

If the \c0 coordinate is omitted, \c1 is used. The default for \c1 is "(0,0)".
If you don't give any coordinates at all, then the coordinates of the current
\n\pspicture{} environment are used or a 10x10 grid is drawn. Thus, you can
include a \n\psgrid{} command without coordinates in a \n\pspicture\
environment to get a grid that will help you position objects in the picture.

The main grid divisions are numbered, with the numbers drawn next to the
vertical line at \x0 (away from \x2) and next to the horizontal line at \x1
(away from \y2). \c1 can be any corner of the grid, as long as \c2 is the
opposing corner, you can position the labels on any side you want. For
example, compare
\begin{MEx}(4,1)
  \psgrid(0,0)(4,1)
\end{MEx}
and
\begin{MEx}(4,1)
  \psgrid(4,1)(0,0)
\end{MEx}

The following parameters apply only to \n\psgrid:
\begin{description}

\pitem[gridwidth=dim]
  The width of grid lines.

\pitem[gridcolor=color]
  The color of grid lines.

\pitem[griddots=num]
  If <num> is positive, the grid lines are dotted, with <num> dots per
division.

\pitem[gridlabels=dim]
  The size of the numbers used to mark the grid.

\pitem[gridlabelcolor=color]
  The color of the grid numbers.

\pitem[subgriddiv=int]
  The number of grid subdivisions.

\pitem[subgridwidth=dim]
  The width of subgrid lines.

\pitem[subgridcolor=color]
  The color of subgrid lines.

\pitem[subgriddots=num]
  Like \p{griddots}, but for subdivisions.

\end{description}

Here is a familiar looking grid which illustrates some of the parameters:
\begin{MEx}[-1,-1](3,1)
  \psgrid[subgriddiv=1,griddots=10,gridlabels=7pt](-1,-1)(3,1)
\end{MEx}

Note that the values of \p{xunit} and \p{yunit} are important parameters for
\n\psgrid, because they determine the spacing of the divisions. E.g., if the
value of these is "1pt", and then you type
\begin{LVerb}
  \psgrid(0,0)(10in,10in)
\end{LVerb}
you will get a grid with 723 main divisions and 3615 subdivisions! (Actually,
\n\psgrid{} allows at most 500 divisions or subdivisions, to limit the damage
done by this kind of mistake.) Probably you want to set \p{unit} to ".5in" or
"1in", as in
\begin{LVerb}
  \psgrid[unit=.5in](0,0)(20,20)
\end{LVerb}


\Section{Plots}

\File{pst-plot}
The plotting commands described in this part are defined in
"pst-plot.tex" / "pst-plot.sty", which you must load first.

The \n\psdots, \n\psline, \n\pspolygon, \n\pscurve, \n\psecurve{} and
\n\psccurve{} graphics objects let you plot data in a variety of ways. However,
first you have to generate the data and enter it as coordinate pairs \c{}.
The plotting macros in this section give you other ways to get and use the
data. (Section \ref{S-axes} tells you how to generate axes.)

To parameter
\begin{Ex}
 \Par{plotstyle=style}
\end{Ex}
determines what kind of plot you get. Valid styles are "dots", "line",
"polygon", "curve", "ecurve", "ccurve". E.g., if the \p{plotstyle} is
"polygon", then the macro becomes a variant of the \n\pspolygon{} object.

You can use arrows with the plot styles that are open curves, but there is no
optional argument for specifying the arrows. You have to use the \p{arrows}
parameter instead.

\begin{Warning}
No PostScript error checking is provided for the data arguments. Read Appendix
\ref{S-raw} before including PostScript code in the arguments.

There are system-dependent limits on the amount of data \TeX{} and PostScript
can handle. You are much less likely to exceed the PostScript limits when you
use the "line", "polygon" or "dots" plot style, with \p{showpoints=false},
\p{linearc=0pt}, and no arrows.
\end{Warning}

Note that the lists of data generated or used by the plot commands cannot
contain units. The values of \n\psxunit{} and \n\psyunit{} are used as the unit.


\begin{description}

\oitem  \fileplot{file}

\n\fileplot{} is the simplest of the plotting functions to use. You just need a
file that contains a list of coordinates (without units), such as generated by
Mathematica or other mathematical packages. The data can be delimited by curly
braces "{"~"}", parentheses "("~")", commas, and/or white space. Bracketing
all the data with square brackets "[ ]" will significantly speed up the rate
at which the data is read, but there are system-dependent limits on how much
data \TeX{} can read like this in one chunk. (The "[" \emph{must} go at the
beginning of a line.) The file should not contain anything else (not even
"\endinput"), except for comments marked with "%".

\n\fileplot{} only recognizes the "line", "polygon" and "dots" plot styles, and
it ignores the \p{arrows}, \p{linearc} and \p{showpoints} parameters. The
\n\listplot{} command, described below, can also plot data from file, without
these restrictions and with faster \TeX{} processing. However, you are less
likely to exceed PostScript's memory or operand stack limits with \n\fileplot.

If you find that it takes \TeX{} a long time to process your \n\fileplot\
command, you may want to use the \n\PSTtoEPS{} command described on page
\pageref{+PSTtoEPS}. This will also reduce \TeX's memory requirements.

\oitem  \dataplot{commands}

\n\dataplot{} is also for plotting lists of data generated by other programs,
but you first have to retrieve the data with one of the following commands:
\begin{Ex}
  \object  \savedata{command}[data]
  \object  \readdata{command}{file}
\end{Ex}
<data> or the data in <file> should conform to the rules described above for
the data in \n\fileplot{} (with \n\savedata, the data must be delimited by
"["~"]", and with \n\readdata, bracketing the data with "["~"]" speeds things
up). You can concatenate and reuse lists, as in
\begin{LVerb}
  \readdata{\foo}{foo.data}
  \readdata{\bar}{bar.data}
  \dataplot{\foo\bar}
  \dataplot[origin={0,1}]{\bar}
\end{LVerb}

The \n\readdata{} and \n\dataplot{} combination is faster than \n\fileplot{}
if you reuse the data. \n\fileplot{} uses less of \TeX's memory than
\n\readdata{} and \n\dataplot{} if you are also use \n\PSTtoEPS.

Here is a plot of "Integral(sin(x))". The data was generated by Mathematica,
with
\begin{LVerb}
  Table[{x,N[SinIntegral[x]]},{x,0,20}]
\end{LVerb}
and then copied to this document.
\begin{MEx}(4,3)
  \psset{xunit=.2cm,yunit=1.5cm}
  \savedata{\mydata}[
    {{0, 0}, {1., 0.946083}, {2., 1.60541}, {3., 1.84865}, {4., 1.7582},
    {5., 1.54993}, {6., 1.42469}, {7., 1.4546}, {8., 1.57419},
    {9., 1.66504}, {10., 1.65835}, {11., 1.57831}, {12., 1.50497},
    {13., 1.49936}, {14., 1.55621}, {15., 1.61819}, {16., 1.6313},
    {17., 1.59014}, {18., 1.53661}, {19., 1.51863}, {20., 1.54824}}]
  \dataplot[plotstyle=curve,showpoints=true,
    dotstyle=triangle]{\mydata}
  \psline{<->}(0,2)(0,0)(20,0)
\end{MEx}

\oitem  \listplot{list}

\n\listplot{} is yet another way of plotting lists of data. This time, <list>
should be a list of data (coordinate pairs), delimited only by white space.
<list> is first expanded by \TeX{} and then by PostScript. This means that
<list> might be a PostScript program that leaves on the stack a list of data,
but you can also include data that has been retrieved with \n\readdata{} and
\n\dataplot. However, when using the "line", "polygon" or "dots" plotstyles
with \p{showpoints=false}, \p{linearc=0pt} and no arrows, \n\dataplot{} is much
less likely than \n\listplot{} to exceed PostScript's memory or stack limits.
In the preceding example, these restrictions were not satisfied, and so the
example is equivalent to when \n\listplot{} is used:
\begin{LVerb}
  ...
  \listplot[plotstyle=curve,showpoints=true,
    dotstyle=triangle]{\mydata}
  ...
\end{LVerb}

\oitem  \psplot{$x_!\min@$}{$x_!\max@$}{function}

  \n\psplot{} can be used to plot a function $f(x)$, if you know a little
PostScript.  <function> should be the PostScript code for calculating $f(x)$.
Note that you must use $x$ as the dependent variable. PostScript is not
designed for scientific computation, but \n\psplot{} is good for graphing
simple functions right from within \TeX. E.g.,
\begin{LVerb}
  \psplot[plotpoints=200]{0}{720}{x sin}
\end{LVerb}
plots $\sin(x)$ from 0 to 720 degrees, by calculating $\sin(x)$ roughly every
3.6 degrees and then connecting the points with \n\psline. Here are plots of
$\sin(x)\cos((x/2)^2)$ and $\sin^2(x)$:
\begin{MEx}[0,-1](4,1)
  \psset{xunit=1.2pt}
  \psplot[linecolor=gray,linewidth=1.5pt,plotstyle=curve]%
    {0}{90}{x sin dup mul}
  \psplot[plotpoints=100]{0}{90}{x sin x 2 div 2 exp cos mul}
  \psline{<->}(0,-1)(0,1)
  \psline{->}(100,0)
\end{MEx}

\oitem  \parametricplot{$t_!\min@$}{$t_!\max@$}{function}

This is for a parametric plot of $(x(t),y(t))$. <function> is the PostScript
code for calculating the pair $x(t)$ $y(t)$.

For example,
\begin{MEx*}(3,3)
  \parametricplot[plotstyle=dots,plotpoints=13]%
    {-6}{6}{1.2 t exp 1.2 t neg exp}
\end{MEx*}
plots 13 points from the hyperbola $xy=1$, starting with $(1.2^{-6},1.2^6)$
and ending with $(1.2^6,1.2^{-6})$.

Here is a parametric plot of $(\sin(t),\sin(2t))$:
\begin{MEx}[-2,-1](2,1)
  \psset{xunit=1.7cm}
  \parametricplot[linewidth=1.2pt,plotstyle=ccurve]%
    {0}{360}{t sin t 2 mul sin}
  \psline{<->}(0,-1.2)(0,1.2)
  \psline{<->}(-1.2,0)(1.2,0)
\end{MEx}

\end{description}

The number of points that the \n\psplot{} and \n\parametricplot{} commands
calculate is set by the
\begin{Ex}
  \Par{plotpoints=int}
\end{Ex}
parameter. Using "curve" or its variants instead of "line" and increasing the
value of \p{plotpoints} are two ways to get a smoother curve. Both ways
increase the imaging time. Which is better depends on the complexity of the
computation. (Note that all PostScript lines are ultimately rendered as a
series (perhaps short) line segments.)  Mathematica generally uses "lineto" to
connect the points in its plots. The default minimum number of plot points for
Mathematica is 25, but unlike \n\psplot{} and \n\parametricplot, Mathematica
increases the sampling frequency on sections of the curve with greater
fluctuation.

\endinput

%% END psd-basi.tex