comparison scripts/plot/contour.m @ 13156:da71f676e449 stable

Fix bug #34282. Fill holes in contours with the background colour * scripts/plot/private/__contour__.m: Properly fill holes in contours. * scripts/plot/contour.m: Add demo.
author Ben Abbott <bpabbott@mac.com>
date Sun, 18 Sep 2011 15:55:54 -0400
parents c792872f8942
children 72c96de7a403
comparison
equal deleted inserted replaced
13155:62e710cea7f1 13156:da71f676e449
69 endif 69 endif
70 70
71 endfunction 71 endfunction
72 72
73 %!demo 73 %!demo
74 %! clf ()
74 %! [x, y, z] = peaks (); 75 %! [x, y, z] = peaks ();
75 %! contour (x, y, z); 76 %! contour (x, y, z);
76 77
77 %!demo 78 %!demo
79 %! clf ()
78 %! [theta, r] = meshgrid (linspace (0, 2*pi, 64), linspace(0,1,64)); 80 %! [theta, r] = meshgrid (linspace (0, 2*pi, 64), linspace(0,1,64));
79 %! [X, Y] = pol2cart (theta, r); 81 %! [X, Y] = pol2cart (theta, r);
80 %! Z = sin(2*theta).*(1-r); 82 %! Z = sin(2*theta).*(1-r);
81 %! contour(X, Y, abs(Z), 10) 83 %! contour(X, Y, abs(Z), 10)
84
85 %!demo
86 %! clf ()
87 %! x = linspace (-2, 2);
88 %! [x, y] = meshgrid (x);
89 %! z = sqrt (x.^2 + y.^2) ./ (x.^2 + y.^2+1);
90 %! contourf (x, y, z, [0.4, 0.4])
91 %! title ("The hole should be filled with the background color")
92