Bases: matplotlib.backends._backend_pdf_ps.RendererPDFPSBase
The renderer handles all the drawing primitives using a graphics context instance that controls the colors/styles.
Draw a Gouraud-shaded triangle.
The graphics context.
Array of (x, y) points for the triangle.
RGBA colors for each point of the triangle.
An affine transform to apply to the points.
Draw a series of Gouraud triangles.
Array of N (x, y) points for the triangles.
Array of N RGBA colors for each point of the triangles.
An affine transform to apply to the points.
Draw an RGBA image.
A graphics context with clipping information.
The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
An array of RGBA pixels.
If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).
Draw a marker at each of path's vertices (excluding control points).
This provides a fallback implementation of draw_markers that makes multiple calls to draw_path(). Some backends may want to override this method in order to draw the marker only once and reuse it multiple times.
The graphics context.
An affine transform applied to the marker.
An affine transform applied to the path.
Draw the math text using matplotlib.mathtext.
Draw a Path instance using the given affine transform.
Draw a collection of paths selecting drawing properties from the lists facecolors, edgecolors, linewidths, linestyles and antialiaseds. offsets is a list of offsets to apply to each of the paths. The offsets in offsets are first transformed by offsetTrans before being applied.
offset_position is unused now, but the argument is kept for backwards compatibility.
This provides a fallback implementation of draw_path_collection() that makes multiple calls to draw_path(). Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods _iter_collection_raw_paths() and _iter_collection() are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of draw_path_collection() can be made globally.
Draw the text instance.
The graphics context.
The x location of the text in display coords.
The y location of the text baseline in display coords.
The text string.
The font properties.
The rotation angle in degrees anti-clockwise.
The original text object to be rendered.
Note for backend implementers:
When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py:
to if 1, and then the actual bounding box will be plotted along with your text.
Get the factor by which to magnify images passed to draw_image. Allows a backend to have images at a different resolution to other artists.


Draw a Gouraud-shaded triangle.
The graphics context.
Array of (x, y) points for the triangle.
RGBA colors for each point of the triangle.
An affine transform to apply to the points.


Draw a series of Gouraud triangles.
Array of N (x, y) points for the triangles.
Array of N RGBA colors for each point of the triangles.
An affine transform to apply to the points.


Draw an RGBA image.
A graphics context with clipping information.
The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
An array of RGBA pixels.
If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).


Draw a marker at each of path's vertices (excluding control points).
This provides a fallback implementation of draw_markers that makes multiple calls to draw_path(). Some backends may want to override this method in order to draw the marker only once and reuse it multiple times.
The graphics context.
An affine transform applied to the marker.
An affine transform applied to the path.


Draw the math text using matplotlib.mathtext.


Draw a Path instance using the given affine transform.


Draw a collection of paths selecting drawing properties from the lists facecolors, edgecolors, linewidths, linestyles and antialiaseds. offsets is a list of offsets to apply to each of the paths. The offsets in offsets are first transformed by offsetTrans before being applied.
offset_position is unused now, but the argument is kept for backwards compatibility.
This provides a fallback implementation of draw_path_collection() that makes multiple calls to draw_path(). Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods _iter_collection_raw_paths() and _iter_collection() are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of draw_path_collection() can be made globally.


Draw the text instance.
The graphics context.
The x location of the text in display coords.
The y location of the text baseline in display coords.
The text string.
The font properties.
The rotation angle in degrees anti-clockwise.
The original text object to be rendered.
Note for backend implementers:
When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py:
to if 1, and then the actual bounding box will be plotted along with your text.


Get the factor by which to magnify images passed to draw_image. Allows a backend to have images at a different resolution to other artists.


Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file. This yields smaller files without illegal encapsulated postscript operators. This distiller is preferred, generating high-level postscript output that treats text as text.


Bases: matplotlib.backend_bases.FigureCanvasBase
Render the Figure.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.
Return the default savefig file format as specified in rcParams["savefig.format"] (default: 'png').
The returned string does not include a period. This method is overridden in backends that only support a single file type.
Output target; if a string, a file will be opened for writing.
Metadata in the SVG file defined as key-value pairs of strings, datetimes, or lists of strings, e.g., {'Creator': 'My software',
'Contributor': ['Me', 'My Friend'], 'Title': 'Awesome'}.
The standard keys and their value types are:
Values have been predefined for 'Creator', 'Date', 'Format', and 'Type'. They can be removed by setting them to None.
Information is encoded as Dublin Core Metadata.


Render the Figure.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


Return the default savefig file format as specified in rcParams["savefig.format"] (default: 'png').
The returned string does not include a period. This method is overridden in backends that only support a single file type.


Output target; if a string, a file will be opened for writing.
Metadata in the SVG file defined as key-value pairs of strings, datetimes, or lists of strings, e.g., {'Creator': 'My software',
'Contributor': ['Me', 'My Friend'], 'Title': 'Awesome'}.
The standard keys and their value types are:
Values have been predefined for 'Creator', 'Date', 'Format', and 'Type'. They can be removed by setting them to None.
Information is encoded as Dublin Core Metadata.


Bases: matplotlib.backend_bases.RendererBase
Close a grouping element with label s.
Only used by the SVG renderer.
Draw a Gouraud-shaded triangle.
The graphics context.
Array of (x, y) points for the triangle.
RGBA colors for each point of the triangle.
An affine transform to apply to the points.
Draw a series of Gouraud triangles.
Array of N (x, y) points for the triangles.
Array of N RGBA colors for each point of the triangles.
An affine transform to apply to the points.
Draw an RGBA image.
A graphics context with clipping information.
The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
An array of RGBA pixels.
If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).
Draw a marker at each of path's vertices (excluding control points).
This provides a fallback implementation of draw_markers that makes multiple calls to draw_path(). Some backends may want to override this method in order to draw the marker only once and reuse it multiple times.
The graphics context.
An affine transform applied to the marker.
An affine transform applied to the path.
Draw a Path instance using the given affine transform.
Draw a collection of paths selecting drawing properties from the lists facecolors, edgecolors, linewidths, linestyles and antialiaseds. offsets is a list of offsets to apply to each of the paths. The offsets in offsets are first transformed by offsetTrans before being applied.
offset_position is unused now, but the argument is kept for backwards compatibility.
This provides a fallback implementation of draw_path_collection() that makes multiple calls to draw_path(). Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods _iter_collection_raw_paths() and _iter_collection() are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of draw_path_collection() can be made globally.
Draw the text instance.
The graphics context.
The x location of the text in display coords.
The y location of the text baseline in display coords.
The text string.
The font properties.
The rotation angle in degrees anti-clockwise.
The original text object to be rendered.
Note for backend implementers:
When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py:
to if 1, and then the actual bounding box will be plotted along with your text.
Return whether y values increase from top to bottom.
Note that this only affects drawing of texts and images.
Return the canvas width and height in display coords.
Get the factor by which to magnify images passed to draw_image(). Allows a backend to have images at a different resolution to other artists.
Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.
Open a grouping element with label s and gid (if set) as id.
Only used by the SVG renderer.
Return whether image composition by Matplotlib should be skipped.
Raster backends should usually return False (letting the C-level rasterizer take care of image composition); vector backends should usually return not rcParams["image.composite_image"].
Return whether arbitrary affine transformations in draw_image() are supported (True for most vector backends).


Close a grouping element with label s.
Only used by the SVG renderer.


Return whether y values increase from top to bottom.
Note that this only affects drawing of texts and images.


Return the canvas width and height in display coords.


Get the factor by which to magnify images passed to draw_image(). Allows a backend to have images at a different resolution to other artists.


Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.


Open a grouping element with label s and gid (if set) as id.
Only used by the SVG renderer.


