Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Remove hatchcolors parameter from draw_quad_mesh#29905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
anntzer merged 1 commit intomatplotlib:mainfromr3kste:quad_mesh_backend_fix
Apr 12, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletionslib/matplotlib/backend_bases.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -258,7 +258,7 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,

def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
coordinates, offsets, offsetTrans, facecolors,
antialiased, edgecolors, *, hatchcolors=None):
antialiased, edgecolors):
"""
Draw a quadmesh.

Expand All@@ -271,14 +271,11 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,

if edgecolors is None:
edgecolors = facecolors
if hatchcolors is None:
hatchcolors = []
linewidths = np.array([gc.get_linewidth()], float)

return self.draw_path_collection(
gc, master_transform, paths, [], offsets, offsetTrans, facecolors,
edgecolors, linewidths, [], [antialiased], [None], 'screen',
hatchcolors=hatchcolors)
edgecolors, linewidths, [], [antialiased], [None], 'screen')

def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
transform):
Expand Down
2 changes: 0 additions & 2 deletionslib/matplotlib/backend_bases.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -78,8 +78,6 @@ class RendererBase:
facecolors: Sequence[ColorType],
antialiased: bool,
edgecolors: Sequence[ColorType] | ColorType | None,
*,
hatchcolors: Sequence[ColorType] | ColorType | None = None,
) -> None: ...
def draw_gouraud_triangles(
self,
Expand Down
3 changes: 1 addition & 2 deletionslib/matplotlib/collections.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2547,8 +2547,7 @@ def draw(self, renderer):
coordinates, offsets, offset_trf,
# Backends expect flattened rgba arrays (n*m, 4) for fc and ec
self.get_facecolor().reshape((-1, 4)),
self._antialiased, self.get_edgecolors().reshape((-1, 4)),
hatchcolors=self.get_hatchcolor().reshape((-1, 4)))
self._antialiased, self.get_edgecolors().reshape((-1, 4)))
gc.restore()
renderer.close_group(self.__class__.__name__)
self.stale = False
Expand Down
7 changes: 3 additions & 4 deletionssrc/_backend_agg.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -190,8 +190,7 @@ class RendererAgg
agg::trans_affine &offset_trans,
ColorArray &facecolors,
bool antialiased,
ColorArray &edgecolors,
ColorArray &hatchcolors);
ColorArray &edgecolors);

template <class PointArray, class ColorArray>
void draw_gouraud_triangles(GCAgg &gc,
Expand DownExpand Up@@ -1163,15 +1162,15 @@ inline void RendererAgg::draw_quad_mesh(GCAgg &gc,
agg::trans_affine &offset_trans,
ColorArray &facecolors,
bool antialiased,
ColorArray &edgecolors,
ColorArray &hatchcolors)
ColorArray &edgecolors)
{
QuadMeshGenerator<CoordinateArray> path_generator(mesh_width, mesh_height, coordinates);

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

_draw_path_collection_generic(gc,
master_transform,
Expand Down
10 changes: 3 additions & 7 deletionssrc/_backend_agg_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -182,14 +182,12 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
agg::trans_affine offset_trans,
py::array_t<double> facecolors_obj,
bool antialiased,
py::array_t<double> edgecolors_obj,
py::array_t<double> hatchcolors_obj)
py::array_t<double> edgecolors_obj)
{
auto coordinates = coordinates_obj.mutable_unchecked<3>();
auto offsets = convert_points(offsets_obj);
auto facecolors = convert_colors(facecolors_obj);
auto edgecolors = convert_colors(edgecolors_obj);
auto hatchcolors = convert_colors(hatchcolors_obj);

self->draw_quad_mesh(gc,
master_transform,
Expand All@@ -200,8 +198,7 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
offset_trans,
facecolors,
antialiased,
edgecolors,
hatchcolors);
edgecolors);
}

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

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp