Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c90c35

Browse files
authored
Merge pull request #29905 from r3kste/quad_mesh_backend_fix
Remove hatchcolors parameter from draw_quad_mesh
2 parents b9da4fd + 41a049a commit 5c90c35

File tree

5 files changed

+9
-20
lines changed

5 files changed

+9
-20
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
258258

259259
def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
260260
coordinates, offsets, offsetTrans, facecolors,
261-
antialiased, edgecolors, *, hatchcolors=None):
261+
antialiased, edgecolors):
262262
"""
263263
Draw a quadmesh.
264264
@@ -271,14 +271,11 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
271271

272272
if edgecolors is None:
273273
edgecolors = facecolors
274-
if hatchcolors is None:
275-
hatchcolors = []
276274
linewidths = np.array([gc.get_linewidth()], float)
277275

278276
return self.draw_path_collection(
279277
gc, master_transform, paths, [], offsets, offsetTrans, facecolors,
280-
edgecolors, linewidths, [], [antialiased], [None], 'screen',
281-
hatchcolors=hatchcolors)
278+
edgecolors, linewidths, [], [antialiased], [None], 'screen')
282279

283280
def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
284281
transform):

lib/matplotlib/backend_bases.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ class RendererBase:
7878
facecolors: Sequence[ColorType],
7979
antialiased: bool,
8080
edgecolors: Sequence[ColorType] | ColorType | None,
81-
*,
82-
hatchcolors: Sequence[ColorType] | ColorType | None = None,
8381
) -> None: ...
8482
def draw_gouraud_triangles(
8583
self,

lib/matplotlib/collections.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,8 +2547,7 @@ def draw(self, renderer):
25472547
coordinates, offsets, offset_trf,
25482548
# Backends expect flattened rgba arrays (n*m, 4) for fc and ec
25492549
self.get_facecolor().reshape((-1, 4)),
2550-
self._antialiased, self.get_edgecolors().reshape((-1, 4)),
2551-
hatchcolors=self.get_hatchcolor().reshape((-1, 4)))
2550+
self._antialiased, self.get_edgecolors().reshape((-1, 4)))
25522551
gc.restore()
25532552
renderer.close_group(self.__class__.__name__)
25542553
self.stale = False

src/_backend_agg.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ class RendererAgg
190190
agg::trans_affine &offset_trans,
191191
ColorArray &facecolors,
192192
bool antialiased,
193-
ColorArray &edgecolors,
194-
ColorArray &hatchcolors);
193+
ColorArray &edgecolors);
195194

196195
template <class PointArray, class ColorArray>
197196
void draw_gouraud_triangles(GCAgg &gc,
@@ -1163,15 +1162,15 @@ inline void RendererAgg::draw_quad_mesh(GCAgg &gc,
11631162
agg::trans_affine &offset_trans,
11641163
ColorArray &facecolors,
11651164
bool antialiased,
1166-
ColorArray &edgecolors,
1167-
ColorArray &hatchcolors)
1165+
ColorArray &edgecolors)
11681166
{
11691167
QuadMeshGenerator<CoordinateArray> path_generator(mesh_width, mesh_height, coordinates);
11701168

11711169
array::empty<double> transforms;
11721170
array::scalar<double, 1> linewidths(gc.linewidth);
11731171
array::scalar<uint8_t, 1> antialiaseds(antialiased);
11741172
DashesVector linestyles;
1173+
ColorArray hatchcolors = py::array_t<double>().reshape({0, 4}).unchecked<double, 2>();
11751174

11761175
_draw_path_collection_generic(gc,
11771176
master_transform,

src/_backend_agg_wrapper.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,12 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
182182
agg::trans_affine offset_trans,
183183
py::array_t<double> facecolors_obj,
184184
bool antialiased,
185-
py::array_t<double> edgecolors_obj,
186-
py::array_t<double> hatchcolors_obj)
185+
py::array_t<double> edgecolors_obj)
187186
{
188187
auto coordinates = coordinates_obj.mutable_unchecked<3>();
189188
auto offsets = convert_points(offsets_obj);
190189
auto facecolors = convert_colors(facecolors_obj);
191190
auto edgecolors = convert_colors(edgecolors_obj);
192-
auto hatchcolors = convert_colors(hatchcolors_obj);
193191

194192
self->draw_quad_mesh(gc,
195193
master_transform,
@@ -200,8 +198,7 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
200198
offset_trans,
201199
facecolors,
202200
antialiased,
203-
edgecolors,
204-
hatchcolors);
201+
edgecolors);
205202
}
206203

207204
static void
@@ -240,8 +237,7 @@ PYBIND11_MODULE(_backend_agg, m, py::mod_gil_not_used())
240237
.def("draw_quad_mesh", &PyRendererAgg_draw_quad_mesh,
241238
"gc"_a, "master_transform"_a, "mesh_width"_a, "mesh_height"_a,
242239
"coordinates"_a, "offsets"_a, "offset_trans"_a, "facecolors"_a,
243-
"antialiased"_a, "edgecolors"_a, py::kw_only(),
244-
"hatchcolors"_a = py::array_t<double>().reshape({0, 4}))
240+
"antialiased"_a, "edgecolors"_a)
245241
.def("draw_gouraud_triangles", &PyRendererAgg_draw_gouraud_triangles,
246242
"gc"_a, "points"_a, "colors"_a, "trans"_a = nullptr)
247243

0 commit comments

Comments
 (0)