Return whether image composition by Matplotlib should be skipped.
Raster backends should usually return False (letting the C-level rasterizer take care of image composition); vector backends should usually return not rcParams["image.composite_image"].


Return whether arbitrary affine transformations in draw_image() are supported (True for most vector backends).


Create a short string representation of a float, which is %f formatting with trailing zeros and the decimal point removed.


Bases: object
Close open elements, up to (and including) the element identified by the given identifier.
Element identifier, as returned by the start() method.
Add a comment to the output stream.
Comment text.
Add character data to the output stream.
Character data.
Add an entire element. This is the same as calling start(), data(), and end() in sequence. The text argument can be omitted.
Close the current element (opened by the most recent call to start()).
Element tag. If given, the tag must match the start tag. If omitted, the current element is closed.
Flush the output stream.
Open a new element. Attributes can be given as keyword arguments, or as a string/string dictionary. The method returns an opaque identifier that can be passed to the close() method, to close all open elements up to and including this one.
Element tag.
Attribute dictionary. Alternatively, attributes can be given as keyword arguments.


Close open elements, up to (and including) the element identified by the given identifier.
Element identifier, as returned by the start() method.


Add a comment to the output stream.
Comment text.


Add character data to the output stream.
Character data.


Add an entire element. This is the same as calling start(), data(), and end() in sequence. The text argument can be omitted.


Close the current element (opened by the most recent call to start()).
Element tag. If given, the tag must match the start tag. If omitted, the current element is closed.


Open a new element. Attributes can be given as keyword arguments, or as a string/string dictionary. The method returns an opaque identifier that can be passed to the close() method, to close all open elements up to and including this one.
Element tag.
Attribute dictionary. Alternatively, attributes can be given as keyword arguments.


For image backends - is not required. For GUI backends - this should be overridden if drawing should be done in interactive python mode.


Bases: matplotlib.backend_bases.FigureCanvasBase
The canvas the figure renders into. Calls the draw and print fig methods, creates the renderers, etc.
Note: GUI templates will want to connect events for button presses, mouse movements and key presses to functions that call the base class methods button_press_event, button_release_event, motion_notify_event, key_press_event, and key_release_event. See the implementations of the interactive backends for examples.
A high-level Figure instance
Draw the figure using the renderer.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.
Return the default savefig file format as specified in rcParams["savefig.format"] (default: 'png').
The returned string does not include a period. This method is overridden in backends that only support a single file type.
Write out format foo.
This method is normally called via Figure.savefig and FigureCanvasBase.print_figure, which take care of setting the figure facecolor, edgecolor, and dpi to the desired output values, and will restore them to the original values. Therefore, print_foo does not need to handle these settings.


Draw the figure using the renderer.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


Return the default savefig file format as specified in rcParams["savefig.format"] (default: 'png').
The returned string does not include a period. This method is overridden in backends that only support a single file type.


Write out format foo.
This method is normally called via Figure.savefig and FigureCanvasBase.print_figure, which take care of setting the figure facecolor, edgecolor, and dpi to the desired output values, and will restore them to the original values. Therefore, print_foo does not need to handle these settings.


Bases: matplotlib.backend_bases.FigureManagerBase
Helper class for pyplot mode, wraps everything up into a neat bundle.
For non-interactive backends, the base class is sufficient.


Bases: matplotlib.backend_bases.GraphicsContextBase
The graphics context provides the color, line styles, etc... See the cairo and postscript backends for examples of mapping the graphics context attributes (cap styles, join styles, line widths, colors) to a particular backend. In cairo this is done by wrapping a cairo.Context object and forwarding the appropriate calls to it using a dictionary mapping styles to gdk constants. In Postscript, all the work is done by the renderer, mapping line styles to postscript calls.
If it's more appropriate to do the mapping at the renderer level (as in the postscript backend), you don't need to override any of the GC methods. If it's more appropriate to wrap an instance (as in the cairo backend) and do the mapping here, you'll need to override several of the setter methods.
The base GraphicsContext stores colors as a RGB tuple on the unit interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors appropriate for your backend.


Create a new figure manager instance for the given figure.


Bases: matplotlib.backend_bases.RendererBase
The renderer handles drawing/rendering operations.
This is a minimal do-nothing class that can be used to get started when writing a new backend. Refer to backend_bases.RendererBase for documentation of the methods.
Draw an RGBA image.
A graphics context with clipping information.
The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
An array of RGBA pixels.
If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).
Draw a Path instance using the given affine transform.
Draw the text instance.
The graphics context.
The x location of the text in display coords.
The y location of the text baseline in display coords.
The text string.
The font properties.
The rotation angle in degrees anti-clockwise.
The original text object to be rendered.
Note for backend implementers:
When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py:
to if 1, and then the actual bounding box will be plotted along with your text.
Return whether y values increase from top to bottom.
Note that this only affects drawing of texts and images.
Return the canvas width and height in display coords.
Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.
Return an instance of a GraphicsContextBase.
Convert points to display units.
You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch:
a float or a numpy array of float


Draw an RGBA image.
A graphics context with clipping information.
The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
An array of RGBA pixels.
If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).


Draw a Path instance using the given affine transform.


Draw the text instance.
The graphics context.
The x location of the text in display coords.
The y location of the text baseline in display coords.
The text string.
The font properties.
The rotation angle in degrees anti-clockwise.
The original text object to be rendered.
Note for backend implementers:
When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py:
to if 1, and then the actual bounding box will be plotted along with your text.


Return whether y values increase from top to bottom.
Note that this only affects drawing of texts and images.


Return the canvas width and height in display coords.


Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.


Return an instance of a GraphicsContextBase.


Convert points to display units.
You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch:
a float or a numpy array of float


For image backends - is not required. For GUI backends - show() is usually the last line of a pyplot script and tells the backend that it is time to draw. In interactive mode, this should do nothing.


Bases: matplotlib.backends.backend_agg.FigureCanvasAgg, matplotlib.backends._backend_tk.FigureCanvasTk
Blit the canvas in bbox (default entire canvas).
Render the Figure.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


Blit the canvas in bbox (default entire canvas).


Render the Figure.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


Bases: matplotlib.backends.backend_cairo.FigureCanvasCairo, matplotlib.backends._backend_tk.FigureCanvasTk
Render the Figure.
It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


Bases: threading.Thread
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number.
args is the argument tuple for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
Method representing the thread's activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.


Method representing the thread's activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.


Show all figures.
show blocks by calling mainloop if block is True, or if it is None and we are neither in IPython's %pylab mode, nor in interactive mode.


Bases: tornado.web.Application
Bases: tornado.web.RequestHandler
Bases: tornado.web.RequestHandler
Bases: tornado.web.RequestHandler
Bases: tornado.web.RequestHandler
Bases: tornado.web.RequestHandler
Bases: tornado.websocket.WebSocketHandler
Invoked when the WebSocket is closed.
If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes self.close_code and self.close_reason.
Changed in version 4.0: Added close_code and close_reason attributes.
Handle incoming messages on the WebSocket
This method must be overridden.
Changed in version 4.5: on_message can be a coroutine.
Invoked when a new WebSocket is opened.
The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get.
open may be a coroutine. on_message will not be called until open has returned.
Changed in version 5.1: open may be a coroutine.


Bases: tornado.websocket.WebSocketHandler
Invoked when the WebSocket is closed.
If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes self.close_code and self.close_reason.
Changed in version 4.0: Added close_code and close_reason attributes.
Handle incoming messages on the WebSocket
This method must be overridden.
Changed in version 4.5: on_message can be a coroutine.
Invoked when a new WebSocket is opened.
The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get.
open may be a coroutine. on_message will not be called until open has returned.
Changed in version 5.1: open may be a coroutine.


