matplotlib._enums#

Enums representing sets of strings that Matplotlib uses as input parameters.

Matplotlib often uses simple data types like strings or tuples to define aconcept; e.g. the line capstyle can be specified as one of 'butt', 'round',or 'projecting'. The classes in this module are used internally and serve todocument these concepts formally.

As an end-user you will not use these classes directly, but only the valuesthey define.

classmatplotlib._enums.JoinStyle(*values)[source]#

Define how the connection between two line segments is drawn.

For a visual impression of eachJoinStyle,viewthesedocsonline, or runJoinStyle.demo.

Lines in Matplotlib are typically defined by a 1DPath and afinitelinewidth, where the underlying 1DPath represents thecenter of the stroked line.

By default,GraphicsContextBase defines the boundaries ofa stroked line to simply be every point within some radius,linewidth/2, away from any point of the center line. However, thisresults in corners appearing "rounded", which may not be the desiredbehavior if you are drawing, for example, a polygon or pointed star.

Supported values:

'miter'

the "arrow-tip" style. Each boundary of the filled-in area willextend in a straight line parallel to the tangent vector of thecenterline at the point it meets the corner, until they meet in asharp point.

'round'

stokes every point within a radius oflinewidth/2 of the centerlines.

'bevel'

the "squared-off" style. It can be thought of as a rounded cornerwhere the "circular" part of the corner has been cut off.

Note

Very long miter tips are cut off (to form abevel) after abackend-dependent limit called the "miter limit", which specifies themaximum allowed ratio of miter length to line width. For example, thePDF backend uses the default value of 10 specified by the PDF standard,while the SVG backend does not even specify the miter limit, resultingin a default value of 4 per the SVG specification. Matplotlib does notcurrently allow the user to adjust this parameter.

A more detailed description of the effect of a miter limit can be foundin theMozilla Developer Docs

(Sourcecode,2x.png,png)

Demo of possible JoinStyle's
staticdemo()[source]#

Demonstrate how each JoinStyle looks for various join angles.

classmatplotlib._enums.CapStyle(*values)[source]#

Define how the two endpoints (caps) of an unclosed line are drawn.

How to draw the start and end points of lines that represent a closed curve(i.e. that end in aCLOSEPOLY) is controlled by the line'sJoinStyle. For all other lines, how the start and end points are drawn iscontrolled by theCapStyle.

For a visual impression of eachCapStyle,viewthesedocsonline or runCapStyle.demo.

By default,GraphicsContextBase draws a stroked line assquared off at its endpoints.

Supported values:

'butt'

the line is squared off at its endpoint.

'projecting'

the line is squared off as inbutt, but the filled in areaextends beyond the endpoint a distance oflinewidth/2.

'round'

likebutt, but a semicircular cap is added to the end of theline, of radiuslinewidth/2.

(Sourcecode,2x.png,png)

Demo of possible CapStyle's
staticdemo()[source]#

Demonstrate how each CapStyle looks for a thick line segment.