Before you use "\dataplot", you have to read the data in using either command "\savedata {command} [data]" or "\readdata {command} [datafile]". At this time someone may ask "dataplot have to take two steps to finish the thing which fileplot takes only one step. Is there the necessity of its existance?" The answer is "yes". Because if you reuse the data, the combination of "\readdata" and "\dataplot" is much faster as the data file is read only one time.
Now let us come to an example of "\dataplot".
\documentclass{article} \usepackage{pstricks} \usepackage{pst-plot} \begin{document} \psset{xunit=2cm,yunit=1.5cm} \begin{pspicture}(-1.25,-1)(3.25,1.25) \savedata{\mydatasinexp}% [{0.,0.},{0.05,0.456044},{0.1,0.761394}, {0.15,0.858552},{0.2,0.74447},{0.25,0.466091}, {0.3,0.104544},{0.35,-0.247193},{0.4,-0.5073}, {0.45,-0.623301},{0.5,-0.581617},{0.55,-0.407061}, {0.6,-0.153346},{0.65,0.112302},{0.7,0.32625}, {0.75,0.44308},{0.8,0.444547},{0.85,0.341285}, {0.9,0.167555},{0.95,-0.029064},{1.,-0.200134}, {1.05,-0.307839},{1.1,-0.332868},{1.15,-0.2772}, {1.2,-0.161613},{1.25,-0.0190015},{1.3,0.114509}, {1.35,0.208373},{1.4,0.244281},{1.45,0.219299}, {1.5,0.145099},{1.55,0.0438223},{1.6,-0.0581267}, {1.65,-0.136698},{1.7,-0.175631},{1.75,-0.169538}, {1.8,-0.124137},{1.85,-0.0538507},{1.9,0.0224169}, {1.95,0.0861526},{2.,0.123554},{2.05,0.128327}, {2.1,0.102454},{2.15,0.0549385},{2.2,-0.000980753}, {2.25,-0.0513478},{2.3,-0.0848411}, {2.35,-0.0951862},{2.4,-0.0821522},{2.45,-0.0510304}, {2.5,-0.0108641},{2.55,0.0280359},{2.6,0.0566379}, {2.65,0.0691928},{2.7,0.0642737},{2.75,0.0447009}, {2.8,0.0164738},{2.85,-0.012943},{2.9,-0.0365153}, {2.95,-0.0492533},{3.,-0.0491912},{3.05,-0.0375617}, {3.1,-0.0182016}] \readdata{\mydataexp}{dataexp.dat} \psaxes{->}(0,0)(0,-1)(3.25,1.25) \dataplot[plotstyle=curve,linecolor=red] {\mydatasinexp} \dataplot[plotstyle=dots,linecolor=blue, dotsize=2.5pt]{\mydatasinexp} \dataplot[plotstyle=curve,linecolor=cyan] {\mydataexp} \end{pspicture} \end{document}
And data file "mydataexp.dat" contains the following datas:
[{0.,1.},{0.05,0.951229},{0.1,0.904837}, {0.15,0.860708},{0.2,0.818731},{0.25,0.778801}, {0.3,0.740818},{0.35,0.704688},{0.4,0.67032}, {0.45,0.637628},{0.5,0.606531},{0.55,0.57695}, {0.6,0.548812},{0.65,0.522046},{0.7,0.496585}, {0.75,0.472367},{0.8,0.449329},{0.85,0.427415}, {0.9,0.40657},{0.95,0.386741},{1.,0.367879}, {1.05,0.349938},{1.1,0.332871},{1.15,0.316637}, {1.2,0.301194},{1.25,0.286505},{1.3,0.272532}, {1.35,0.25924},{1.4,0.246597},{1.45,0.23457}, {1.5,0.22313},{1.55,0.212248},{1.6,0.201897}, {1.65,0.19205},{1.7,0.182684},{1.75,0.173774}, {1.8,0.165299},{1.85,0.157237},{1.9,0.149569}, {1.95,0.142274},{2.,0.135335},{2.05,0.128735}, {2.1,0.122456},{2.15,0.116484},{2.2,0.110803}, {2.25,0.105399},{2.3,0.100259},{2.35,0.0953692}, {2.4,0.090718},{2.45,0.0862936},{2.5,0.082085}, {2.55,0.0780817},{2.6,0.0742736},{2.65,0.0706512}, {2.7,0.0672055},{2.75,0.0639279},{2.8,0.0608101}, {2.85,0.0578443},{2.9,0.0550232},{2.95,0.0523397}, {3.,0.0497871},{3.05,0.0473589},{3.1,0.0450492}]
The plotted picture looks like this one:
Fig.1 An example of dataplot |
The last data plotting command is "\listplot[parameters]{list}". And it has a similar usage as "dataplot", so no example of this command is provided. When using this command data can only delimited by white space.
Files download: tex ps pdf
No comments:
Post a Comment