Invoked when the WebSocket is closed.
If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes self.close_code and self.close_reason.
Changed in version 4.0: Added close_code and close_reason attributes.


Handle incoming messages on the WebSocket
This method must be overridden.
Changed in version 4.5: on_message can be a coroutine.


Invoked when a new WebSocket is opened.
The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get.
open may be a coroutine. on_message will not be called until open has returned.
Changed in version 5.1: open may be a coroutine.


A module providing some utility functions regarding Bezier path manipulation.
Bases: object
A d-dimensional Bezier segment.
Location of the N control points.
Return the dimension and location of the curve's interior extrema.
The extrema are the points along the curve where one of its partial derivatives is zero.
Index \(i\) of the partial derivative which is zero at each interior extrema.
Of same size as dims. The \(t\) such that \(d/dx_i B(t) = 0\)
The control points of the curve.
Degree of the polynomial. One less the number of control points.
The dimension of the curve.
Evaluate the curve at a single point, returning a tuple of d floats.
The polynomial coefficients of the Bezier curve.
Warning
Follows opposite convention from numpy.polyval.
Coefficients after expanding in polynomial basis, where \(n\) is the degree of the bezier curve and \(d\) its dimension. These are the numbers (\(C_j\)) such that the curve can be written \(\sum_{j=0}^n C_j t^j\).
The coefficients are calculated as
where \(P_i\) are the control points of the curve.
Bases: ValueError
Check if two lines are parallel.
The gradients dy/dx of the two lines.
The angular tolerance in radians up to which the lines are considered parallel.
Find the intersection of the Bezier curve with a closed path.
The intersection point t is approximated by two parameters t0, t1 such that t0 <= t <= t1.
Search starts from t0 and t1 and uses a simple bisecting algorithm therefore one of the end points must be inside the path while the other doesn't. The search stops when the distance of the points parametrized by t0 and t1 gets smaller than the given tolerance.
A function returning x, y coordinates of the Bezier at parameter t. It must have the signature:
A function returning True if a given point (x, y) is inside the closed path. It must have the signature:
Start parameters for the search.
Maximal allowed distance between the final points.
The Bezier path parameters.
Find control points of the Bezier curve passing through (c1x, c1y), (mmx, mmy), and (c2x, c2y), at parametric values 0, 0.5, and 1.
Return the intersection between the line through (cx1, cy1) at angle t1 and the line through (cx2, cy2) at angle t2.
For a line passing through (cx, cy) and having an angle t, return locations of the two points located along its perpendicular line at the distance of length.
Given the quadratic Bezier control points bezier2, returns control points of quadratic Bezier lines roughly parallel to given one separated by width.
Return a function that checks whether a point is in a circle with center (cx, cy) and radius r.
The returned function has the signature:
Being similar to get_parallels, returns control points of two quadratic Bezier lines having a width roughly parallel to given one separated by width.
Split a Bezier curve into two at the intersection with a closed path.
Control points of the Bezier segment. See BezierSegment.
A function returning True if a given point (x, y) is inside the closed path. See also find_bezier_t_intersecting_with_closedpath.
The tolerance for the intersection. See also find_bezier_t_intersecting_with_closedpath.
Lists of control points for the two Bezier segments.
Split a Bezier segment defined by its control points beta into two separate segments divided at t and return their control points.
Divide a path into two segments at the point where inside(x, y) becomes False.


Bases: object
A d-dimensional Bezier segment.
Location of the N control points.
Return the dimension and location of the curve's interior extrema.
The extrema are the points along the curve where one of its partial derivatives is zero.
Index \(i\) of the partial derivative which is zero at each interior extrema.
Of same size as dims. The \(t\) such that \(d/dx_i B(t) = 0\)
The control points of the curve.
Degree of the polynomial. One less the number of control points.
The dimension of the curve.
Evaluate the curve at a single point, returning a tuple of d floats.
The polynomial coefficients of the Bezier curve.
Warning
Follows opposite convention from numpy.polyval.
Coefficients after expanding in polynomial basis, where \(n\) is the degree of the bezier curve and \(d\) its dimension. These are the numbers (\(C_j\)) such that the curve can be written \(\sum_{j=0}^n C_j t^j\).
The coefficients are calculated as
where \(P_i\) are the control points of the curve.


Return the dimension and location of the curve's interior extrema.
The extrema are the points along the curve where one of its partial derivatives is zero.
Index \(i\) of the partial derivative which is zero at each interior extrema.
Of same size as dims. The \(t\) such that \(d/dx_i B(t) = 0\)


Evaluate the curve at a single point, returning a tuple of d floats.


Check if two lines are parallel.
The gradients dy/dx of the two lines.
The angular tolerance in radians up to which the lines are considered parallel.


Find the intersection of the Bezier curve with a closed path.
The intersection point t is approximated by two parameters t0, t1 such that t0 <= t <= t1.
Search starts from t0 and t1 and uses a simple bisecting algorithm therefore one of the end points must be inside the path while the other doesn't. The search stops when the distance of the points parametrized by t0 and t1 gets smaller than the given tolerance.
A function returning x, y coordinates of the Bezier at parameter t. It must have the signature:
A function returning True if a given point (x, y) is inside the closed path. It must have the signature:
Start parameters for the search.
Maximal allowed distance between the final points.
The Bezier path parameters.


Find control points of the Bezier curve passing through (c1x, c1y), (mmx, mmy), and (c2x, c2y), at parametric values 0, 0.5, and 1.


Return the intersection between the line through (cx1, cy1) at angle t1 and the line through (cx2, cy2) at angle t2.


For a line passing through (cx, cy) and having an angle t, return locations of the two points located along its perpendicular line at the distance of length.


Given the quadratic Bezier control points bezier2, returns control points of quadratic Bezier lines roughly parallel to given one separated by width.


Return a function that checks whether a point is in a circle with center (cx, cy) and radius r.
The returned function has the signature:


Being similar to get_parallels, returns control points of two quadratic Bezier lines having a width roughly parallel to given one separated by width.


Split a Bezier curve into two at the intersection with a closed path.
Control points of the Bezier segment. See BezierSegment.
A function returning True if a given point (x, y) is inside the closed path. See also find_bezier_t_intersecting_with_closedpath.
The tolerance for the intersection. See also find_bezier_t_intersecting_with_closedpath.
Lists of control points for the two Bezier segments.


Split a Bezier segment defined by its control points beta into two separate segments divided at t and return their control points.


Divide a path into two segments at the point where inside(x, y) becomes False.


Classes used for blocking interaction with figure windows:
Creates a callable object to retrieve events in a blocking way for interactive sessions. Base class of the other classes listed here.
Creates a callable object to retrieve key or mouse clicks in a blocking way for interactive sessions. Used by waitforbuttonpress.
Creates a callable object to retrieve mouse clicks in a blocking way for interactive sessions. Used by ginput.
Creates a callable object to retrieve mouse clicks in a blocking way that will then be used to place labels on a ContourSet. Used by clabel.
Bases: matplotlib.blocking_input.BlockingMouseInput
Callable for retrieving mouse clicks and key presses in a blocking way.
Used to place contour labels.
Add the coordinates of an event to the list of clicks.
Process an button-1 event (add a label to a contour).
Process an button-3 event (remove a label if not in inline mode).
Unfortunately, if one is doing inline labels, then there is currently no way to fix the broken contour - once humpty-dumpty is broken, he can't be put back together. In inline mode, this does nothing.
Remove a click (by default, the last) from the list of clicks.
Bases: object
Callable for retrieving events in a blocking way.
For base class, this just appends an event to events.
Disconnect all callbacks.
Event handler; will be passed to the current figure to retrieve events.
Remove an event from the event list -- by default, the last.
Note that this does not check that there are events, much like the normal pop method. If no events exist, this will throw an exception.
Remove an event from the event list -- by default, the last.
Note that this does not check that there are events, much like the normal pop method. If no events exist, this will throw an exception.
For baseclass, do nothing but collect events.
Bases: matplotlib.blocking_input.BlockingInput
Callable for retrieving mouse clicks and key presses in a blocking way.
Determine if it is a key event.
Bases: matplotlib.blocking_input.BlockingInput
Callable for retrieving mouse clicks in a blocking way.
This class will also retrieve keypresses and map them to mouse clicks: delete and backspace are a right click, enter is like a middle click, and all others are like a left click.
Add the coordinates of an event to the list of clicks.
Not used
Process a key press event, mapping keys to appropriate mouse clicks.
Process a mouse click event.
Process an button-1 event (add a click if inside axes).
Process an button-3 event (remove the last click).
Process an button-2 event (end blocking input).
Remove a click and the associated event from the list of clicks.
Defaults to the last click.
Remove a click (by default, the last) from the list of clicks.
Process an event.


