|
108 | 108 | obj.data{contourIndex}.type = 'surface';
|
109 | 109 |
|
110 | 110 | %-contour x and y data
|
111 |
| - [xmesh, ymesh] = meshgrid(xdata, ydata); |
112 |
| - obj.data{contourIndex}.x = xmesh; |
113 |
| - obj.data{contourIndex}.y = ymesh; |
| 111 | + if isvector(xdata) |
| 112 | + [xdata, ydata] = meshgrid(xdata, ydata); |
| 113 | + end |
| 114 | + obj.data{contourIndex}.x = xdata; |
| 115 | + obj.data{contourIndex}.y = ydata; |
114 | 116 |
|
115 | 117 | %-contour z data-%
|
116 | 118 | obj.data{contourIndex}.z = zdata;
|
117 | 119 |
|
118 | 120 | %-setting for contour lines z-direction-%
|
119 |
| - obj.data{contourIndex}.contours.z.start = contour_data.LevelList(1); |
120 |
| - obj.data{contourIndex}.contours.z.end = contour_data.LevelList(end); |
121 |
| - obj.data{contourIndex}.contours.z.size = contour_data.LevelStep; |
| 121 | + if length(contour_data.LevelList) > 1 |
| 122 | + zstart = contour_data.LevelList(1); |
| 123 | + zend = contour_data.LevelList(end); |
| 124 | + zsize = mean(diff(contour_data.LevelList)); |
| 125 | + else |
| 126 | + zstart = contour_data.LevelList(1) - 1e-3; |
| 127 | + zend = contour_data.LevelList(end) + 1e-3; |
| 128 | + zsize = 2e-3; |
| 129 | + end |
| 130 | + l = 30; |
| 131 | + obj.data{contourIndex}.contours.z.start = zstart; |
| 132 | + obj.data{contourIndex}.contours.z.end = zend; |
| 133 | + obj.data{contourIndex}.contours.z.size = zsize; |
122 | 134 | obj.data{contourIndex}.contours.z.show = true;
|
123 | 135 | obj.data{contourIndex}.contours.z.usecolormap = true;
|
| 136 | + obj.data{contourIndex}.contours.z.width = contour_data.LineWidth; |
124 | 137 | obj.data{contourIndex}.hidesurface = true;
|
125 | 138 |
|
126 | 139 | end
|
127 | 140 |
|
128 | 141 | %-------------------------------------------------------------------------%
|
129 | 142 |
|
130 |
| -%-contour x type-% |
| 143 | +if isvector(zdata) |
| 144 | + |
| 145 | + %-contour x type-% |
131 | 146 |
|
132 |
| -obj.data{contourIndex}.xtype = 'array'; |
| 147 | + obj.data{contourIndex}.xtype = 'array'; |
133 | 148 |
|
134 |
| -%-------------------------------------------------------------------------% |
| 149 | + %-------------------------------------------------------------------------% |
135 | 150 |
|
136 |
| -%-contour y type-% |
| 151 | + %-contour y type-% |
137 | 152 |
|
138 |
| -obj.data{contourIndex}.ytype = 'array'; |
| 153 | + obj.data{contourIndex}.ytype = 'array'; |
| 154 | + |
| 155 | +end |
139 | 156 |
|
140 | 157 | %-------------------------------------------------------------------------%
|
141 | 158 |
|
|
150 | 167 |
|
151 | 168 | %-------------------------------------------------------------------------%
|
152 | 169 |
|
153 |
| -%-zauto-% |
154 |
| -obj.data{contourIndex}.zauto = false; |
| 170 | +if isvector(zdata) |
| 171 | + %-zauto-% |
| 172 | + obj.data{contourIndex}.zauto = false; |
155 | 173 |
|
156 |
| -%-------------------------------------------------------------------------% |
| 174 | + %-------------------------------------------------------------------------% |
157 | 175 |
|
158 |
| -%-zmin-% |
159 |
| -obj.data{contourIndex}.zmin = axis_data.CLim(1); |
| 176 | + %-zmin-% |
| 177 | + obj.data{contourIndex}.zmin = axis_data.CLim(1); |
160 | 178 |
|
161 |
| -%-------------------------------------------------------------------------% |
| 179 | + %-------------------------------------------------------------------------% |
162 | 180 |
|
163 |
| -%-zmax-% |
164 |
| -obj.data{contourIndex}.zmax = axis_data.CLim(2); |
| 181 | + %-zmax-% |
| 182 | + obj.data{contourIndex}.zmax = axis_data.CLim(2); |
| 183 | +end |
165 | 184 |
|
166 | 185 | %-------------------------------------------------------------------------%
|
167 | 186 |
|
|
180 | 199 |
|
181 | 200 | %-------------------------------------------------------------------------%
|
182 | 201 |
|
183 |
| -%-autocontour-% |
184 |
| -obj.data{contourIndex}.autocontour = false; |
| 202 | +if isvector(zdata) |
| 203 | + |
| 204 | + %-autocontour-% |
| 205 | + obj.data{contourIndex}.autocontour = false; |
| 206 | + |
| 207 | +end |
185 | 208 |
|
186 | 209 | %-------------------------------------------------------------------------%
|
187 | 210 |
|
188 |
| -%-contour contours-% |
189 |
| - |
190 |
| -%-coloring-% |
191 |
| -switch contour_data.Fill |
192 |
| - case 'off' |
193 |
| - obj.data{contourIndex}.contours.coloring = 'lines'; |
194 |
| - case 'on' |
195 |
| - obj.data{contourIndex}.contours.coloring = 'fill'; |
196 |
| -end |
| 211 | +if isvector(zdata) |
| 212 | + |
| 213 | + %-contour contours-% |
| 214 | + |
| 215 | + %-coloring-% |
| 216 | + switch contour_data.Fill |
| 217 | + case 'off' |
| 218 | + obj.data{contourIndex}.contours.coloring = 'lines'; |
| 219 | + case 'on' |
| 220 | + obj.data{contourIndex}.contours.coloring = 'fill'; |
| 221 | + end |
197 | 222 |
|
198 |
| -%-start-% |
199 |
| -obj.data{contourIndex}.contours.start = contour_data.TextList(1); |
| 223 | + %-start-% |
| 224 | + obj.data{contourIndex}.contours.start = contour_data.TextList(1); |
200 | 225 |
|
201 |
| -%-end-% |
202 |
| -obj.data{contourIndex}.contours.end = contour_data.TextList(end); |
| 226 | + %-end-% |
| 227 | + obj.data{contourIndex}.contours.end = contour_data.TextList(end); |
203 | 228 |
|
204 |
| -%-step-% |
205 |
| -obj.data{contourIndex}.contours.size = diff(contour_data.TextList(1:2)); |
| 229 | + %-step-% |
| 230 | + obj.data{contourIndex}.contours.size = diff(contour_data.TextList(1:2)); |
| 231 | + |
| 232 | +end |
206 | 233 |
|
207 | 234 | %-------------------------------------------------------------------------%
|
208 | 235 |
|
209 |
| -if(~strcmp(contour_data.LineStyle,'none')) |
210 |
| - |
211 |
| - %-contour line colour-% |
212 |
| - if isnumeric(contour_data.LineColor) |
213 |
| - col = 255*contour_data.LineColor; |
214 |
| - obj.data{contourIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']; |
| 236 | +if isvector(zdata) |
| 237 | + if(~strcmp(contour_data.LineStyle,'none')) |
| 238 | + |
| 239 | + %-contour line colour-% |
| 240 | + if isnumeric(contour_data.LineColor) |
| 241 | + col = 255*contour_data.LineColor; |
| 242 | + obj.data{contourIndex}.line.color = ['rgb(' num2str(col(1)) ',' num2str(col(2)) ',' num2str(col(3)) ')']; |
| 243 | + else |
| 244 | + obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)'; |
| 245 | + end |
| 246 | + |
| 247 | + %-contour line width-% |
| 248 | + obj.data{contourIndex}.line.width = contour_data.LineWidth; |
| 249 | + |
| 250 | + %-contour line dash-% |
| 251 | + switch contour_data.LineStyle |
| 252 | + case '-' |
| 253 | + LineStyle = 'solid'; |
| 254 | + case '--' |
| 255 | + LineStyle = 'dash'; |
| 256 | + case ':' |
| 257 | + LineStyle = 'dot'; |
| 258 | + case '-.' |
| 259 | + LineStyle = 'dashdot'; |
| 260 | + end |
| 261 | + |
| 262 | + obj.data{contourIndex}.line.dash = LineStyle; |
| 263 | + |
| 264 | + %-contour smoothing-% |
| 265 | + obj.data{contourIndex}.line.smoothing = 0; |
| 266 | + |
215 | 267 | else
|
216 |
| - obj.data{contourIndex}.line.color = 'rgba(0,0,0,0)'; |
217 |
| - end |
218 |
| - |
219 |
| - %-contour line width-% |
220 |
| - obj.data{contourIndex}.line.width = contour_data.LineWidth; |
221 |
| - |
222 |
| - %-contour line dash-% |
223 |
| - switch contour_data.LineStyle |
224 |
| - case '-' |
225 |
| - LineStyle = 'solid'; |
226 |
| - case '--' |
227 |
| - LineStyle = 'dash'; |
228 |
| - case ':' |
229 |
| - LineStyle = 'dot'; |
230 |
| - case '-.' |
231 |
| - LineStyle = 'dashdot'; |
| 268 | + |
| 269 | + %-contours showlines-% |
| 270 | + obj.data{contourIndex}.contours.showlines = false; |
| 271 | + |
232 | 272 | end
|
233 |
| - |
234 |
| - obj.data{contourIndex}.line.dash = LineStyle; |
235 |
| - |
236 |
| - %-contour smoothing-% |
237 |
| - obj.data{contourIndex}.line.smoothing = 0; |
238 |
| - |
239 |
| -else |
240 |
| - |
241 |
| - %-contours showlines-% |
242 |
| - obj.data{contourIndex}.contours.showlines = false; |
243 |
| - |
244 | 273 | end
|
245 | 274 |
|
246 | 275 | %-------------------------------------------------------------------------%
|
|
0 commit comments