shapely.plotting.plot_polygon

Contents

shapely.plotting.plot_polygon#

plot_polygon(polygon, ax=None, add_points=True, color=None, facecolor=None, edgecolor=None, linewidth=None, **kwargs)#

Plot a (Multi)Polygon.

Note: this function is experimental, and mainly targeting (interactive) exploration, debugging and illustration purposes.

Parameters:
polygonshapely.Polygon or shapely.MultiPolygon
axmatplotlib Axes, default None

The axes on which to draw the plot. If not specified, will get the current active axes or create a new figure.

add_pointsbool, default True

If True, also plot the coordinates (vertices) as points.

colormatplotlib color specification

Color for both the polygon fill (face) and boundary (edge). By default, the fill is using an alpha of 0.3. You can specify facecolor and edgecolor separately for greater control.

facecolormatplotlib color specification

Color for the polygon fill.

edgecolormatplotlib color specification

Color for the polygon boundary.

linewidthfloat

The line width for the polygon boundary.

**kwargs

Additional keyword arguments passed to the matplotlib Patch.

Returns:
Matplotlib artist (PathPatch), if add_points is false.
A tuple of Matplotlib artists (PathPatch, Line2D), if add_points is true.