Bases: matplotlib.blocking_input.BlockingMouseInput
Callable for retrieving mouse clicks and key presses in a blocking way.
Used to place contour labels.
Add the coordinates of an event to the list of clicks.
Process an button-1 event (add a label to a contour).
Process an button-3 event (remove a label if not in inline mode).
Unfortunately, if one is doing inline labels, then there is currently no way to fix the broken contour - once humpty-dumpty is broken, he can't be put back together. In inline mode, this does nothing.
Remove a click (by default, the last) from the list of clicks.


Add the coordinates of an event to the list of clicks.


Process an button-1 event (add a label to a contour).


Process an button-3 event (remove a label if not in inline mode).
Unfortunately, if one is doing inline labels, then there is currently no way to fix the broken contour - once humpty-dumpty is broken, he can't be put back together. In inline mode, this does nothing.


Remove a click (by default, the last) from the list of clicks.


Bases: object
Callable for retrieving events in a blocking way.
For base class, this just appends an event to events.
Disconnect all callbacks.
Event handler; will be passed to the current figure to retrieve events.
Remove an event from the event list -- by default, the last.
Note that this does not check that there are events, much like the normal pop method. If no events exist, this will throw an exception.
Remove an event from the event list -- by default, the last.
Note that this does not check that there are events, much like the normal pop method. If no events exist, this will throw an exception.
For baseclass, do nothing but collect events.


For base class, this just appends an event to events.


Event handler; will be passed to the current figure to retrieve events.


Remove an event from the event list -- by default, the last.
Note that this does not check that there are events, much like the normal pop method. If no events exist, this will throw an exception.


For baseclass, do nothing but collect events.


Bases: matplotlib.blocking_input.BlockingInput
Callable for retrieving mouse clicks and key presses in a blocking way.
Determine if it is a key event.


Bases: matplotlib.blocking_input.BlockingInput
Callable for retrieving mouse clicks in a blocking way.
This class will also retrieve keypresses and map them to mouse clicks: delete and backspace are a right click, enter is like a middle click, and all others are like a left click.
Add the coordinates of an event to the list of clicks.
Not used
Process a key press event, mapping keys to appropriate mouse clicks.
Process a mouse click event.
Process an button-1 event (add a click if inside axes).
Process an button-3 event (remove the last click).
Process an button-2 event (end blocking input).
Remove a click and the associated event from the list of clicks.
Defaults to the last click.
Remove a click (by default, the last) from the list of clicks.
Process an event.


Process a key press event, mapping keys to appropriate mouse clicks.


Process an button-1 event (add a click if inside axes).


Process an button-3 event (remove the last click).


Process an button-2 event (end blocking input).


Remove a click and the associated event from the list of clicks.
Defaults to the last click.


Plotting of string "category" data: plot(['d', 'f', 'a'], [1, 2, 3]) will plot three points with x-axis values of 'd', 'f', 'a'.
See Plotting categorical variables for an example.
The module uses Matplotlib's matplotlib.units mechanism to convert from strings to integers and provides a tick locator, a tick formatter, and the UnitData class that creates and stores the string-to-integer mapping.
Bases: matplotlib.units.ConversionInterface
Set the default axis ticks and labels.
object string unit information for value
axis for which information is being set
Note
axis is not used
Information to support default tick labeling
Convert strings in value to floats using mapping information stored in the unit object.
Value or list of values to be converted.
An object mapping strings to integers.
The axis on which the converted value is plotted.
Note
axis is unused.
Set and update the Axis units.
axis on which the data is plotted
object storing string to integer mapping
Bases: matplotlib.ticker.Formatter
String representation of the data at every tick.
Mapping of category names (str) to indices (int).
Return the tick labels for all the ticks at once.
Bases: matplotlib.ticker.Locator
Tick at every integer mapping of the string data.
Mapping of category names (str) to indices (int).
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:
Bases: object
Create mapping between unique categorical values and integer ids.
sequence of string values
Map new values to integer identifiers.
If elements in data are neither str nor bytes.


Bases: matplotlib.units.ConversionInterface
Set the default axis ticks and labels.
object string unit information for value
axis for which information is being set
Note
axis is not used
Information to support default tick labeling
Convert strings in value to floats using mapping information stored in the unit object.
Value or list of values to be converted.
An object mapping strings to integers.
The axis on which the converted value is plotted.
Note
axis is unused.
Set and update the Axis units.
axis on which the data is plotted
object storing string to integer mapping


Set the default axis ticks and labels.
object string unit information for value
axis for which information is being set
Note
axis is not used
Information to support default tick labeling


Convert strings in value to floats using mapping information stored in the unit object.
Value or list of values to be converted.
An object mapping strings to integers.
The axis on which the converted value is plotted.
Note
axis is unused.


Set and update the Axis units.
axis on which the data is plotted
object storing string to integer mapping


Bases: matplotlib.ticker.Formatter
String representation of the data at every tick.
Mapping of category names (str) to indices (int).
Return the tick labels for all the ticks at once.


Return the tick labels for all the ticks at once.


Bases: matplotlib.ticker.Locator
Tick at every integer mapping of the string data.
Mapping of category names (str) to indices (int).
Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Return the values of the located ticks given vmin and vmax.
Note
To get tick locations with the vmin and vmax values defined automatically for the associated axis simply call the Locator instance:


Bases: object
Create mapping between unique categorical values and integer ids.
sequence of string values
Map new values to integer identifiers.
If elements in data are neither str nor bytes.


Map new values to integer identifiers.
If elements in data are neither str nor bytes.


