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

Computing the bounding box of a degenerate polygon throws an error #17975

Closed
Assignees
brunobeltran
Milestone
@antonio-rojas

Description

@antonio-rojas

With 3.3.0, computing the bounding box of a degenerate (one-point) polygon throws an error

Code for reproduction

frommatplotlib.patchesimportPolygonpp=Polygon([[0.,0.]])pp.get_extents()

Actual outcome

ValueError                                Traceback (most recent call last)<ipython-input-3-1312a177eac2> in <module>----> 1 pp.get_extents()/usr/lib/python3.8/site-packages/matplotlib/patches.py in get_extents(self)    254         Return the `Patch`'s axis-aligned extents as a `~.transforms.Bbox`.    255         """--> 256         return self.get_path().get_extents(self.get_transform())    257     258     def get_transform(self):/usr/lib/python3.8/site-packages/matplotlib/path.py in get_extents(self, transform, **kwargs)    590             self = transform.transform_path(self)    591         bbox = Bbox.null()--> 592         for curve, code in self.iter_bezier(**kwargs):    593             # places where the derivative is zero can be extrema    594             _, dzeros = curve.axis_aligned_extrema()/usr/lib/python3.8/site-packages/matplotlib/path.py in iter_bezier(self, **kwargs)    442             if first_vert is None:    443                 if code != Path.MOVETO:--> 444                     raise ValueError("Malformed path, must start with MOVETO.")    445             if code == Path.MOVETO:  # a point is like "CURVE1"    446                 first_vert = vertsValueError: Malformed path, must start with MOVETO.

Expected outcome

With 3.2:

Bbox([[inf, inf], [-inf, -inf]])

Matplotlib version

  • Operating system: Linux x86_64
  • Matplotlib version: 3.3.0
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.8.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp