summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/visualpstricks/Source/graph2.tex
blob: d0a5e18f586a139218b451a4026b4f5b4ee79321 (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

\psset{llx=-1.5cm,lly=-.5cm,urx=.5cm,ury=0.5cm,fillstyle=none}

\subsection{Macro  fileplot , psfileplot \cite{pst-user}  \cite{pst-plot}}

\TFRGB{Syntaxe}{syntax} : \BSS{fileplot} [Options] \AC{\TFRGB{fichier}{file}} ou  \BSS{psfileplot} [Options] \AC{\TFRGB{fichier}{file}} \BSI{psfileplot}{pst-plot} 

\bigskip


\begin{tabular}{|l|}
\hline  
\psset{xunit=.015cm,yunit=30cm}

\begin{pspicture}(-1cm,-1cm)(748,.13)
\psaxes[Dx=100,Dy=.02]{->}(748,.13)
\fileplot[linecolor=red,linewidth=2pt]{mesdata.dat}
\end{pspicture}
\\ \hline 

\BSS{fileplot}[linecolor=red,linewidth=2pt]\AC{mesdata.dat} \BSI{fileplot}{pst-plot} 

 \\ \hline 
option plotstyle : \TFRGB{seulement}{only} \hspace{1cm}  \og line \fg \hspace{1cm} \og polygon  \fg  \hspace{1cm}\og dots \fg \\
\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 
 \\ \hline 
\end{tabular} 

%------------------

\subsection{Macro  dataplot , psdataplot}

\TFRGB{Syntaxe}{syntax} :  \BSS{dataplot} [Options] \AC{\BS{}macro} ou \BSS{psdataplot} [Options] \AC{\BS{}macro}

\BSI{dataplot}{pst-plot} \BSI{psdataplot}{pst-plot} 
 
\TFRGB{Elle doit être précédé de}{It must be preceded by }  : \BSS{readdata}\AC{\BS{}macro}\AC{nomfichier}
\BSI{readdata}{pst-plot}
\bigskip
 



\begin{center}
\begin{tabular}{|l|} \hline

 \begin{psgraph}[axesstyle=frame,xticksize=0 4cm,yticksize=0 9cm,subticks=0,Dx=100,dy=.01,Dy=.2](0,0)(750,.12){9cm}{4cm} 
\readdata{\dat}{mesdata.dat}
\dataplot[linecolor=red,linewidth=2pt]{\dat}
\end{psgraph}\\ \hline
\textbf{\BS{}readdata}\AC{{\red \BS{}dat}}\AC{mesdata.dat} \\
\textbf{\BS{dataplot}}[linecolor=red,linewidth=2pt]\AC{{\red \BS{}dat}} 

\\\hline
\end{tabular}
\end{center}


\subsection{Macro  savedata}


\TFRGB{Syntaxe}{syntax} : \BSS{savedata}\AC{\BS{}macro}[données en XY]
\BSI{savedata}{pst-plot}

\bigskip

\textbf{\BS{}savedata}\AC{\BS{}mydata}[\AC{x0, y0}, \AC{x1., y1}, .... \AC{xn., yn}]


\newpage
\subsection{Macro listplot , pslistplot}


\TFRGB{Syntaxe}{syntax} : \BSS{listplot}\AC{data}   \BSS{pslistplot}\AC{data}
\BSI{listplot}{pst-plot} \BSI{pslistplot}{pst-plot}

\bigskip


\begin{center}
\begin{tabular}{|l|} \hline
\psset{llx=-1cm,lly=-1cm,urx=.5cm,ury=0.5cm}
 \begin{psgraph}[axesstyle=frame,xticksize=0 4cm,yticksize=0 9cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){9cm}{4cm} 
\readdata{\dat}{mesdata.dat}
\listplot[plotstyle=curve,showpoints=true,dotstyle=triangle]{\dat}
\end{psgraph} \\ \hline
\textbf{\BS{}listplot}[plotstyle=curve,showpoints=true,dotstyle=triangle]\AC{\BS{}dat} \\ \hline
\TFRGB{liste des coordonnées séparées que par des espaces blancs}{separator of data  :  space only} !
 \\ \hline
\end{tabular}
\end{center}


\bigskip
%=====================================================
\SbSSCT{\'Echelle des données}{Scale factor}

\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} }
\BSI{pstScalePoints}{pst-plot} 
\bigskip


\begin{center}
\begin{tabular}{|l|} \hline
\readdata{\dat}{mesdata.dat}
\psset{llx=-.5cm,lly=-.5cm,urx=.5cm,ury=0.5cm}
 \begin{psgraph}[axesstyle=frame,xticksize=0 4cm,yticksize=0 9cm,subticks=0,Dx=100,dy=1,Dy=2](0,0)(750,12){9cm}{4cm} 
\pstScalePoints(1,100){}{}
\listplot[linecolor=red,linewidth=2pt]{\dat}
\end{psgraph} \\\hline
\BSS{pstScalePoints}({\red 1,100})\AC{}\AC{} \\ \hline
 \multicolumn{1}{|c|}{\cyan \TFRGB{ne fonctionne qu'avec \BS{listplot} et \BS{pslistplot}{Only work with \BS{listplot} and \BS{pslistplot}! }}} \\  \hline  
\end{tabular}
\end{center}
 
%----------------------------------------------------------------------------------------
\SbSSCT{Options de lecture de fichier}{Options  reading the file of data}



\begin{tabular}{|c|c|} \hline
\psset{llx=-1cm}
 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){5cm}{3cm} 
 \readdata[ignoreLines=100]{\dat}{mesdata.dat}
\listplot[plotstyle=line,linecolor=blue,linewidth=2pt ]{\dat}
\end{psgraph}
&
 \readdata{\dat}{mesdata.dat}
 \psset{llx=-1cm}
 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){5cm}{3cm}
\listplot[plotstyle=curve,linestyle=dotted,linewidth=1pt ]{\dat}
\listplot[plotstyle=dots,linecolor=red,nStep=100,dotscale=2]{\dat}
\end{psgraph} \\  \hline
\RDD{ignoreLines}=100  \RDI{ignoreLines}{pst-plot} & \RDD{nStep}=100  \RDI{nStep}{pst-plot} \\ \hline
 

\end{tabular}


\bigskip
\begin{tabular}{|c|c|} \hline
\psset{llx=-1cm}
 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(750,.12){5cm}{3cm} 
\listplot[plotstyle=curve,linestyle=dotted,linewidth=1pt ]{\dat}
\listplot[plotstyle=dots,linecolor=red,xStep=100,dotscale=2]{\dat}
\end{psgraph}
&
\psset{llx=-1cm}
 \begin{psgraph}[axesstyle=frame,xticksize=0 3cm,yticksize=0 5cm,subticks=0,Dx=100,Dy=.02](0,0)(350,.12){5cm}{3cm}
  
\listplot[plotstyle=curve,linestyle=dotted,linewidth=1pt ,xEnd=300]{\dat}
\listplot[plotstyle=dots,linecolor=red,yStep=0.02,dotscale=2,xEnd=300]{\dat}
\end{psgraph} \\  \hline
\RDD{xStep}=100  \RDI{xStep}{pst-plot}& \RDD{yStep}=0.02,xEnd=300  \RDI{yStep}{pst-plot} \\ \hline
\end{tabular}

%----------------------------------------------------------------------------------

\SbSSCT{Table de données multiples}{Multiple data table}


\TFRGB{Soit une table de données est organisée ainsi}{The data table has 4 columns of data } :

\smallskip

\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline  A & B & C & B \\ 
\hline  &  &  &  \\ 
\hline  &  &  &  \\ 
\hline 
\end{tabular} 
\end{center}
\bigskip

\begin{tabular}{|l @{:} l |}
\hline 
\multicolumn{2}{|c|}{ \BS{listplot}[\RDD{plotNoMax}=3,\RDD{plotNoX=2},\RDD{plotNo}=2]\AC{\BS{data}}  
\RDI{plotNoMax}{pst-plot}  \RDI{plotNoX}{pst-plot} 
 \RDI{plotNo}{pst-plot} 
} 

\\ \hline 
plotNoX=2 & \TFRGB{ la colonne B correspond à X}{ X values on  column B} \\
plotNoMax=3 & \TFRGB{ soit 2 colonnes y + 1 colonne x}{ 1 columm with x values + 2 columms with y values} \\ 
plotNo=2  & \TFRGB{ la colonne C correspond à Y}{ Y values on  column C} \\  \hline 
\end{tabular} 

\newpage
\subsection{Macro sur Excel}
\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}


\bigskip

\psframebox{\parbox[c]{\linewidth}{

Sub mesdata() \\
deb = 8      \hspace{2cm}        ' \TFRGB{première ligne de données}{first line of data} \\
fin = 382     \hspace{2cm}         ' \TFRGB{dernière ligne de données}{last line of data} \\
colX = 5       \hspace{2cm}        ' \TFRGB{colonne des valeurs de X}{column of the values  X} \\
colY = 6        \hspace{2cm}       ' \TFRGB{colonne des valeurs de Y}{column of the values  Y} \\
nom = "mesdata.dat"  \hspace{1cm}  ' \TFRGB{nom du fichier}{name of the file} \\

Dim valX, valY As Double \\

'\TFRGB{pour effacer le fichier}{to erase the file} \\
Open nom For Output Access Write As \#1 \\
Close \#1 \\

'\TFRGB{création du fichier}{creation of the file} \\
For i = deb To fin \\
Open nom For Append As \#1 \\
valX = Cells(i, colX) \\
valY = Cells(i, colY) \\

Write \#1, valX \\
Write \#1, valY \\
Close \#1 \\
Next \\

End Sub}} \\

\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