A collection of utility functions and classes. Originally, many (but not all) were from the Python Cookbook -- hence the name cbook.
This module is safe to import from anywhere within Matplotlib; it imports Matplotlib only at runtime.
Bases: object
Handle registering, processing, blocking, and disconnecting for a set of signals and callbacks:
In practice, one should always disconnect all callbacks when they are no longer needed to avoid dangling references (and thus memory leaks). However, real code in Matplotlib rarely does so, and due to its design, it is rather difficult to place this kind of code. To get around this, and prevent this class of memory leaks, we instead store weak references to bound methods only, so when the destination object needs to die, the CallbackRegistry won't keep it alive.
If not None, exception_handler must be a function that takes an Exception as single parameter. It gets called with any Exception raised by the callbacks during CallbackRegistry.process, and may either re-raise the exception or handle it in another manner.
The default handler prints the exception (with traceback.print_exc) if an interactive event loop is running; it re-raises the exception if no interactive event loop is running.
Block callback signals from being processed.
A context manager to temporarily block/disable callback signals from being processed by the registered listeners.
The callback signal to block. The default is to block all signals.
Register func to be called when signal signal is generated.
Disconnect the callback registered with callback id cid.
No error is raised if such a callback does not exist.
Process signal s.
All of the functions registered to receive callbacks on s will be called with *args and **kwargs.
Bases: object
A disjoint-set data structure.
Objects can be joined using join(), tested for connectedness using joined(), and all disjoint sets can be retrieved by using the object as an iterator.
The objects being joined must be hashable and weak-referenceable.
Clean dead weak references from the dictionary.
Return all of the items joined with a, including itself.
Join given arguments into the same set. Accepts one or more arguments.
Return whether a and b are members of the same set.
Bases: object
Stack of elements with a movable cursor.
Mimics home/back/forward in a web browser.
Move the position back and return the current element.
Raise all references of o to the top of the stack, and return it.
If o is not in the stack.
Empty the stack.
Return whether the stack is empty.
Move the position forward and return the current element.
Push the first element onto the top of the stack.
The first element is returned.
Push o to the stack at current position. Discard all later elements.
o is returned.
Remove o from the stack.
If o is not in the stack.
Return a list of dictionaries of statistics used to draw a series of box and whisker plots using bxp.
Data that will be represented in the boxplots. Should have 2 or fewer dimensions.
The position of the whiskers.
If a float, the lower whisker is at the lowest datum above Q1 - whis*(Q3-Q1), and the upper whisker at the highest datum below Q3 + whis*(Q3-Q1), where Q1 and Q3 are the first and third quartiles. The default value of whis = 1.5 corresponds to Tukey's original definition of boxplots.
If a pair of floats, they indicate the percentiles at which to draw the whiskers (e.g., (5, 95)). In particular, setting this to (0, 100) results in whiskers covering the whole range of the data.
In the edge case where Q1 == Q3, whis is automatically set to (0, 100) (cover the whole range of the data) if autorange is True.
Beyond the whiskers, data are considered outliers and are plotted as individual points.
Number of times the confidence intervals around the median should be bootstrapped (percentile method).
Labels for each dataset. Length must be compatible with dimensions of X.
When True and the data are distributed such that the 25th and 75th percentiles are equal, whis is set to (0, 100) such that the whisker ends are at the minimum and maximum of the data.
A list of dictionaries containing the results for each column of data. Keys of each dictionary are the following:
Key
Value Description
label
tick label for the boxplot
mean
arithmetic mean value
med
50th percentile
q1
first quartile (25th percentile)
q3
third quartile (75th percentile)
cilo
lower notch around the median
cihi
upper notch around the median
whislo
end of the lower whisker
whishi
end of the upper whisker
fliers
outliers
Non-bootstrapping approach to confidence interval uses Gaussian-based asymptotic approximation:
General approach from: McGill, R., Tukey, J.W., and Larsen, W.A. (1978) "Variations of Boxplots", The American Statistician, 32:12-16.
Return a list of (ind0, ind1) such that mask[ind0:ind1].all() is True and we cover all such regions.
Find all masked and/or non-finite points in a set of arguments, and return the arguments with only the unmasked points remaining.
Arguments can be in any of 5 categories:
The first argument must be in one of the first four categories; any argument with a length differing from that of the first argument (and hence anything in category 5) then will be passed through unchanged.
Masks are obtained from all arguments of the correct length in categories 1, 2, and 4; a point is bad if masked in a masked array or if it is a nan or inf. No attempt is made to extract a mask from categories 2, 3, and 4 if numpy.isfinite does not yield a Boolean array.
All input arguments that are not passed unchanged are returned as ndarrays after removing the points or rows corresponding to masks in any of the arguments.
A vastly simpler version of this function was originally written as a helper for Axes.scatter().
[Deprecated]
Deprecated since version 3.4:
Return whether the given writable file-like object requires Unicode to be written to it.
Return a generator of flattened nested containers.
For example:
By: Composite of Holger Krekel and Luther Blissett From: https://code.activestate.com/recipes/121294/ and Recipe 1.12 in cookbook
Return a sample data file. fname is a path relative to the mpl-data/sample_data directory. If asfileobj is True return a file object, otherwise just a file path.
Sample data files are stored in the 'mpl-data/sample_data' directory within the Matplotlib package.
If the filename ends in .gz, the file is implicitly ungzipped. If the filename ends with .npy or .npz, asfileobj is True, and np_load is True, the file is loaded with numpy.load. np_load currently defaults to False but will default to True in a future release.
A helper function to create reasonable x values for the given y.
This is used for plotting (x, y) if x values are not explicitly given.
First try y.index (assuming y is a pandas.Series), if that fails, use range(len(y)).
This will be extended in the future to deal with more types of labeled data.
The x and y values to plot.
Return whether the string s contains math expressions.
This is done by checking whether s contains an even number of non-escaped dollar signs.
Return whether the given object is a scalar or string like.
Return whether obj looks like a file object with a write method.
Maps short codes for line style to their full name used by backends.
Maps full names for line styles used by backends to their short codes.
Bases: dict
A dictionary with a maximum size.
This doesn't override all the relevant methods to constrain the size, just __setitem__, so use with caution.
Helper function to normalize kwarg inputs.
A dict of keyword arguments. None is explicitly supported and treated as an empty dict, to support functions with an optional parameter of the form props=None.
A mapping between a canonical name to a list of aliases, in order of precedence from lowest to highest.
If the canonical value is not in the list it is assumed to have the highest priority.
If an Artist subclass or instance is passed, use its properties alias mapping.
To match what Python raises if invalid arguments/keyword arguments are passed to a callable.
Pass through file objects and context-manage path-likes.
Print loops of cyclic references in the given objects.
It is often useful to pass in gc.garbage to find the cycles that are preventing some objects from being garbage collected.
A list of objects to find cycles in.
The stream for output.
If True, print the number of objects reached as they are found.
Convert continuous line to mid-steps.
Given a set of N points convert to 2N points which when connected linearly give a step function which changes values at the middle of the intervals.
The x location of the steps. May be empty.
y arrays to be turned into steps; all must be the same length as x.
The x and y values converted to steps in the same order as the input; can be unpacked as x_out, y1_out, ..., yp_out. If the input is length N, each of these arrays will be length 2N.
Convert continuous line to post-steps.
Given a set of N points convert to 2N + 1 points, which when connected linearly give a step function which changes values at the end of the intervals.
The x location of the steps. May be empty.
y arrays to be turned into steps; all must be the same length as x.
The x and y values converted to steps in the same order as the input; can be unpacked as x_out, y1_out, ..., yp_out. If the input is length N, each of these arrays will be length 2N + 1. For N=0, the length will be 0.
Convert continuous line to pre-steps.
Given a set of N points, convert to 2N - 1 points, which when connected linearly give a step function which changes values at the beginning of the intervals.
The x location of the steps. May be empty.
y arrays to be turned into steps; all must be the same length as x.
The x and y values converted to steps in the same order as the input; can be unpacked as x_out, y1_out, ..., yp_out. If the input is length N, each of these arrays will be length 2N + 1. For N=0, the length will be 0.
[Deprecated] Return the memory consumed by the process.
Deprecated since version 3.5.
Return the first element in obj.
This is an type-independent way of obtaining the first element, supporting both index access and the iterator protocol.
Convert dictview objects to list. Other inputs are returned unchanged.
Bases: list
A list with a short repr().
This is meant to be used for a homogeneous list of artists, so that they don't cause long, meaningless output.
Instead of
one will get
If self.type is None, the type name is obtained from the first item in the list (if any).
Resample an array with steps - 1 points between original point pairs.
Along each column of a, (steps - 1) points are introduced between each original values; the values are linearly interpolated.
shape ((n - 1) * steps + 1, ...)
Remove latex formatting from mathtext.
Only handles fully math and fully non-math strings.
Convert a path to an open file handle or pass-through a file-like object.
Consider using open_file_cm instead, as it allows one to properly close newly created file objects more easily.
If str or os.PathLike, the file is opened using the flags specified by flag and encoding. If a file-like object, it is passed through.
Passed as the mode argument to open when fname is str or os.PathLike; ignored if fname is file-like.
If True, return both the file object and a boolean indicating whether this was a new file (that the caller needs to close). If False, return only the new file.
Passed as the mode argument to open when fname is str or os.PathLike; ignored if fname is file-like.
opened is only returned if return_opened is True.
Return a list of dictionaries of data which can be used to draw a series of violin plots.
See the Returns section below to view the required keys of the dictionary.
Users can skip this function and pass a user-defined set of dictionaries with the same keys to violinplot instead of using Matplotlib to do the calculations. See the Returns section below for the keys that must be present in the dictionaries.
Sample data that will be used to produce the gaussian kernel density estimates. Must have 2 or fewer dimensions.
The method used to calculate the kernel density estimate for each column of data. When called via method(v, coords), it should return a vector of the values of the KDE evaluated at the values specified in coords.
Defines the number of points to evaluate each of the gaussian kernel density estimates at.
Defines (if not None) a list of floats in interval [0, 1] for each column of data, which represents the quantiles that will be rendered for that column of data. Must have 2 or fewer dimensions. 1D array will be treated as a singleton list containing them.
A list of dictionaries containing the results for each column of data. The dictionaries contain at least the following:
[Deprecated]
Deprecated since version 3.4:


