summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pstricks/examples/filetest.tex
blob: 52ac7732d2b4d98e55a1fead84bb280abfd16cf0 (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
%% BEGIN filetest.tex
%
% This is test file for some of the PSTricks commands that
% read from and write to files.
%
% Run with plain tex.
%
% You must have the epsf.tex macros, which are distributed with
% Rokicki's dvips, and change the reference to \epsf below.
%
% This inputs filetest.raw, filetest.dat and filetest.eps.
% It also write filetest.eps.
%
% If  using Rokicki's dvips v5.47 or later, try
%
%   dvips filetest -E-o
%
% to create an eps file filetest.ps from the whole picture.

\input pstricks
\input pst-eps
\input pst-plot
\input epsf

\TeXtoEPS   % Make an EPS picture out of .dvi file, with dvips -E.
  \pspicture(-5,-10)(10,10)

    % Test two similar ways to use data from a file:
    % \fileplot
    \AltClipMode
    \psclip{\psframe[linestyle=none](0,-10)(10,10)}
      \pscustom{%
        \fileplot{filetest.dat}
        \gsave
          \lineto(100,100)
          \lineto(0,100)
          \closedshadow
        \grestore}
    \endpsclip

    \psaxes(0,0)(-5,-10)(10,10)

    % And \readdata and \dataplot:
    \readdata\mydata{filetest.dat}
    \dataplot[plotstyle=dots,swapaxes=true]{\mydata}

    % Save some data:

    \savedata{\total}[
      {{0,163},{1,187},{2,166},{3,232},{4,237},{5,201},{6,196},{7,203}}]
    \savedata{\general}[
      {7,193}{6,182}{5,167}{4,153}{3,129}{2,108}{1,101}{0,104}]

    % Now make an EPS file from the graphics objects:
    \PSTtoEPS[bbury=5cm,bburx=10.5cm,
      bblly=2cm,bbllx=0cm,makeeps=all]{filetest.eps}{%

      % Now when I concatenate \total and \general, I get the points that
      % delineate the boundary for the area you want to fill.

      \psyunit=.02cm
      \psxunit=1.5cm

      \pscustom[plotstyle=curve,linestyle=none,fillstyle=solid,
        fillcolor=gray]{\listplot{\general}\listplot[liftpen=1]{\total}}
      \psset{plotstyle=curve,showpoints=true,dotscale=1.5}
      \listplot[dotstyle=pentagon*]{\total}
      \listplot[dotstyle=triangle]{\general}
    } % end \PSTtoEPS

    % Now use the EPS file just created:
    \rput[bl](-1,-10){\psdblframebox{\epsffile{filetest.eps}}}

    % Now try inputting raw ps code with \pscustom:
    \pscustom[shadowsize=5pt,origin={5,4}]{%
      \file{filetest.raw}
      \closepath
      \closedshadow}

  \endpspicture
\endTeXtoEPS

\bye
%% END filetest.tex