Mercurial > octave-antonio
comparison scripts/plot/__go_draw_axes__.m @ 7020:e31f12bb9194
[project @ 2007-10-13 05:13:28 by dbateman]
author | dbateman |
---|---|
date | Sat, 13 Oct 2007 05:13:29 +0000 |
parents | a1dbe9d80eee |
children | 033918b854a7 |
comparison
equal
deleted
inserted
replaced
7019:4270ded9ddc6 | 7020:e31f12bb9194 |
---|---|
424 warning ("gnuplot (as of v4.2) supports only 2D patches, ignoring z values") | 424 warning ("gnuplot (as of v4.2) supports only 2D patches, ignoring z values") |
425 endif | 425 endif |
426 nd = 2; | 426 nd = 2; |
427 cmap = parent_figure_obj.colormap; | 427 cmap = parent_figure_obj.colormap; |
428 clim = axis_obj.clim; | 428 clim = axis_obj.clim; |
429 data_idx++; | 429 [nr, nc] = size (obj.xdata); |
430 is_image_data(data_idx) = false; | 430 |
431 parametric(data_idx) = false; | 431 for i = 1 : nc |
432 titlespec{data_idx} = "title \"\""; | 432 xcol = obj.xdata(:,i); |
433 usingclause{data_idx} = ""; | 433 ycol = obj.ydata(:,i); |
434 if (isfield (obj, "facecolor") && isfield (obj, "cdata")) | 434 |
435 if (strncmp (obj.facecolor, "none", 4)) | 435 if (xautoscale) |
436 color = [1, 1, 1]; | 436 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, xcol); |
437 elseif (strncmp (obj.facecolor, "flat", 4)) | 437 endif |
438 r = 1 + round ((size (cmap, 1) - 1) * (obj.cdata - clim(1))/(clim(2) - clim(1))); | 438 if (yautoscale) |
439 r = max (1, min (r, size (cmap, 1))); | 439 [ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ycol); |
440 color = cmap(r,:); | 440 endif |
441 elseif (strncmp (obj.facecolor, "interp", 6)) | 441 |
442 warning ("\"interp\" not supported, using 1st entry of cdata") | 442 if (! isnan (xcol) && ! isnan (ycol)) |
443 r = 1 + round ((size (cmap, 1) - 1) * obj.cdata(1)); | 443 ## Is the patch closed or not |
444 r = max (1, min (r, size (cmap, 1))); | 444 data_idx++; |
445 color = cmap(r,:); | 445 is_image_data(data_idx) = false; |
446 parametric(data_idx) = false; | |
447 titlespec{data_idx} = "title \"\""; | |
448 usingclause{data_idx} = ""; | |
449 if (isfield (obj, "facecolor") && isfield (obj, "cdata")) | |
450 if (strncmp (obj.facecolor, "none", 4)) | |
451 color = [1, 1, 1]; | |
452 | |
453 elseif (strncmp (obj.facecolor, "flat", 4) || | |
454 strncmp (obj.facecolor, "interp", 6)) | |
455 if (ndims (obj.cdata) == 2 && ... | |
456 ((nr > 3 && size (obj.cdata, 2) == nc) ... | |
457 || (size (obj.cdata, 1) > 1 && ... | |
458 size (obj.cdata, 2) == nc))) | |
459 ccol = obj.cdata (:, i); | |
460 elseif (ndims (obj.cdata) == 3) | |
461 ccol = permute (obj.cdata (:, i, :), [1, 3, 2]); | |
462 else | |
463 ccol = obj.cdata; | |
464 endif | |
465 if (strncmp (obj.facecolor, "flat", 4)) | |
466 if (numel(ccol) == 3) | |
467 color = ccol; | |
468 else | |
469 r = 1 + round ((size (cmap, 1) - 1) * ... | |
470 (ccol - clim(1))/(clim(2) - clim(1))); | |
471 r = max (1, min (r, size (cmap, 1))); | |
472 color = cmap(r, :); | |
473 endif | |
474 elseif (strncmp (obj.facecolor, "interp", 6)) | |
475 warning ("\"interp\" not supported, using 1st entry of cdata") | |
476 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); | |
477 r = max (1, min (r, size (cmap, 1))); | |
478 color = cmap(r,:); | |
479 endif | |
480 else | |
481 color = obj.facecolor; | |
482 endif | |
483 else | |
484 color = [0, 1, 0]; | |
485 endif | |
486 | |
487 if (have_newer_gnuplot) | |
488 withclause{data_idx} = ... | |
489 sprintf ("with filledcurve lc rgb \"#%02x%02x%02x\"", ... | |
490 round (255*color)); | |
491 else | |
492 if (isequal (color, [0,0,0])) | |
493 typ = -1; | |
494 elseif (isequal (color, [1,0,0])) | |
495 typ = 1; | |
496 elseif (isequal (color, [0,1,0])) | |
497 typ = 2; | |
498 elseif (isequal (color, [0,0,1])) | |
499 typ = 3; | |
500 elseif (isequal (color, [1,0,1])) | |
501 typ = 4; | |
502 elseif (isequal (color, [0,1,1])) | |
503 typ = 5; | |
504 elseif (isequal (color, [1,1,1])) | |
505 typ = -1; | |
506 elseif (isequal (color, [1,1,0])) | |
507 typ = 7; | |
508 else | |
509 typ = -1; | |
510 endif | |
511 withclause{data_idx} = sprintf ("with filledcurve lt %d", typ); | |
512 endif | |
513 data{data_idx} = [xcol, ycol]'; | |
514 usingclause{data_idx} = "using ($1):($2)"; | |
515 endif | |
516 | |
517 ## patch outline | |
518 data_idx++; | |
519 is_image_data(data_idx) = false; | |
520 parametric(data_idx) = false; | |
521 titlespec{data_idx} = "title \"\""; | |
522 usingclause{data_idx} = ""; | |
523 if (isfield (obj, "edgecolor")) | |
524 if (strncmp (obj.edgecolor, "none", 4)) | |
525 color = [1, 1, 1]; | |
526 elseif (strncmp (obj.edgecolor, "flat", 4)) | |
527 warning ("\"flat\" for edgecolor not supported"); | |
528 color = [0, 0, 0]; | |
529 elseif (strncmp (obj.edgecolor, "interp", 6)) | |
530 warning ("\"interp\" for edgecolor not supported"); | |
531 color = [0, 0, 0]; | |
532 else | |
533 color = obj.edgecolor; | |
534 endif | |
446 else | 535 else |
447 color = obj.facecolor; | 536 color = [0, 0, 0]; |
448 endif | 537 endif |
449 else | 538 if (have_newer_gnuplot) |
450 color = [1, 0, 0]; | 539 withclause{data_idx} = ... |
451 endif | 540 sprintf ("with lines lc rgb \"#%02x%02x%02x\"", ... |
452 | 541 round (255*color)); |
453 if (have_newer_gnuplot) | |
454 withclause{data_idx} = sprintf ("with filledcurve lc rgb \"#%02x%02x%02x\"",round (255*color)); | |
455 else | |
456 if (isequal (color, [0,0,0])) | |
457 typ = -1; | |
458 elseif (isequal (color, [1,0,0])) | |
459 typ = 1; | |
460 elseif (isequal (color, [0,1,0])) | |
461 typ = 2; | |
462 elseif (isequal (color, [0,0,1])) | |
463 typ = 3; | |
464 elseif (isequal (color, [1,0,1])) | |
465 typ = 4; | |
466 elseif (isequal (color, [0,1,1])) | |
467 typ = 5; | |
468 elseif (isequal (color, [1,1,1])) | |
469 typ = -1; | |
470 elseif (isequal (color, [1,1,0])) | |
471 typ = 7; | |
472 else | 542 else |
473 typ = -1; | 543 if (isequal (color, [0,0,0])) |
544 typ = -1; | |
545 elseif (isequal (color, [1,0,0])) | |
546 typ = 1; | |
547 elseif (isequal (color, [0,1,0])) | |
548 typ = 2; | |
549 elseif (isequal (color, [0,0,1])) | |
550 typ = 3; | |
551 elseif (isequal (color, [1,0,1])) | |
552 typ = 4; | |
553 elseif (isequal (color, [0,1,1])) | |
554 typ = 5; | |
555 elseif (isequal (color, [1,1,1])) | |
556 typ = -1; | |
557 elseif (isequal (color, [1,1,0])) | |
558 typ = 7; | |
559 else | |
560 typ = -1; | |
561 endif | |
562 withclause{data_idx} = sprintf ("with lines lt %d", typ); | |
474 endif | 563 endif |
475 withclause{data_idx} = sprintf ("with filledcurve lt %d", typ); | 564 |
476 endif | 565 if (!isnan (xcol) && !isnan (ycol)) |
477 | 566 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]'; |
478 xdat = obj.xdata(:); | |
479 ydat = obj.ydata(:); | |
480 | |
481 if (xautoscale) | |
482 [xmin, xmax, xminp] = get_data_limits (xmin, xmax, xminp, xdat); | |
483 endif | |
484 if (yautoscale) | |
485 [ymin, ymax, yminp] = get_data_limits (ymin, ymax, yminp, ydat); | |
486 endif | |
487 data{data_idx} = [xdat, ydat]'; | |
488 usingclause{data_idx} = "using ($1):($2)"; | |
489 | |
490 ## patch outline | |
491 data_idx++; | |
492 is_image_data(data_idx) = false; | |
493 parametric(data_idx) = false; | |
494 titlespec{data_idx} = "title \"\""; | |
495 usingclause{data_idx} = ""; | |
496 if (isfield (obj, "edgecolor")) | |
497 if (strncmp (obj.edgecolor, "none", 4)) | |
498 color = [1, 1, 1]; | |
499 elseif (strncmp (obj.edgecolor, "flat", 4)) | |
500 warning ("\"flat\" for edgecolor not supported"); | |
501 color = [0, 0, 0]; | |
502 elseif (strncmp (obj.edgecolor, "interp", 6)) | |
503 warning ("\"interp\" for edgecolor not supported"); | |
504 color = [0, 0, 0]; | |
505 else | |
506 color = obj.edgecolor; | |
507 endif | |
508 else | |
509 color = [0, 0, 0]; | |
510 endif | |
511 if (have_newer_gnuplot) | |
512 withclause{data_idx} = sprintf ("with lines lc rgb \"#%02x%02x%02x\"",round (255*color)); | |
513 else | |
514 if (isequal (color, [0,0,0])) | |
515 typ = -1; | |
516 elseif (isequal (color, [1,0,0])) | |
517 typ = 1; | |
518 elseif (isequal (color, [0,1,0])) | |
519 typ = 2; | |
520 elseif (isequal (color, [0,0,1])) | |
521 typ = 3; | |
522 elseif (isequal (color, [1,0,1])) | |
523 typ = 4; | |
524 elseif (isequal (color, [0,1,1])) | |
525 typ = 5; | |
526 elseif (isequal (color, [1,1,1])) | |
527 typ = -1; | |
528 elseif (isequal (color, [1,1,0])) | |
529 typ = 7; | |
530 else | 567 else |
531 typ = -1; | 568 data{data_idx} = [xcol, ycol]'; |
532 endif | 569 endif |
533 withclause{data_idx} = sprintf ("with lines lt %d", typ); | 570 usingclause{data_idx} = "using ($1):($2)"; |
534 endif | 571 endfor |
535 | |
536 xdat = [xdat; xdat(1)]; | |
537 ydat = [ydat; ydat(1)]; | |
538 data{data_idx} = [xdat, ydat]'; | |
539 usingclause{data_idx} = "using ($1):($2)"; | |
540 | 572 |
541 case "surface" | 573 case "surface" |
542 data_idx++; | 574 data_idx++; |
543 is_image_data(data_idx) = false; | 575 is_image_data(data_idx) = false; |
544 parametric(data_idx) = false; | 576 parametric(data_idx) = false; |