Mercurial > hg > octave-lyh
comparison scripts/plot/patch.m @ 13299:e9f6a6edec42
Improvements to patch() and fix for bugs reported in #34417.
* scripts/plot/patch.m: Add demos.
* scripts/plot/private/__patch__.m: Improvements to input parsing.
* scripts/plot/__go_draw_axes__.m: Accommodate patches with one scalar color
per vertex.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 08 Oct 2011 17:34:15 -0400 |
parents | e36c2f4ea8f5 |
children | 630d3c80b541 |
comparison
equal
deleted
inserted
replaced
13298:86d18a3cc911 | 13299:e9f6a6edec42 |
---|---|
149 %! 3, 4, 5; | 149 %! 3, 4, 5; |
150 %! 4, 1, 5]; | 150 %! 4, 1, 5]; |
151 %! patch('Vertices', vertices, 'Faces', faces, ... | 151 %! patch('Vertices', vertices, 'Faces', faces, ... |
152 %! 'FaceVertexCData', jet(5), 'FaceColor', 'interp') | 152 %! 'FaceVertexCData', jet(5), 'FaceColor', 'interp') |
153 %! view (-37.5, 30) | 153 %! view (-37.5, 30) |
154 | |
155 %!demo | |
156 %! clf | |
157 %! colormap (jet) | |
158 %! x = [0 1 1 0]; | |
159 %! y = [0 0 1 1]; | |
160 %! subplot (2, 1, 1) | |
161 %! title ("Blue, Light-Green, and Red Horizontal Bars") | |
162 %! patch (x, y + 0, 1); | |
163 %! patch (x, y + 1, 2); | |
164 %! patch (x, y + 2, 3); | |
165 %! subplot (2, 1, 2) | |
166 %! title ("Blue, Light-Green, and Red Vertical Bars") | |
167 %! patch (x + 0, y, 1 * ones (size (x))); | |
168 %! patch (x + 1, y, 2 * ones (size (x))); | |
169 %! patch (x + 2, y, 3 * ones (size (x))); | |
170 | |
171 %!demo | |
172 %! clf | |
173 %! colormap (jet) | |
174 %! x = [0 1 1 0]; | |
175 %! y = [0 0 1 1]; | |
176 %! subplot (2, 1, 1) | |
177 %! title ("Blue horizontal bars: Dark to Light") | |
178 %! patch (x, y + 0, 1, "cdatamapping", "direct"); | |
179 %! patch (x, y + 1, 9, "cdatamapping", "direct"); | |
180 %! patch (x, y + 2, 17, "cdatamapping", "direct"); | |
181 %! subplot (2, 1, 2) | |
182 %! title ("Blue vertical bars: Dark to Light") | |
183 %! patch (x + 0, y, 1 * ones (size (x)), "cdatamapping", "direct"); | |
184 %! patch (x + 1, y, 9 * ones (size (x)), "cdatamapping", "direct"); | |
185 %! patch (x + 2, y, 17 * ones (size (x)), "cdatamapping", "direct"); | |
186 | |
187 %!demo | |
188 %! clf; | |
189 %! colormap (jet); | |
190 %! x = [ 0 0; 1 1; 1 0 ]; | |
191 %! y = [ 0 0; 0 1; 1 1 ]; | |
192 %! p = patch (x, y, "facecolor", "b"); | |
193 %! title ("Two blue triangles") | |
194 %! set (p, "cdatamapping", "direct", "facecolor", "flat", "cdata", [1 32]) | |
195 %! title ("Direct mapping of colors: Light-Green UL and Blue LR triangles") | |
196 | |
197 %!demo | |
198 %! clf; | |
199 %! colormap (jet); | |
200 %! x = [ 0 0; 1 1; 1 0 ]; | |
201 %! y = [ 0 0; 0 1; 1 1 ]; | |
202 %! p = patch (x, y, [1 32]); | |
203 %! title ("Autoscaling of colors: Red UL and Blue LR triangles") | |
154 | 204 |
155 %!test | 205 %!test |
156 %! hf = figure ("visible", "off"); | 206 %! hf = figure ("visible", "off"); |
157 %! unwind_protect | 207 %! unwind_protect |
158 %! h = patch; | 208 %! h = patch; |