Return a list of dictionaries of statistics used to draw a series of box and whisker plots using bxp.
Data that will be represented in the boxplots. Should have 2 or fewer dimensions.
The position of the whiskers.
If a float, the lower whisker is at the lowest datum above Q1 - whis*(Q3-Q1), and the upper whisker at the highest datum below Q3 + whis*(Q3-Q1), where Q1 and Q3 are the first and third quartiles. The default value of whis = 1.5 corresponds to Tukey's original definition of boxplots.
If a pair of floats, they indicate the percentiles at which to draw the whiskers (e.g., (5, 95)). In particular, setting this to (0, 100) results in whiskers covering the whole range of the data.
In the edge case where Q1 == Q3, whis is automatically set to (0, 100) (cover the whole range of the data) if autorange is True.
Beyond the whiskers, data are considered outliers and are plotted as individual points.
Number of times the confidence intervals around the median should be bootstrapped (percentile method).
Labels for each dataset. Length must be compatible with dimensions of X.
When True and the data are distributed such that the 25th and 75th percentiles are equal, whis is set to (0, 100) such that the whisker ends are at the minimum and maximum of the data.
A list of dictionaries containing the results for each column of data. Keys of each dictionary are the following:
Key
Value Description
label
tick label for the boxplot
mean
arithmetic mean value
med
50th percentile
q1
first quartile (25th percentile)
q3
third quartile (75th percentile)
cilo
lower notch around the median
cihi
upper notch around the median
whislo
end of the lower whisker
whishi
end of the upper whisker
fliers
outliers
Non-bootstrapping approach to confidence interval uses Gaussian-based asymptotic approximation:
General approach from: McGill, R., Tukey, J.W., and Larsen, W.A. (1978) "Variations of Boxplots", The American Statistician, 32:12-16.


Bases: object
Handle registering, processing, blocking, and disconnecting for a set of signals and callbacks:
In practice, one should always disconnect all callbacks when they are no longer needed to avoid dangling references (and thus memory leaks). However, real code in Matplotlib rarely does so, and due to its design, it is rather difficult to place this kind of code. To get around this, and prevent this class of memory leaks, we instead store weak references to bound methods only, so when the destination object needs to die, the CallbackRegistry won't keep it alive.
If not None, exception_handler must be a function that takes an Exception as single parameter. It gets called with any Exception raised by the callbacks during CallbackRegistry.process, and may either re-raise the exception or handle it in another manner.
The default handler prints the exception (with traceback.print_exc) if an interactive event loop is running; it re-raises the exception if no interactive event loop is running.
Block callback signals from being processed.
A context manager to temporarily block/disable callback signals from being processed by the registered listeners.
The callback signal to block. The default is to block all signals.
Register func to be called when signal signal is generated.
Disconnect the callback registered with callback id cid.
No error is raised if such a callback does not exist.
Process signal s.
All of the functions registered to receive callbacks on s will be called with *args and **kwargs.


Block callback signals from being processed.
A context manager to temporarily block/disable callback signals from being processed by the registered listeners.
The callback signal to block. The default is to block all signals.


Register func to be called when signal signal is generated.


Disconnect the callback registered with callback id cid.
No error is raised if such a callback does not exist.


Process signal s.
All of the functions registered to receive callbacks on s will be called with *args and **kwargs.


Return a list of (ind0, ind1) such that mask[ind0:ind1].all() is True and we cover all such regions.


Find all masked and/or non-finite points in a set of arguments, and return the arguments with only the unmasked points remaining.
Arguments can be in any of 5 categories:
The first argument must be in one of the first four categories; any argument with a length differing from that of the first argument (and hence anything in category 5) then will be passed through unchanged.
Masks are obtained from all arguments of the correct length in categories 1, 2, and 4; a point is bad if masked in a masked array or if it is a nan or inf. No attempt is made to extract a mask from categories 2, 3, and 4 if numpy.isfinite does not yield a Boolean array.
All input arguments that are not passed unchanged are returned as ndarrays after removing the points or rows corresponding to masks in any of the arguments.
A vastly simpler version of this function was originally written as a helper for Axes.scatter().


[Deprecated]
Deprecated since version 3.4:


Return whether the given writable file-like object requires Unicode to be written to it.


Return a generator of flattened nested containers.
For example:
By: Composite of Holger Krekel and Luther Blissett From: https://code.activestate.com/recipes/121294/ and Recipe 1.12 in cookbook


Return a sample data file. fname is a path relative to the mpl-data/sample_data directory. If asfileobj is True return a file object, otherwise just a file path.
Sample data files are stored in the 'mpl-data/sample_data' directory within the Matplotlib package.
If the filename ends in .gz, the file is implicitly ungzipped. If the filename ends with .npy or .npz, asfileobj is True, and np_load is True, the file is loaded with numpy.load. np_load currently defaults to False but will default to True in a future release.


Bases: object
A disjoint-set data structure.
Objects can be joined using join(), tested for connectedness using joined(), and all disjoint sets can be retrieved by using the object as an iterator.
The objects being joined must be hashable and weak-referenceable.
Clean dead weak references from the dictionary.
Return all of the items joined with a, including itself.
Join given arguments into the same set. Accepts one or more arguments.
Return whether a and b are members of the same set.


Clean dead weak references from the dictionary.


Return all of the items joined with a, including itself.


Join given arguments into the same set. Accepts one or more arguments.


Return whether a and b are members of the same set.


A helper function to create reasonable x values for the given y.
This is used for plotting (x, y) if x values are not explicitly given.
First try y.index (assuming y is a pandas.Series), if that fails, use range(len(y)).
This will be extended in the future to deal with more types of labeled data.
The x and y values to plot.


Return whether the string s contains math expressions.
This is done by checking whether s contains an even number of non-escaped dollar signs.


Return whether the given object is a scalar or string like.


Return whether obj looks like a file object with a write method.


Maps short codes for line style to their full name used by backends.


Maps full names for line styles used by backends to their short codes.


Bases: dict
A dictionary with a maximum size.
This doesn't override all the relevant methods to constrain the size, just __setitem__, so use with caution.


