Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a5d09c

Browse filesBrowse files
oscargustacaswellQuLogic
authored
Deprecate draw_gouraud_triangle (#23824)
* Deprecate draw_gouraud_triangle * DOC: minor rewording Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: Thomas A Caswell <tcaswell@gmail.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
1 parent ed45612 commit 4a5d09c
Copy full SHA for 4a5d09c

File tree

Expand file treeCollapse file tree

4 files changed

+23
-6
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+23
-6
lines changed
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
``draw_gouraud_triangle``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... is deprecated as in most backends this is a redundant call. Use
5+
`~.RendererBase.draw_gouraud_triangles` instead. A ``draw_gouraud_triangle``
6+
call in a custom `~matplotlib.artist.Artist` can readily be replaced as::
7+
8+
self.draw_gouraud_triangles(gc, points.reshape((1, 3, 2)),
9+
colors.reshape((1, 3, 4)), trans)
10+
11+
A `~.RendererBase.draw_gouraud_triangles` method can be implemented from an
12+
existing ``draw_gouraud_triangle`` method as::
13+
14+
transform = transform.frozen()
15+
for tri, col in zip(triangles_array, colors_array):
16+
self.draw_gouraud_triangle(gc, tri, col, transform)

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class RendererBase:
158158
159159
* `draw_path`
160160
* `draw_image`
161-
* `draw_gouraud_triangle`
161+
* `draw_gouraud_triangles`
162162
163163
The following methods *should* be implemented in the backend for
164164
optimization reasons:
@@ -286,6 +286,7 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
286286
gc, master_transform, paths, [], offsets, offsetTrans, facecolors,
287287
edgecolors, linewidths, [], [antialiased], [None], 'screen')
288288

289+
@_api.deprecated("3.7", alternative="draw_gouraud_triangles")
289290
def draw_gouraud_triangle(self, gc, points, colors, transform):
290291
"""
291292
Draw a Gouraud-shaded triangle.
@@ -317,9 +318,7 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
317318
transform : `matplotlib.transforms.Transform`
318319
An affine transform to apply to the points.
319320
"""
320-
transform = transform.frozen()
321-
for tri, col in zip(triangles_array, colors_array):
322-
self.draw_gouraud_triangle(gc, tri, col, transform)
321+
raise NotImplementedError
323322

324323
def _iter_collection_raw_paths(self, master_transform, paths,
325324
all_transforms):

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,9 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
801801

802802
def draw_gouraud_triangle(self, gc, points, colors, trans):
803803
# docstring inherited
804+
self._draw_gouraud_triangle(gc, points, colors, trans)
804805

806+
def _draw_gouraud_triangle(self, gc, points, colors, trans):
805807
# This uses a method described here:
806808
#
807809
# http://www.svgopen.org/2005/papers/Converting3DFaceToSVG/index.html
@@ -936,7 +938,7 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
936938
self.writer.start('g', **self._get_clip_attrs(gc))
937939
transform = transform.frozen()
938940
for tri, col in zip(triangles_array, colors_array):
939-
self.draw_gouraud_triangle(gc, tri, col, transform)
941+
self._draw_gouraud_triangle(gc, tri, col, transform)
940942
self.writer.end('g')
941943

942944
def option_scale_image(self):

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ def _convert_mesh_to_triangles(self, coordinates):
20972097
"""
20982098
Convert a given mesh into a sequence of triangles, each point
20992099
with its own color. The result can be used to construct a call to
2100-
`~.RendererBase.draw_gouraud_triangle`.
2100+
`~.RendererBase.draw_gouraud_triangles`.
21012101
"""
21022102
if isinstance(coordinates, np.ma.MaskedArray):
21032103
p = coordinates.data

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.