Debian Codegraph @

texmf-dist/doc/latex/visualpstricks/Source/graph2.tex

raw
1
2 \psset{llx=-1.5cm,lly=-.5cm,urx=.5cm,ury=0.5cm,fillstyle=none}
3
4 \subsection{Macro fileplot , psfileplot \cite{pst-user} \cite{pst-plot}}
5
6 \TFRGB{Syntaxe}{syntax} : \BSS{fileplot} [Options] \AC{\TFRGB{fichier}{file}} ou \BSS{psfileplot} [Options] \AC{\TFRGB{fichier}{file}} \BSI{psfileplot}{pst-plot}
7
8 \bigskip
9
10
11 \begin{tabular}{|l|}
12 \hline
13 \psset{xunit=.015cm,yunit=30cm}
14
15 \begin{pspicture}(-1cm,-1cm)(748,.13)
16 \psaxes[Dx=100,Dy=.02]{->}(748,.13)
17 \fileplot[linecolor=red,linewidth=2pt]{mesdata.dat}
18 \end{pspicture}
19 \\ \hline
20
21 \BSS{fileplot}[linecolor=red,linewidth=2pt]\AC{mesdata.dat} \BSI{fileplot}{pst-plot}
22
23 \\ \hline
24 option plotstyle : \TFRGB{seulement}{only} \hspace{1cm} \og line \fg \hspace{1cm} \og polygon \fg \hspace{1cm}\og dots \fg \\
25 \TFRGB{Séparateurs de données}{Separators of data} : \hspace{1cm} \og \AC{} \fg \hspace{1cm} \og () \fg \hspace{1cm} \og , \fg \hspace{1cm} \og \TFRGB{espace}{space} \fg
26 \\ \hline
27 \end{tabular}
28
29 %------------------
30
31 \subsection{Macro dataplot , psdataplot}
32
33 \TFRGB{Syntaxe}{syntax} : \BSS{dataplot} [Options] \AC{\BS{}macro} ou \BSS{psdataplot} [Options] \AC{\BS{}macro}
34
35 \BSI{dataplot}{pst-plot} \BSI{psdataplot}{pst-plot}
36
37 \TFRGB{Elle doit être précédé de}{It must be preceded by } : \BSS{readdata}\AC{\BS{}macro}\AC{nomfichier}
38 \BSI{readdata}{pst-plot}
39 \bigskip
40
41
42
43
44 \begin{center}
45 \begin{tabular}{|l|} \hline
46
47 \begin{psgraph}[axesstyle=frame,xticksize=0 4cm,yticksize=0 9cm,subticks=0,Dx=100,dy=.01,Dy=.2](0,0)(750,.12){9cm}{4cm}
48 \readdata{\dat}{mesdata.dat}
49 \dataplot[linecolor=red,linewidth=2pt]{\dat}
50 \end{psgraph}\\ \hline
51 \textbf{\BS{}readdata}\AC{{\red \BS{}dat}}\AC{mesdata.dat} \\
52 \textbf{\BS{dataplot}}[linecolor=red,linewidth=2pt]\AC{{\red \BS{}dat}}
53
54 \\\hline
55 \end{tabular}
56 \end{center}
57
58
59 \subsection{Macro savedata}
60
61
62 \TFRGB{Syntaxe}{syntax} : \BSS{savedata}\AC{\BS{}macro}[données en XY]
63 \BSI{savedata}{pst-plot}
64
65 \bigskip
66
67 \textbf{\BS{}savedata}\AC{\BS{}mydata}[\AC{x0, y0}, \AC{x1., y1}, .... \AC{xn., yn}]
68
69
70 \newpage
71 \subsection{Macro listplot , pslistplot}
72
73
74 \TFRGB{Syntaxe}{syntax} : \BSS{listplot}\AC{data} \BSS{pslistplot}\AC{data}
75 \BSI{listplot}{pst-plot} \BSI{pslistplot}{pst-plot}
76
77 \bigskip
78
79
80 \begin{center}
81 \begin{tabular}{|l|} \hline
82 \psset{llx=-1cm,lly=-1cm,urx=.5cm,ury=0.5cm}
83 \begin{psgraph}[axesstyle=frame,xticksize=0 4cm,yticksize=0 9cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){9cm}{4cm}
84 \readdata{\dat}{mesdata.dat}
85 \listplot[plotstyle=curve,showpoints=true,dotstyle=triangle]{\dat}
86 \end{psgraph} \\ \hline
87 \textbf{\BS{}listplot}[plotstyle=curve,showpoints=true,dotstyle=triangle]\AC{\BS{}dat} \\ \hline
88 \TFRGB{liste des coordonnées séparées que par des espaces blancs}{separator of data : space only} !
89 \\ \hline
90 \end{tabular}
91 \end{center}
92
93
94 \bigskip
95 %=====================================================
96 \SbSSCT{\'Echelle des données}{Scale factor}
97
98 \BSS{pstScalePoints}(\TFRGB{facteur échelle X,facteur échelle Y}{X scale factor , Y scale factor})\AC{\TFRGB{code calcul postscript sur X}{PostScript code applied to the x values}}\AC{\TFRGB{code calcul postscript sur Y}{PostScript code applied to the Y values} }
99 \BSI{pstScalePoints}{pst-plot}
100 \bigskip
101
102
103 \begin{center}
104 \begin{tabular}{|l|} \hline
105 \readdata{\dat}{mesdata.dat}
106 \psset{llx=-.5cm,lly=-.5cm,urx=.5cm,ury=0.5cm}
107 \begin{psgraph}[axesstyle=frame,xticksize=0 4cm,yticksize=0 9cm,subticks=0,Dx=100,dy=1,Dy=2](0,0)(750,12){9cm}{4cm}
108 \pstScalePoints(1,100){}{}
109 \listplot[linecolor=red,linewidth=2pt]{\dat}
110 \end{psgraph} \\\hline
111 \BSS{pstScalePoints}({\red 1,100})\AC{}\AC{} \\ \hline
112 \multicolumn{1}{|c|}{\cyan \TFRGB{ne fonctionne qu'avec \BS{listplot} et \BS{pslistplot}{Only work with \BS{listplot} and \BS{pslistplot}! }}} \\ \hline
113 \end{tabular}
114 \end{center}
115
116 %----------------------------------------------------------------------------------------
117 \SbSSCT{Options de lecture de fichier}{Options reading the file of data}
118
119
120
121 \begin{tabular}{|c|c|} \hline
122 \psset{llx=-1cm}
123 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){5cm}{3cm}
124 \readdata[ignoreLines=100]{\dat}{mesdata.dat}
125 \listplot[plotstyle=line,linecolor=blue,linewidth=2pt ]{\dat}
126 \end{psgraph}
127 &
128 \readdata{\dat}{mesdata.dat}
129 \psset{llx=-1cm}
130 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){5cm}{3cm}
131 \listplot[plotstyle=curve,linestyle=dotted,linewidth=1pt ]{\dat}
132 \listplot[plotstyle=dots,linecolor=red,nStep=100,dotscale=2]{\dat}
133 \end{psgraph} \\ \hline
134 \RDD{ignoreLines}=100 \RDI{ignoreLines}{pst-plot} & \RDD{nStep}=100 \RDI{nStep}{pst-plot} \\ \hline
135
136
137 \end{tabular}
138
139
140 \bigskip
141 \begin{tabular}{|c|c|} \hline
142 \psset{llx=-1cm}
143 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){5cm}{3cm}
144 \listplot[plotstyle=curve,linestyle=dotted,linewidth=1pt ]{\dat}
145 \listplot[plotstyle=dots,linecolor=red,xStep=100,dotscale=2]{\dat}
146 \end{psgraph}
147 &
148 \psset{llx=-1cm}
149 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(350,.12){5cm}{3cm}
150
151 \listplot[plotstyle=curve,linestyle=dotted,linewidth=1pt ,xEnd=300]{\dat}
152 \listplot[plotstyle=dots,linecolor=red,yStep=0.02,dotscale=2,xEnd=300]{\dat}
153 \end{psgraph} \\ \hline
154 \RDD{xStep}=100 \RDI{xStep}{pst-plot}& \RDD{yStep}=0.02,xEnd=300 \RDI{yStep}{pst-plot} \\ \hline
155 \end{tabular}
156
157 %----------------------------------------------------------------------------------
158
159 \SbSSCT{Table de données multiples}{Multiple data table}
160
161
162 \TFRGB{Soit une table de données est organisée ainsi}{The data table has 4 columns of data } :
163
164 \smallskip
165
166 \begin{center}
167 \begin{tabular}{|c|c|c|c|}
168 \hline A & B & C & B \\
169 \hline & & & \\
170 \hline & & & \\
171 \hline
172 \end{tabular}
173 \end{center}
174 \bigskip
175
176 \begin{tabular}{|l @{:} l |}
177 \hline
178 \multicolumn{2}{|c|}{ \BS{listplot}[\RDD{plotNoMax}=3,\RDD{plotNoX=2},\RDD{plotNo}=2]\AC{\BS{data}}
179 \RDI{plotNoMax}{pst-plot} \RDI{plotNoX}{pst-plot}
180 \RDI{plotNo}{pst-plot}
181 }
182
183 \\ \hline
184 plotNoX=2 & \TFRGB{ la colonne B correspond à X}{ X values on column B} \\
185 plotNoMax=3 & \TFRGB{ soit 2 colonnes y + 1 colonne x}{ 1 columm with x values + 2 columms with y values} \\
186 plotNo=2 & \TFRGB{ la colonne C correspond à Y}{ Y values on column C} \\ \hline
187 \end{tabular}
188
189 \newpage
190 \subsection{Macro sur Excel}
191 \TFRGB{Voici un programme en Visual Basic permettant de créer son fichier de données d'après une feuille Excel}{Here is a Visual Basic program to create a data file from an Excel spreadsheet}
192
193
194 \bigskip
195
196 \psframebox{\parbox[c]{\linewidth}{
197
198 Sub mesdata() \\
199 deb = 8 \hspace{2cm} ' \TFRGB{première ligne de données}{first line of data} \\
200 fin = 382 \hspace{2cm} ' \TFRGB{dernière ligne de données}{last line of data} \\
201 colX = 5 \hspace{2cm} ' \TFRGB{colonne des valeurs de X}{column of the values X} \\
202 colY = 6 \hspace{2cm} ' \TFRGB{colonne des valeurs de Y}{column of the values Y} \\
203 nom = "mesdata.dat" \hspace{1cm} ' \TFRGB{nom du fichier}{name of the file} \\
204
205 Dim valX, valY As Double \\
206
207 '\TFRGB{pour effacer le fichier}{to erase the file} \\
208 Open nom For Output Access Write As \#1 \\
209 Close \#1 \\
210
211 '\TFRGB{création du fichier}{creation of the file} \\
212 For i = deb To fin \\
213 Open nom For Append As \#1 \\
214 valX = Cells(i, colX) \\
215 valY = Cells(i, colY) \\
216
217 Write \#1, valX \\
218 Write \#1, valY \\
219 Close \#1 \\
220 Next \\
221
222 End Sub}} \\
223
224 \TFRGB{A copier dans un module Excel et modifier les paramètres}{copy this code in a module Excel and modify the parameters} deb, fin , colX, colY et nom
225
226