Helper function to normalize kwarg inputs.
A dict of keyword arguments. None is explicitly supported and treated as an empty dict, to support functions with an optional parameter of the form props=None.
A mapping between a canonical name to a list of aliases, in order of precedence from lowest to highest.
If the canonical value is not in the list it is assumed to have the highest priority.
If an Artist subclass or instance is passed, use its properties alias mapping.
To match what Python raises if invalid arguments/keyword arguments are passed to a callable.


Pass through file objects and context-manage path-likes.


Print loops of cyclic references in the given objects.
It is often useful to pass in gc.garbage to find the cycles that are preventing some objects from being garbage collected.
A list of objects to find cycles in.
The stream for output.
If True, print the number of objects reached as they are found.


Convert continuous line to mid-steps.
Given a set of N points convert to 2N points which when connected linearly give a step function which changes values at the middle of the intervals.
The x location of the steps. May be empty.
y arrays to be turned into steps; all must be the same length as x.
The x and y values converted to steps in the same order as the input; can be unpacked as x_out, y1_out, ..., yp_out. If the input is length N, each of these arrays will be length 2N.


Convert continuous line to post-steps.
Given a set of N points convert to 2N + 1 points, which when connected linearly give a step function which changes values at the end of the intervals.
The x location of the steps. May be empty.
y arrays to be turned into steps; all must be the same length as x.
The x and y values converted to steps in the same order as the input; can be unpacked as x_out, y1_out, ..., yp_out. If the input is length N, each of these arrays will be length 2N + 1. For N=0, the length will be 0.


Convert continuous line to pre-steps.
Given a set of N points, convert to 2N - 1 points, which when connected linearly give a step function which changes values at the beginning of the intervals.
The x location of the steps. May be empty.
y arrays to be turned into steps; all must be the same length as x.
The x and y values converted to steps in the same order as the input; can be unpacked as x_out, y1_out, ..., yp_out. If the input is length N, each of these arrays will be length 2N + 1. For N=0, the length will be 0.


[Deprecated] Return the memory consumed by the process.
Deprecated since version 3.5.


Return the first element in obj.
This is an type-independent way of obtaining the first element, supporting both index access and the iterator protocol.


Convert dictview objects to list. Other inputs are returned unchanged.


Bases: list
A list with a short repr().
This is meant to be used for a homogeneous list of artists, so that they don't cause long, meaningless output.
Instead of
one will get
If self.type is None, the type name is obtained from the first item in the list (if any).


Resample an array with steps - 1 points between original point pairs.
Along each column of a, (steps - 1) points are introduced between each original values; the values are linearly interpolated.
shape ((n - 1) * steps + 1, ...)


Bases: object
Stack of elements with a movable cursor.
Mimics home/back/forward in a web browser.
Move the position back and return the current element.
Raise all references of o to the top of the stack, and return it.
If o is not in the stack.
Empty the stack.
Return whether the stack is empty.
Move the position forward and return the current element.
Push the first element onto the top of the stack.
The first element is returned.
Push o to the stack at current position. Discard all later elements.
o is returned.
Remove o from the stack.
If o is not in the stack.


Move the position back and return the current element.


Raise all references of o to the top of the stack, and return it.
If o is not in the stack.


Move the position forward and return the current element.


Push the first element onto the top of the stack.
The first element is returned.


Push o to the stack at current position. Discard all later elements.
o is returned.


Remove o from the stack.
If o is not in the stack.


Remove latex formatting from mathtext.
Only handles fully math and fully non-math strings.


Convert a path to an open file handle or pass-through a file-like object.
Consider using open_file_cm instead, as it allows one to properly close newly created file objects more easily.
If str or os.PathLike, the file is opened using the flags specified by flag and encoding. If a file-like object, it is passed through.
Passed as the mode argument to open when fname is str or os.PathLike; ignored if fname is file-like.
If True, return both the file object and a boolean indicating whether this was a new file (that the caller needs to close). If False, return only the new file.
Passed as the mode argument to open when fname is str or os.PathLike; ignored if fname is file-like.
opened is only returned if return_opened is True.


Return a list of dictionaries of data which can be used to draw a series of violin plots.
See the Returns section below to view the required keys of the dictionary.
Users can skip this function and pass a user-defined set of dictionaries with the same keys to violinplot instead of using Matplotlib to do the calculations. See the Returns section below for the keys that must be present in the dictionaries.
Sample data that will be used to produce the gaussian kernel density estimates. Must have 2 or fewer dimensions.
The method used to calculate the kernel density estimate for each column of data. When called via method(v, coords), it should return a vector of the values of the KDE evaluated at the values specified in coords.
Defines the number of points to evaluate each of the gaussian kernel density estimates at.
Defines (if not None) a list of floats in interval [0, 1] for each column of data, which represents the quantiles that will be rendered for that column of data. Must have 2 or fewer dimensions. 1D array will be treated as a singleton list containing them.
A list of dictionaries containing the results for each column of data. The dictionaries contain at least the following:


[Deprecated]
Deprecated since version 3.4:


Builtin colormaps, colormap handling utilities, and the ScalarMappable mixin.
See also
Colormap reference for a list of builtin colormaps.
Creating Colormaps in Matplotlib for examples of how to make colormaps.
Choosing Colormaps in Matplotlib an in-depth discussion of choosing colormaps.
Colormap Normalization for more details about data normalization.
Bases: collections.abc.Mapping
Container for colormaps that are known to Matplotlib by name.
Experimental
While we expect the API to be final, we formally mark it as experimental for 3.5 because we want to keep the option to still adapt the API for 3.6 should the need arise.
The universal registry instance is matplotlib.colormaps. There should be no need for users to instantiate ColormapRegistry themselves.
Read access uses a dict-like interface mapping names to Colormaps:
Returned Colormaps are copies, so that their modification does not change the global definition of the colormap.
Additional colormaps can be added via ColormapRegistry.register:
Register a new colormap.
The colormap name can then be used as a string argument to any cmap parameter in Matplotlib. It is also available in pyplot.get_cmap.
The colormap registry stores a copy of the given colormap, so that future changes to the original colormap instance do not affect the registered colormap. Think of this as the registry taking a snapshot of the colormap at registration.
The colormap to register.
The name for the colormap. If not given, cmap.name is used.
If False, a ValueError is raised if trying to overwrite an already registered name. True supports overwriting registered colormaps other than the builtin colormaps.
Bases: object
A mixin class to map scalar data to RGBA.
The ScalarMappable applies data normalization before returning RGBA colors from the given colormap.
The normalizing object which scales data, typically into the interval [0, 1]. If None, norm defaults to a colors.Normalize object which initializes its scaling based on the first data processed.
The colormap used to map normalized data values to RGBA colors.
Autoscale the scalar limits on the norm instance using the current array
Autoscale the scalar limits on the norm instance using the current array, changing only limits that are None
Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.
The last colorbar associated with this ScalarMappable. May be None.
Always returns 1.
Return the array of values, that are mapped to colors.
The base class ScalarMappable does not make any assumptions on the dimensionality and shape of the array.
Return the values (min, max) that are mapped to the colormap limits.
Return the Colormap instance.
Set the value array from array-like A.
The values that are mapped to colors.
The base class ScalarMappable does not make any assumptions on the dimensionality and shape of the value array A.
Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.
Set the colormap for luminance data.
Set the normalization instance.
If there are any colorbars using the mappable for this norm, setting the norm of the mappable will reset the norm, locator, and formatters on the colorbar to default.
Return a normalized rgba array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).
Get a colormap instance, defaulting to rc values if name is None.
Colormaps added with register_cmap() take precedence over built-in colormaps.
If a Colormap instance, it will be returned. Otherwise, the name of a colormap known to Matplotlib, which will be resampled by lut. The default, None, means rcParams["image.cmap"] (default: 'viridis').
If name is not already a Colormap instance and lut is not None, the colormap will be resampled to have lut entries in the lookup table.
Currently, this returns the global colormap object, which is deprecated. In Matplotlib 3.5, you will no longer be able to modify the global colormaps in-place.
Add a colormap to the set recognized by get_cmap().
Register a new colormap to be accessed by name
The name that can be used in get_cmap() or rcParams["image.cmap"] (default: 'viridis')
If absent, the name will be the name attribute of the cmap.
Despite being the second argument and having a default value, this is a required argument.
Allow built-in colormaps to be overridden by a user-supplied colormap.
Please do not use this unless you are sure you need it.
Registering a colormap stores a reference to the colormap object which can currently be modified and inadvertently change the global colormap state. This behavior is deprecated and in Matplotlib 3.5 the registered colormap will be immutable.
Remove a colormap recognized by get_cmap().
You may not remove built-in colormaps.
If the named colormap is not registered, returns with no error, raises if you try to de-register a default colormap.
Warning
Colormap names are currently a shared namespace that may be used by multiple packages. Use unregister_cmap only if you know you have registered that name before. In particular, do not unregister just in case to clean the name before registering a new colormap.
The name of the colormap to be un-registered
If the colormap was registered, return it if not return None
If you try to de-register a default built-in colormap.


