8000 Return minpos from _path.get_path_collection_extents. · QuLogic/matplotlib@b5836cb · GitHub
[go: up one dir, main page]

Skip to content

Commit b5836cb

Browse files
committed
Return minpos from _path.get_path_collection_extents.
This is already calculated by the internal C++ code, but discarded at the end of the Python function.
1 parent e5a6008 commit b5836cb

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lib/matplotlib/path.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,7 @@ def get_path_collection_extents(
10391039
from .transforms import Bbox
10401040
if len(paths) == 0:
10411041
raise ValueError("No paths provided")
1042-
return Bbox.from_extents(*_path.get_path_collection_extents(
1042+
extents, minpos = _path.get_path_collection_extents(
10431043
master_transform, paths, np.atleast_3d(transforms),
1044-
offsets, offset_transform))
1044+
offsets, offset_transform)
1045+
return Bbox.from_extents(*extents)

src/_path_wrapper.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ static PyObject *Py_update_path_extents(PyObject *self, PyObject *args, PyObject
250250
"NNi", outextents.pyobj(), outminpos.pyobj(), changed);
251251
}
252252

253-
const char *Py_get_path_collection_extents__doc__ = "get_path_collection_extents(";
253+
const char *Py_get_path_collection_extents__doc__ = "get_path_collection_extents("
254+
"master_transform, paths, transforms, offsets, offset_transform)";
254255

255256
static PyObject *Py_get_path_collection_extents(PyObject *self, PyObject *args, PyObject *kwds)
256257
{
@@ -295,7 +296,12 @@ static PyObject *Py_get_path_collection_extents(PyObject *self, PyObject *args,
295296
extents(1, 0) = e.x1;
296297
extents(1, 1) = e.y1;
297298

298-
return extents.pyobj();
299+
npy_intp minposdims[] = { 2 };
300+
numpy::array_view<double, 1> minpos(minposdims);
301+
minpos(0) = e.xm;
302+
minpos(1) = e.ym;
303+
304+
return Py_BuildValue("NN", extents.pyobj(), minpos.pyobj());
299305
}
300306

301307
const char *Py_point_in_path_collection__doc__ =

0 commit comments

Comments
 (0)
0