Mercurial > hg > octave-lyh
comparison scripts/plot/subplot.m @ 2296:5f6c19054139
[project @ 1996-06-14 06:41:57 by jwe]
author | jwe |
---|---|
date | Fri, 14 Jun 1996 06:41:57 +0000 |
parents | 5d29638dd524 |
children | 5cffc4b8de57 |
comparison
equal
deleted
inserted
replaced
2295:95d9259a9915 | 2296:5f6c19054139 |
---|---|
55 # ----------------------------------- | 55 # ----------------------------------- |
56 # | 56 # |
57 | 57 |
58 # Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU | 58 # Written by Vinayak Dutt, Dutt.Vinayak@mayo.EDU |
59 | 59 |
60 # global variables to keep track of multiplot options | 60 if (! gnuplot_has_multiplot) |
61 error ("subplot: gnuplot does not appear to support this feature"); | |
62 endif | |
63 | |
64 # global variables to keep track of multiplot options | |
61 | 65 |
62 global multiplot_mode | 66 global multiplot_mode |
63 global multiplot_xsize multiplot_ysize | 67 global multiplot_xsize multiplot_ysize |
64 global multiplot_xn multiplot_yn | 68 global multiplot_xn multiplot_yn |
65 global multiplot_xi multiplot_yi | 69 global multiplot_xi multiplot_yi |
66 | 70 |
67 # This is a real kludge. We gnuplot should be made so that replot can | 71 # This is a real kludge. We gnuplot should be made so that replot can |
68 # be executed while doing multiple plots... | 72 # be executed while doing multiple plots... |
69 | 73 |
70 global multiplot_save_auto_replot = automatic_replot | 74 global multiplot_save_auto_replot = automatic_replot |
71 | 75 |
72 if (nargin != 3 && nargin != 1) | 76 if (nargin != 3 && nargin != 1) |
73 usage ("subplot (rows, columns, index) or subplot (rcn)"); | 77 usage ("subplot (rows, columns, index) or subplot (rcn)"); |
74 endif | 78 endif |
75 | 79 |
76 if ((isstr (automatic_replot) && strcmp (automatic_replot, "true")) | 80 if ((isstr (automatic_replot) && strcmp (automatic_replot, "true")) |
77 || automatic_replot) | 81 || automatic_replot) |
78 warning ("turning off automatic replot for multiplot mode"); | 82 warning ("turning off automatic replot for multiplot mode"); |
79 multiplot_save_auto_replot = automatic_replot; | 83 multiplot_save_auto_replot = automatic_replot; |
80 automatic_replot = 0; | 84 automatic_replot = 0; |
81 endif | 85 endif |
82 | 86 |
109 error ("subplot: columns,rows,index must be be positive"); | 113 error ("subplot: columns,rows,index must be be positive"); |
110 endif | 114 endif |
111 | 115 |
112 if (columns*rows == 1) | 116 if (columns*rows == 1) |
113 | 117 |
114 # switching to single plot ? | 118 # switching to single plot ? |
115 | 119 |
116 set nomultiplot; | 120 set nomultiplot; |
117 set size 1, 1; | 121 set size 1, 1; |
118 set origin 0, 0; | 122 set origin 0, 0; |
119 | 123 |
120 multiplot_xn = 1; | 124 multiplot_xn = 1; |
121 multiplot_yn = 1; | 125 multiplot_yn = 1; |
122 multiplot_mode = 0; | 126 multiplot_mode = 0; |
123 | 127 |
124 # Someone may have reset it betweeen calls... | 128 # Someone may have reset it betweeen calls... |
125 | 129 |
126 if (! isstr (automatic_replot) && ! automatic_replot) | 130 if (! isstr (automatic_replot) && ! automatic_replot) |
127 automatic_replot = multiplot_save_auto_replot; | 131 automatic_replot = multiplot_save_auto_replot; |
128 endif | 132 endif |
129 | 133 |
130 else | 134 else |
131 | 135 |
132 # doing multiplot plots | 136 # doing multiplot plots |
133 | 137 |
134 doagain = 0; | 138 doagain = 0; |
135 | 139 |
136 if (exist ("multiplot_mode") != 1) | 140 if (exist ("multiplot_mode") != 1) |
137 doagain = 1; | 141 doagain = 1; |
152 | 156 |
153 eval (sprintf ("set size %g, %g", multiplot_xsize, multiplot_ysize)); | 157 eval (sprintf ("set size %g, %g", multiplot_xsize, multiplot_ysize)); |
154 | 158 |
155 endif | 159 endif |
156 | 160 |
157 # get the sub plot location | 161 # get the sub plot location |
158 | 162 |
159 yp = fix ((index-1)/columns); | 163 yp = fix ((index-1)/columns); |
160 xp = index - yp*columns - 1; | 164 xp = index - yp*columns - 1; |
161 multiplot_xi = ++xp; | 165 multiplot_xi = ++xp; |
162 multiplot_yi = ++yp; | 166 multiplot_yi = ++yp; |
163 | 167 |
164 # set the origin | 168 # set the origin |
165 | 169 |
166 xo = (xp - 1.0)*multiplot_xsize; | 170 xo = (xp - 1.0)*multiplot_xsize; |
167 yo = (rows - yp)*multiplot_ysize; | 171 yo = (rows - yp)*multiplot_ysize; |
168 | 172 |
169 eval (sprintf ("set origin %g, %g", xo, yo)); | 173 eval (sprintf ("set origin %g, %g", xo, yo)); |