Bases: collections.abc.Mapping
Container for colormaps that are known to Matplotlib by name.
Experimental
While we expect the API to be final, we formally mark it as experimental for 3.5 because we want to keep the option to still adapt the API for 3.6 should the need arise.
The universal registry instance is matplotlib.colormaps. There should be no need for users to instantiate ColormapRegistry themselves.
Read access uses a dict-like interface mapping names to Colormaps:
Returned Colormaps are copies, so that their modification does not change the global definition of the colormap.
Additional colormaps can be added via ColormapRegistry.register:
Register a new colormap.
The colormap name can then be used as a string argument to any cmap parameter in Matplotlib. It is also available in pyplot.get_cmap.
The colormap registry stores a copy of the given colormap, so that future changes to the original colormap instance do not affect the registered colormap. Think of this as the registry taking a snapshot of the colormap at registration.
The colormap to register.
The name for the colormap. If not given, cmap.name is used.
If False, a ValueError is raised if trying to overwrite an already registered name. True supports overwriting registered colormaps other than the builtin colormaps.


Register a new colormap.
The colormap name can then be used as a string argument to any cmap parameter in Matplotlib. It is also available in pyplot.get_cmap.
The colormap registry stores a copy of the given colormap, so that future changes to the original colormap instance do not affect the registered colormap. Think of this as the registry taking a snapshot of the colormap at registration.
The colormap to register.
The name for the colormap. If not given, cmap.name is used.
If False, a ValueError is raised if trying to overwrite an already registered name. True supports overwriting registered colormaps other than the builtin colormaps.


Get a colormap instance, defaulting to rc values if name is None.
Colormaps added with register_cmap() take precedence over built-in colormaps.
If a Colormap instance, it will be returned. Otherwise, the name of a colormap known to Matplotlib, which will be resampled by lut. The default, None, means rcParams["image.cmap"] (default: 'viridis').
If name is not already a Colormap instance and lut is not None, the colormap will be resampled to have lut entries in the lookup table.
Currently, this returns the global colormap object, which is deprecated. In Matplotlib 3.5, you will no longer be able to modify the global colormaps in-place.


Add a colormap to the set recognized by get_cmap().
Register a new colormap to be accessed by name
The name that can be used in get_cmap() or rcParams["image.cmap"] (default: 'viridis')
If absent, the name will be the name attribute of the cmap.
Despite being the second argument and having a default value, this is a required argument.
Allow built-in colormaps to be overridden by a user-supplied colormap.
Please do not use this unless you are sure you need it.
Registering a colormap stores a reference to the colormap object which can currently be modified and inadvertently change the global colormap state. This behavior is deprecated and in Matplotlib 3.5 the registered colormap will be immutable.


Bases: object
A mixin class to map scalar data to RGBA.
The ScalarMappable applies data normalization before returning RGBA colors from the given colormap.
The normalizing object which scales data, typically into the interval [0, 1]. If None, norm defaults to a colors.Normalize object which initializes its scaling based on the first data processed.
The colormap used to map normalized data values to RGBA colors.
Autoscale the scalar limits on the norm instance using the current array
Autoscale the scalar limits on the norm instance using the current array, changing only limits that are None
Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.
The last colorbar associated with this ScalarMappable. May be None.
Always returns 1.
Return the array of values, that are mapped to colors.
The base class ScalarMappable does not make any assumptions on the dimensionality and shape of the array.
Return the values (min, max) that are mapped to the colormap limits.
Return the Colormap instance.
Set the value array from array-like A.
The values that are mapped to colors.
The base class ScalarMappable does not make any assumptions on the dimensionality and shape of the value array A.
Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.
Set the colormap for luminance data.
Set the normalization instance.
If there are any colorbars using the mappable for this norm, setting the norm of the mappable will reset the norm, locator, and formatters on the colorbar to default.
Return a normalized rgba array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).


Autoscale the scalar limits on the norm instance using the current array


Autoscale the scalar limits on the norm instance using the current array, changing only limits that are None


Call this whenever the mappable is changed to notify all the callbackSM listeners to the 'changed' signal.


The last colorbar associated with this ScalarMappable. May be None.


Return the array of values, that are mapped to colors.
The base class ScalarMappable does not make any assumptions on the dimensionality and shape of the array.


Return the values (min, max) that are mapped to the colormap limits.


Set the value array from array-like A.
The values that are mapped to colors.
The base class ScalarMappable does not make any assumptions on the dimensionality and shape of the value array A.


Set the norm limits for image scaling.
The limits.
The limits may also be passed as a tuple (vmin, vmax) as a single positional argument.


Set the normalization instance.
If there are any colorbars using the mappable for this norm, setting the norm of the mappable will reset the norm, locator, and formatters on the colorbar to default.


Return a normalized rgba array corresponding to x.
In the normal case, x is a 1D or 2D sequence of scalars, and the corresponding ndarray of rgba values will be returned, based on the norm and colormap set for this ScalarMappable.
There is one special case, for handling images that are already rgb or rgba, such as might have been read from an image file. If x is an ndarray with 3 dimensions, and the last dimension is either 3 or 4, then it will be treated as an rgb or rgba array, and no mapping will be done. The array can be uint8, or it can be floating point with values in the 0-1 range; otherwise a ValueError will be raised. If it is a masked array, the mask will be ignored. If the last dimension is 3, the alpha kwarg (defaulting to 1) will be used to fill in the transparency. If the last dimension is 4, the alpha kwarg is ignored; it does not replace the pre-existing alpha. A ValueError will be raised if the third dimension is other than 3 or 4.
In either case, if bytes is False (default), the rgba array will be floats in the 0-1 range; if it is True, the returned rgba array will be uint8 in the 0 to 255 range.
If norm is False, no normalization of the input data is performed, and it is assumed to be in the range (0-1).


Remove a colormap recognized by get_cmap().
You may not remove built-in colormaps.
If the named colormap is not registered, returns with no error, raises if you try to de-register a default colormap.
Warning
Colormap names are currently a shared namespace that may be used by multiple packages. Use unregister_cmap only if you know you have registered that name before. In particular, do not unregister just in case to clean the name before registering a new colormap.
The name of the colormap to be un-registered
If the colormap was registered, return it if not return None
If you try to de-register a default built-in colormap.