matplotlib.axes.Axes.add_collection#

Axes.add_collection(collection, autolim=True)[source]#

Add a Collection to the Axes; return the collection.

Parameters:
collectionCollection

The collection to add.

autolimbool

Whether to update data and view limits.

Changed in version 3.11: This now also updates the view limits, making explicit calls to autoscale_view unnecessary.

As an implementation detail, the value "_datalim_only" is supported to smooth the internal transition from pre-3.11 behavior. This is not a public interface and will be removed again in the future.

Examples using matplotlib.axes.Axes.add_collection#

Lasso Demo

Lasso Demo

EventCollection Demo

EventCollection Demo

Multicolored lines

Multicolored lines

Line, Poly and RegularPoly Collection

Line, Poly and RegularPoly Collection

Ellipse Collection

Ellipse Collection

Plot multiple lines using a LineCollection

Plot multiple lines using a LineCollection

Circles, Wedges and Polygons

Circles, Wedges and Polygons

Create boxes from error bars using PatchCollection

Create boxes from error bars using PatchCollection

Artist tests

Artist tests