comparison scripts/plot/__go_draw_axes__.m @ 7582:3ec654f16820

Improvements for surface plots
author kai@linux-pc
date Tue, 11 Mar 2008 21:32:20 -0400
parents 369b16e7f04b
children 1d7c23e288d7
comparison
equal deleted inserted replaced
7581:e0d7bb35a3ec 7582:3ec654f16820
577 * (ccol - clim(1))/(clim(2) - clim(1))); 577 * (ccol - clim(1))/(clim(2) - clim(1)));
578 r = max (1, min (r, size (cmap, 1))); 578 r = max (1, min (r, size (cmap, 1)));
579 color = cmap(r, :); 579 color = cmap(r, :);
580 endif 580 endif
581 elseif (strncmp (obj.facecolor, "interp", 6)) 581 elseif (strncmp (obj.facecolor, "interp", 6))
582 warning ("\"interp\" not supported, using 1st entry of cdata") 582 warning ("\"interp\" not supported, using 1st entry of cdata");
583 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); 583 r = 1 + round ((size (cmap, 1) - 1) * ccol(1));
584 r = max (1, min (r, size (cmap, 1))); 584 r = max (1, min (r, size (cmap, 1)));
585 color = cmap(r,:); 585 color = cmap(r,:);
586 endif 586 endif
587 elseif (isnumeric (obj.facecolor)) 587 elseif (isnumeric (obj.facecolor))
652 * (ccol - clim(1))/(clim(2) - clim(1))); 652 * (ccol - clim(1))/(clim(2) - clim(1)));
653 r = max (1, min (r, size (cmap, 1))); 653 r = max (1, min (r, size (cmap, 1)));
654 color = cmap(r, :); 654 color = cmap(r, :);
655 endif 655 endif
656 elseif (strncmp (obj.edgecolor, "interp", 6)) 656 elseif (strncmp (obj.edgecolor, "interp", 6))
657 warning ("\"interp\" not supported, using 1st entry of cdata") 657 warning ("\"interp\" not supported, using 1st entry of cdata");
658 r = 1 + round ((size (cmap, 1) - 1) * ccol(1)); 658 r = 1 + round ((size (cmap, 1) - 1) * ccol(1));
659 r = max (1, min (r, size (cmap, 1))); 659 r = max (1, min (r, size (cmap, 1)));
660 color = cmap(r,:); 660 color = cmap(r,:);
661 endif 661 endif
662 elseif (isnumeric (obj.edgecolor)) 662 elseif (isnumeric (obj.edgecolor))
865 k++; 865 k++;
866 endfor 866 endfor
867 data{data_idx} = zz.'; 867 data{data_idx} = zz.';
868 endif 868 endif
869 usingclause{data_idx} = "using ($1):($2):($3):($4)"; 869 usingclause{data_idx} = "using ($1):($2):($3):($4)";
870 ## fputs (plot_stream, "unset parametric;\n"); 870 ## fputs (plot_stream, "unset parametric;\n");
871 871
872 ## Interpolation does not work for flat surfaces (e.g. pcolor) 872 ## Interpolation does not work for flat surfaces (e.g. pcolor)
873 ## and color mapping --> currently set empty. 873 ## and color mapping --> currently set empty.
874 interp_str = ""; 874 interp_str = "";
875 flat_interp_face = (strncmp (obj.facecolor, "flat", 4) 875 flat_interp_face = (strncmp (obj.facecolor, "flat", 4)
878 || strncmp (obj.edgecolor, "interp", 6)); 878 || strncmp (obj.edgecolor, "interp", 6));
879 879
880 facecolor_none_or_white = (strncmp (obj.facecolor, "none", 4) 880 facecolor_none_or_white = (strncmp (obj.facecolor, "none", 4)
881 || (isnumeric (obj.facecolor) 881 || (isnumeric (obj.facecolor)
882 && all (obj.facecolor == 1))); 882 && all (obj.facecolor == 1)));
883 if (strncmp (obj.facecolor, "none", 4)) 883 hidden_removal = false;
884 hidden_removal = false;
885 else
886 if (isnan (hidden_removal))
887 hidden_removal = true;
888 endif
889 endif
890 884
891 if (flat_interp_edge && facecolor_none_or_white) 885 if (flat_interp_edge && facecolor_none_or_white)
892 withclause{data_idx} = "with line palette"; 886 withclause{data_idx} = "with line palette";
893 fputs (plot_stream, "unset pm3d\n"); 887 fputs (plot_stream, "unset pm3d\n");
888 if (all (obj.facecolor == 1))
889 hidden_removal = true;
890 endif
894 elseif (facecolor_none_or_white) 891 elseif (facecolor_none_or_white)
895 edgecol = obj.edgecolor; 892 edgecol = obj.edgecolor;
896 if (have_newer_gnuplot) 893 if (have_newer_gnuplot)
897 if (mono) 894 if (mono)
898 colorspec = ""; 895 colorspec = "";
899 else 896 else
900 colorspec = sprintf ("linecolor rgb \"#%02x%02x%02x\"", 897 colorspec = sprintf ("linecolor rgb \"#%02x%02x%02x\"",
901 round (255*edgecol)); 898 round (255*edgecol));
902 endif 899 endif
900 if (all (obj.facecolor == 1))
901 hidden_removal = true;
902 endif
903 fputs(plot_stream,"unset pm3d;\n");
903 fprintf (plot_stream, 904 fprintf (plot_stream,
904 "set style line %d %s lw %f;\n", 905 "set style line %d %s lw %f;\n",
905 data_idx, colorspec, obj.linewidth); 906 data_idx, colorspec, obj.linewidth);
907 fputs(plot_stream,"set style increment user;\n");
906 else 908 else
907 typ = get_old_gnuplot_color (edgecol); 909 typ = get_old_gnuplot_color (edgecol);
908 fprintf (plot_stream, 910 fprintf (plot_stream,
909 "set style line %d lt %d lw %f;\n", 911 "set style line %d lt %d lw %f;\n",
910 data_idx, typ, obj.linewidth); 912 data_idx, typ, obj.linewidth);
911 endif 913 endif
912 withclause{data_idx} = sprintf("with line linestyle %d", data_idx); 914 withclause{data_idx} = sprintf("with line linestyle %d", data_idx);
913 fputs (plot_stream, "unset pm3d\n") 915 fputs (plot_stream, "unset pm3d\n");
914 endif 916 endif
915 917
916 if (have_newer_gnuplot) 918 if (have_newer_gnuplot)
917 dord = "depthorder"; 919 dord = "depthorder";
918 else 920 else
1523 else 1525 else
1524 fprintf (plot_stream, "set %stics %s nomirror (", ax, axispos); 1526 fprintf (plot_stream, "set %stics %s nomirror (", ax, axispos);
1525 endif 1527 endif
1526 labels = regexprep(labels, "%", "%%"); 1528 labels = regexprep(labels, "%", "%%");
1527 for i = 1:ntics 1529 for i = 1:ntics
1528 fprintf (plot_stream, " \"%s\" %g", labels{k++}, tics(i)) 1530 fprintf (plot_stream, " \"%s\" %g", labels{k++}, tics(i));
1529 if (i < ntics) 1531 if (i < ntics)
1530 fputs (plot_stream, ", "); 1532 fputs (plot_stream, ", ");
1531 endif 1533 endif
1532 if (k > nlabels) 1534 if (k > nlabels)
1533 k = 1; 1535 k = 1;