comparison scripts/plot/contour.m @ 17525:76a6d7de4cbc

Fix multiple problem with listeners for contour groups. * scripts/plot/contour.m: Add new %!demo showing use of a single contour line. * scripts/plot/private/__contour__.m: Fix bug with lowest level of contourf showing background through. Use same routines for calculating levels and levelstep in main code and in listeners. Fix linecolor when turning "fill" on and off. Fix "textlist" and "textliststep" properties which were not activating correctly.
author Rik <rik@octave.org>
date Tue, 01 Oct 2013 12:51:04 -0700
parents 68bcac3c043a
children
comparison
equal deleted inserted replaced
17524:797545fa86d0 17525:76a6d7de4cbc
88 %!demo 88 %!demo
89 %! clf; 89 %! clf;
90 %! colormap ('default'); 90 %! colormap ('default');
91 %! [x, y, z] = peaks (); 91 %! [x, y, z] = peaks ();
92 %! contour (x, y, z); 92 %! contour (x, y, z);
93 %! title ('contour() plot of peaks() function');
94 %! title ({'contour() plot (isolines of constant Z)'; 'Z = peaks()'}); 93 %! title ({'contour() plot (isolines of constant Z)'; 'Z = peaks()'});
95 94
96 %!demo 95 %!demo
97 %! clf; 96 %! clf;
98 %! colormap ('default'); 97 %! colormap ('default');
100 %! [X, Y] = pol2cart (theta, r); 99 %! [X, Y] = pol2cart (theta, r);
101 %! Z = sin (2*theta) .* (1-r); 100 %! Z = sin (2*theta) .* (1-r);
102 %! contour (X, Y, abs (Z), 10); 101 %! contour (X, Y, abs (Z), 10);
103 %! title ({'contour() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'}); 102 %! title ({'contour() plot'; 'polar fcn: Z = sin (2*theta) * (1-r)'});
104 103
104 %!demo
105 %! clf;
106 %! colormap ('default');
107 %! z = peaks ();
108 %! contour (z, [0 0]);
109 %! title ({'contour() plot with single isoline at Z == 0'; 'Z = peaks()'});
110
105 %!test 111 %!test
106 %! hf = figure ("visible", "off"); 112 %! hf = figure ("visible", "off");
107 %! clf (hf); 113 %! clf (hf);
108 %! unwind_protect 114 %! unwind_protect
109 %! [x, y, z] = peaks (); 115 %! [x, y, z] = peaks ();
110 %! [c, h] = contour (x, y, z); 116 %! [c, h] = contour (x, y, z);
111 %! levellist = (-6):6; 117 %! levellist = -6:6;
112 %! set (h, "levellist", levellist); 118 %! set (h, "levellist", levellist);
113 %! assert (get (h, "levellist"), levellist) 119 %! assert (get (h, "levellist"), levellist)
114 %! assert (get (h, "levellistmode"), "manual") 120 %! assert (get (h, "levellistmode"), "manual")
115 %! unwind_protect_cleanup 121 %! unwind_protect_cleanup
116 %! close (hf); 122 %! close (hf);
124 %! [c, h] = contour (x, y, z); 130 %! [c, h] = contour (x, y, z);
125 %! levelstep = 3; 131 %! levelstep = 3;
126 %! set (h, "levelstep", levelstep); 132 %! set (h, "levelstep", levelstep);
127 %! assert (get (h, "levelstep"), levelstep) 133 %! assert (get (h, "levelstep"), levelstep)
128 %! assert (get (h, "levelstepmode"), "manual") 134 %! assert (get (h, "levelstepmode"), "manual")
129 %! assert (get (h, "levellist"), (-6):levelstep:6) 135 %! assert (get (h, "levellist"), -6:levelstep:6)
130 %! assert (get (h, "levellistmode"), "auto") 136 %! assert (get (h, "levellistmode"), "auto")
131 %! unwind_protect_cleanup 137 %! unwind_protect_cleanup
132 %! close (hf); 138 %! close (hf);
133 %! end_unwind_protect 139 %! end_unwind_protect
134 140