matplotlib 3.5.1

NotesParametersReturnsBackRef
contains_point(self, point, transform=None, radius=0.0)

The path is always treated as closed; i.e. if the last code is not CLOSEPOLY an implicit segment connecting the last vertex to the first vertex is assumed.

Notes

The current algorithm has some limitations:

Parameters

point : (float, float)

The point (x, y) to check.

transform : `matplotlib.transforms.Transform`, optional

If not None , point will be compared to self transformed by transform; i.e. for a correct check, transform should transform the path into the coordinate system of point.

radius : float, default: 0

Add an additional margin on the path in coordinates of point. The path is extended tangentially by radius/2; i.e. if you would draw the path with a linewidth of radius, all points on the line would still be considered to be contained in the area. Conversely, negative values shrink the area: Points on the imaginary line will be considered outside the area.

Returns

bool

Return whether the area enclosed by the path contains the given point.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.patches.Patch.contains_points matplotlib.patches.Patch.contains_point matplotlib.widgets.Lasso matplotlib.widgets.LassoSelector

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/path.py#491
type: <class 'function'>
Commit: