You are reading an old version of the documentation (v1.5.3). For the latest version see https://matplotlib.org/stable/api/patheffects_api.html

Matplotlib 2.0.0rc2 is available

Install the release candidate now!

matplotlib

Travis-CI:

Table Of Contents

This Page

patheffects

matplotlib.patheffects

Defines classes for path effects. The path effects are supported in Text, Line2D and Patch.

class matplotlib.patheffects.AbstractPathEffect(offset=(0.0, 0.0))

Bases: object

A base class for path effects.

Subclasses should override the draw_path method to add effect functionality.

Parameters:

offset : pair of floats

The offset to apply to the path, measured in points.

draw_path(renderer, gc, tpath, affine, rgbFace=None)

Derived should override this method. The arguments are the same as matplotlib.backend_bases.RendererBase.draw_path() except the first argument is a renderer.

class matplotlib.patheffects.Normal(offset=(0.0, 0.0))

Bases: matplotlib.patheffects.AbstractPathEffect

The “identity” PathEffect.

The Normal PathEffect’s sole purpose is to draw the original artist with no special path effect.

Parameters:

offset : pair of floats

The offset to apply to the path, measured in points.

class matplotlib.patheffects.PathEffectRenderer(path_effects, renderer)

Bases: matplotlib.backend_bases.RendererBase

Implements a Renderer which contains another renderer.

This proxy then intercepts draw calls, calling the appropriate AbstractPathEffect draw method.

Note

Not all methods have been overridden on this RendererBase subclass. It may be necessary to add further methods to extend the PathEffects capabilities further.

Parameters:

path_effects : iterable of AbstractPathEffect

The path effects which this renderer represents.

renderer : matplotlib.backend_bases.RendererBase instance

copy_with_path_effect(path_effects)
draw_markers(gc, marker_path, marker_trans, path, *args, **kwargs)
draw_path(gc, tpath, affine, rgbFace=None)
draw_path_collection(gc, master_transform, paths, *args, **kwargs)
new_gc()
points_to_pixels(points)
class matplotlib.patheffects.PathPatchEffect(offset=(0, 0), **kwargs)

Bases: matplotlib.patheffects.AbstractPathEffect

Draws a PathPatch instance whose Path comes from the original PathEffect artist.

Parameters:

offset : pair of floats

The offset to apply to the path, in points.

**kwargs :

All keyword arguments are passed through to the PathPatch constructor. The properties which cannot be overridden are “path”, “clip_box” “transform” and “clip_path”.

draw_path(renderer, gc, tpath, affine, rgbFace)
class matplotlib.patheffects.SimpleLineShadow(offset=(2, -2), shadow_color='k', alpha=0.3, rho=0.3, **kwargs)

Bases: matplotlib.patheffects.AbstractPathEffect

A simple shadow via a line.

Parameters:

offset : pair of floats

The offset to apply to the path, in points.

shadow_color : color

The shadow color. Default is black. A value of None takes the original artist’s color with a scale factor of rho.

alpha : float

The alpha transparency of the created shadow patch. Default is 0.3.

rho : float

A scale factor to apply to the rgbFace color if shadow_rgbFace is None. Default is 0.3.

**kwargs

Extra keywords are stored and passed through to AbstractPathEffect._update_gc().

draw_path(renderer, gc, tpath, affine, rgbFace)

Overrides the standard draw_path to add the shadow offset and necessary color changes for the shadow.

class matplotlib.patheffects.SimplePatchShadow(offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs)

Bases: matplotlib.patheffects.AbstractPathEffect

A simple shadow via a filled patch.

Parameters:

offset : pair of floats

The offset of the shadow in points.

shadow_rgbFace : color

The shadow color.

alpha : float

The alpha transparency of the created shadow patch. Default is 0.3. http://matplotlib.1069221.n5.nabble.com/path-effects-question-td27630.html

rho : float

A scale factor to apply to the rgbFace color if shadow_rgbFace is not specified. Default is 0.3.

**kwargs

Extra keywords are stored and passed through to AbstractPathEffect._update_gc().

draw_path(renderer, gc, tpath, affine, rgbFace)

Overrides the standard draw_path to add the shadow offset and necessary color changes for the shadow.

class matplotlib.patheffects.Stroke(offset=(0, 0), **kwargs)

Bases: matplotlib.patheffects.AbstractPathEffect

A line based PathEffect which re-draws a stroke.

The path will be stroked with its gc updated with the given keyword arguments, i.e., the keyword arguments should be valid gc parameter values.

draw_path(renderer, gc, tpath, affine, rgbFace)

draw the path with updated gc.

class matplotlib.patheffects.withSimplePatchShadow(offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs)

Bases: matplotlib.patheffects.SimplePatchShadow

Adds a simple SimplePatchShadow and then draws the original Artist to avoid needing to call Normal.

Parameters:

offset : pair of floats

The offset of the shadow in points.

shadow_rgbFace : color

The shadow color.

alpha : float

The alpha transparency of the created shadow patch. Default is 0.3. http://matplotlib.1069221.n5.nabble.com/path-effects-question-td27630.html

rho : float

A scale factor to apply to the rgbFace color if shadow_rgbFace is not specified. Default is 0.3.

**kwargs

Extra keywords are stored and passed through to AbstractPathEffect._update_gc().

draw_path(renderer, gc, tpath, affine, rgbFace)
class matplotlib.patheffects.withStroke(offset=(0, 0), **kwargs)

Bases: matplotlib.patheffects.Stroke

Adds a simple Stroke and then draws the original Artist to avoid needing to call Normal.

The path will be stroked with its gc updated with the given keyword arguments, i.e., the keyword arguments should be valid gc parameter values.

draw_path(renderer, gc, tpath, affine, rgbFace)