The underlying storage is made up of two parallel numpy arrays:
vertices: an Nx2 float array of vertices
codes: an N-length uint8 array of path codes, or None
These two arrays always have the same length in the first dimension. For example, to represent a cubic curve, you must provide three vertices and three CURVE4
codes.
The code types are:
STOP
STOP
MOVETO
MOVETO
LINETO
LINETO
CURVE3
CURVE3
CURVE4
CURVE4
CLOSEPOLY
CLOSEPOLY
If codes is None, it is interpreted as a MOVETO
followed by a series of LINETO
.
Users of Path objects should not access the vertices and codes arrays directly. Instead, they should use iter_segments
or cleaned
to get the vertex/code pairs. This helps, in particular, to consistently handle the case of codes being None.
Some behavior of Path objects can be controlled by rcParams. See the rcParams whose keys start with 'path.'.
The vertices and codes arrays should be treated as immutable -- there are a number of optimizations and assumptions made up front in the constructor that will not change when the data changes.
A series of possibly disconnected, possibly closed, line and curve segments.
The following pages refer to to this document either explicitly or contain code examples using this.
matplotlib.patches.Polygon.set_xymatplotlib.patches.BoxStylematplotlib.transforms.Transformmatplotlib.lines.Line2D.__init__matplotlib.axes._axes.Axes.coherematplotlib.spines.Spine.__init__matplotlib.lines.Line2D.get_pathmatplotlib.pyplot.plot_datematplotlib.pyplot.spymatplotlib.pyplot.plotmatplotlib.path.Path.__deepcopy__matplotlib.pyplot.psdmatplotlib.pyplot.errorbarmatplotlib.pyplot.axlinematplotlib.path.Path.iter_segmentsmatplotlib.pyplot.angle_spectrummatplotlib.patches.Polygon.get_pathmatplotlib.axes._axes.Axes.magnitude_spectrummatplotlib.contour.ContourSet.find_nearest_contourmatplotlib.pyplot.gridmatplotlib.transforms.Transform.transform_pathmatplotlib.artist.Line2D.setmatplotlib._enums.JoinStylematplotlib.pyplot.coherematplotlib.backend_bases.RendererBase.draw_pathmatplotlib.path.get_path_collection_extentsmatplotlib.pyplot.axvlinematplotlib.artist.Artist.set_clip_pathmatplotlib.axes._axes.Axes.plotmatplotlib.markers.MarkerStyle.get_alt_transformmatplotlib.axes._axes.Axes.axhlinematplotlib.pyplot.magnitude_spectrummatplotlib.patches.PathPatch.__init__matplotlib.markers.MarkerStyle.get_pathmatplotlib.legend.Legend._auto_legend_datamatplotlib.axes._base._AxesBase.gridmatplotlib.transforms.Transform.transform_path_affinematplotlib.pyplot.phase_spectrummatplotlib.pyplot.csdmatplotlib.backend_bases.GraphicsContextBase.get_clip_pathmatplotlib.axes._axes.Axes.psdmatplotlib.axes._axes.Axes.csdmatplotlib.transforms.Transform.transform_path_non_affinematplotlib.axes._axes.Axes.plot_datematplotlib.collections.PathCollection.__init__matplotlib.path.Path.copymatplotlib.artist._AxLine.setmatplotlib.axes._axes.Axes.spymatplotlib.patches.ArrowStylematplotlib.patches.ConnectionStylematplotlib.axes._axes.Axes.phase_spectrummatplotlib.axes._axes.Axes.axlinematplotlib.axes._axes.Axes.angle_spectrummatplotlib.markersmatplotlib.axes._axes.Axes.axvlinematplotlib.patches.BoxStyle._Basematplotlib.pyplot.axhlinematplotlib.table.Cell.get_pathmatplotlib.transforms.TransformedPathmatplotlib.axes._axes.Axes.errorbarmatplotlib.backend_bases.GraphicsContextBase.get_hatch_pathmatplotlib.markers.MarkerStyle.get_transformmatplotlib.collections.PathCollectionmatplotlib.patches.BoxStyle._Base.transmutematplotlib.pathmatplotlib.markers.MarkerStyle.get_alt_pathHover 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