comparison scripts/plot/mesh.m @ 6004:01556febbaaf

[project @ 2006-09-26 21:16:52 by jwe]
author jwe
date Tue, 26 Sep 2006 21:16:52 +0000
parents 93785a1b0f97
children 34f96dd5441b
comparison
equal deleted inserted replaced
6003:7f8e4f5e2eb7 6004:01556febbaaf
44 __gnuplot_raw__ ("set surface;\n"); 44 __gnuplot_raw__ ("set surface;\n");
45 __gnuplot_raw__ ("set nocontour;\n"); 45 __gnuplot_raw__ ("set nocontour;\n");
46 __gnuplot_set__ noparametric; 46 __gnuplot_set__ noparametric;
47 __gnuplot_raw__ ("set nologscale;\n"); 47 __gnuplot_raw__ ("set nologscale;\n");
48 __gnuplot_raw__ ("set view 60, 30, 1, ;\n"); 48 __gnuplot_raw__ ("set view 60, 30, 1, ;\n");
49 __gnuplot_splot__ (z'); 49 __plt3__ (z');
50 else 50 else
51 error ("mesh: argument must be a matrix"); 51 error ("mesh: argument must be a matrix");
52 endif 52 endif
53 elseif (nargin == 3) 53 elseif (nargin == 3)
54 if (isvector (x) && isvector (y) && ismatrix (z)) 54 if (isvector (x) && isvector (y) && ismatrix (z))
65 zz(:,i) = x(k) * ones (ylen, 1); 65 zz(:,i) = x(k) * ones (ylen, 1);
66 zz(:,i+1) = y; 66 zz(:,i+1) = y;
67 zz(:,i+2) = z(:,k); 67 zz(:,i+2) = z(:,k);
68 k++; 68 k++;
69 endfor 69 endfor
70 __gnuplot_raw__ ("set hidden3d;\n"); 70 unwind_protect
71 __gnuplot_raw__ ("set data style lines;\n"); 71 __gnuplot_raw__ ("set hidden3d;\n");
72 __gnuplot_raw__ ("set surface;\n"); 72 __gnuplot_raw__ ("set data style lines;\n");
73 __gnuplot_raw__ ("set nocontour;\n"); 73 __gnuplot_raw__ ("set surface;\n");
74 __gnuplot_raw__ ("set nologscale;\n"); 74 __gnuplot_raw__ ("set nocontour;\n");
75 __gnuplot_set__ parametric; 75 __gnuplot_raw__ ("set nologscale;\n");
76 __gnuplot_raw__ ("set view 60, 30, 1, 1;\n"); 76 __gnuplot_set__ parametric;
77 __gnuplot_raw__ ("set palette defined (0 \"dark-blue\", 1 \"blue\", 2 \"cyan\", 3 \"yellow\", 4 \"red\" , 5 \"dark-red\");\n"); 77 __gnuplot_raw__ ("set view 60, 30, 1, 1;\n");
78 __gnuplot_raw__ ("set nocolorbox;\n"); 78 __gnuplot_raw__ ("set palette defined (0 \"dark-blue\", 1 \"blue\", 2 \"cyan\", 3 \"yellow\", 4 \"red\" , 5 \"dark-red\");\n");
79 __gnuplot_splot__ zz with line palette; 79 __gnuplot_raw__ ("set nocolorbox;\n");
80 __gnuplot_set__ noparametric; 80 __plt3__ (zz, "", "", [gnuplot_command_with " line palette"]);
81 unwind_protect_cleanup
82 __gnuplot_set__ noparametric;
83 end_unwind_protect
81 else 84 else
82 msg = "mesh: rows (z) must be the same as length (y) and"; 85 msg = "mesh: rows (z) must be the same as length (y) and";
83 msg = sprintf ("%s\ncolumns (z) must be the same as length (x)", msg); 86 msg = sprintf ("%s\ncolumns (z) must be the same as length (x)", msg);
84 error (msg); 87 error (msg);
85 endif 88 endif
95 zz(:,i) = x(:,k); 98 zz(:,i) = x(:,k);
96 zz(:,i+1) = y(:,k); 99 zz(:,i+1) = y(:,k);
97 zz(:,i+2) = z(:,k); 100 zz(:,i+2) = z(:,k);
98 k++; 101 k++;
99 endfor 102 endfor
100 __gnuplot_raw__ ("set hidden3d;\n") 103 unwind_protect
101 __gnuplot_raw__ ("set data style lines;\n"); 104 __gnuplot_raw__ ("set data style lines;\n");
102 __gnuplot_raw__ ("set surface;\n"); 105 __gnuplot_raw__ ("set surface;\n");
103 __gnuplot_raw__ ("set nocontour;\n"); 106 __gnuplot_raw__ ("set nocontour;\n");
104 __gnuplot_raw__ ("set nologscale;\n"); 107 __gnuplot_raw__ ("set nologscale;\n");
105 __gnuplot_set__ parametric; 108 __gnuplot_set__ parametric;
106 __gnuplot_raw__ ("set view 60, 30, 1, 1;\n"); 109 __gnuplot_raw__ ("set view 60, 30, 1, 1;\n");
107 __gnuplot_splot__ (zz); 110 __plt3__ (zz);
108 __gnuplot_set__ noparametric; 111 unwind_protect_cleanup
112 __gnuplot_set__ noparametric;
113 end_unwind_protect
109 else 114 else
110 error ("mesh: x, y, and z must have same dimensions"); 115 error ("mesh: x, y, and z must have same dimensions");
111 endif 116 endif
112 else 117 else
113 error ("mesh: x and y must be vectors and z must be a matrix"); 118 error ("mesh: x and y must be vectors and z must be a matrix");