comparison scripts/plot/__go_draw_axes__.m @ 7213:4612ef369abb

[project @ 2007-11-29 01:57:10 by jwe]
author jwe
date Thu, 29 Nov 2007 01:57:11 +0000
parents 6e4ceeeb1940
children 66081694ffb8
comparison
equal deleted inserted replaced
7212:720c2b4271f8 7213:4612ef369abb
250 xminp = yminp = zminp = cminp = Inf; 250 xminp = yminp = zminp = cminp = Inf;
251 xmax = ymax = zmax = cmax = -Inf; 251 xmax = ymax = zmax = cmax = -Inf;
252 xmin = ymin = zmin = cmin = Inf; 252 xmin = ymin = zmin = cmin = Inf;
253 253
254 ## This has to be done here as some of the code below depends on the 254 ## This has to be done here as some of the code below depends on the
255 ## final clim 255 ## final clim.
256 if (cautoscale) 256 if (cautoscale)
257 for i = 1:length (kids) 257 for i = 1:length (kids)
258 obj = get (kids(i)); 258 obj = get (kids(i));
259 if (isfield (obj, "cdata")) 259 if (isfield (obj, "cdata"))
260 [cmin, cmax, cminp] = get_data_limits (cmin, cmax, cminp, 260 cdat = obj.cdata(:);
261 obj.cdata(:)); 261 [cmin, cmax, cminp] = get_data_limits (cmin, cmax, cminp, cdat);
262 endif 262 endif
263 endfor 263 endfor
264 if (cmin == cmax) 264 if (cmin == cmax)
265 cmax = cmin + 1; 265 cmax = cmin + 1;
266 endif 266 endif
422 xudat = obj.xudata; 422 xudat = obj.xudata;
423 if (! isempty (xudat)) 423 if (! isempty (xudat))
424 xudat = xudat(:); 424 xudat = xudat(:);
425 endif 425 endif
426 if (yerr) 426 if (yerr)
427 ylo = ydat-ldat; 427 if (isempty (ldat))
428 yhi = ydat+udat; 428 ylo = ydat;
429 else
430 ylo = ydat-ldat;
431 endif
432 if (isempty (udat))
433 yhi = ydat;
434 else
435 yhi = ydat+udat;
436 endif
429 if (yautoscale) 437 if (yautoscale)
430 ty = [ydat; ylo; yhi]; 438 ty = [ydat; ylo; yhi];
431 [ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ty); 439 [ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ty);
432 endif 440 endif
433 if (xerr) 441 if (xerr)
434 xlo = xdat-xldat; 442 if (isempty (xldat))
435 xhi = xdat+xudat; 443 xlo = xdat;
444 else
445 xlo = xdat-xldat;
446 endif
447 if (isempty (xudat))
448 xhi = xdat;
449 else
450 xhi = xdat+xudat;
451 endif
436 if (xautoscale) 452 if (xautoscale)
437 tx = [xdat; xlo; xhi]; 453 tx = [xdat; xlo; xhi];
438 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, tx); 454 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, tx);
439 endif 455 endif
440 data{data_idx} = [xdat, ydat, xlo, xhi, ylo, yhi]'; 456 data{data_idx} = [xdat, ydat, xlo, xhi, ylo, yhi]';
441 usingclause{data_idx} = "using ($1):($2):($3):($4):($5):($6)"; 457 usingclause{data_idx} = "using ($1):($2):($3):($4):($5):($6)";
442 withclause{data_idx} = "with xyerrorbars"; 458 withclause{data_idx} = "with xyerrorbars";
443 else 459 else
444 ## Obtain the limits based on the exact x values.
445 if (xautoscale) 460 if (xautoscale)
446 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, 461 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, xdat);
447 xminp, xdat);
448 endif 462 endif
449 data{data_idx} = [xdat, ydat, ylo, yhi]'; 463 data{data_idx} = [xdat, ydat, ylo, yhi]';
450 usingclause{data_idx} = "using ($1):($2):($3):($4)"; 464 usingclause{data_idx} = "using ($1):($2):($3):($4)";
451 withclause{data_idx} = "with yerrorbars"; 465 withclause{data_idx} = "with yerrorbars";
452 endif 466 endif
453 elseif (xerr) 467 elseif (xerr)
454 xlo = xdat-xldat; 468 if (isempty (xldat))
455 xhi = xdat+xudat; 469 xlo = xdat;
470 else
471 xlo = xdat-xldat;
472 endif
473 if (isempty (xudat))
474 xhi = xdat;
475 else
476 xhi = xdat+xudat;
477 endif
456 if (xautoscale) 478 if (xautoscale)
457 tx = [xdat; xlo; xhi]; 479 tx = [xdat; xlo; xhi];
458 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, tx); 480 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, tx);
459 endif 481 endif
460 if (yautoscale) 482 if (yautoscale)
461 [ymin, ymax, yminp] = get_data_limits (ymin, ymax, 483 [ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ydat);
462 yminp, ydat, ty);
463 endif 484 endif
464 data{data_idx} = [xdat, ydat, xlo, xhi]'; 485 data{data_idx} = [xdat, ydat, xlo, xhi]';
465 usingclause{data_idx} = "using ($1):($2):($3):($4)"; 486 usingclause{data_idx} = "using ($1):($2):($3):($4)";
466 withclause{data_idx} = "with xerrorbars"; 487 withclause{data_idx} = "with xerrorbars";
467 else 488 else
1253 print_usage (); 1274 print_usage ();
1254 endif 1275 endif
1255 1276
1256 endfunction 1277 endfunction
1257 1278
1258 function [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, xdat, tx) 1279 function [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, xdat)
1259 if (! (isempty (xdat) || (nargin > 4 && isempty (tx)))) 1280 if (! isempty (xdat))
1260 xdat = xdat(! isinf (xdat)); 1281 xdat = xdat(! isinf (xdat));
1261 xmin = min (xmin, min (xdat)); 1282 xmin = min (xmin, min (xdat));
1262 xmax = max (xmax, max (xdat)); 1283 xmax = max (xmax, max (xdat));
1263 if (nargin == 5) 1284 tmp = min (xdat(xdat > 0));
1264 tx = tx(! isinf (xdat) & tx > 0); 1285 if (! isempty (tmp))
1265 if (! isempty (tx)) 1286 xminp = min (xminp, tmp);
1266 xminp = min (xminp, min (tx));
1267 endif
1268 else
1269 tmp = min (xdat(xdat > 0));
1270 if (! isempty (tmp))
1271 xminp = min (xminp, tmp);
1272 endif
1273 endif 1287 endif
1274 endif 1288 endif
1275 endfunction 1289 endfunction
1276 1290
1277 ## Attempt to make "nice" limits from the actual max and min of the 1291 ## Attempt to make "nice" limits from the actual max and min of the