mpl.pyplot.Line2D

class mpl.pyplot.Line2D(xdata, ydata, linewidth=None, linestyle=None, color=None, marker=None, markersize=None, markeredgewidth=None, markeredgecolor=None, markerfacecolor=None, markerfacecoloralt=u'none', fillstyle=None, antialiased=None, dash_capstyle=None, solid_capstyle=None, dash_joinstyle=None, solid_joinstyle=None, pickradius=5, drawstyle=None, markevery=None, **kwargs)[source]

A line - the line can have both a solid linestyle connecting all the vertices, and a marker at each vertex. Additionally, the drawing of the solid line is influenced by the drawstyle, e.g., one can create “stepped” lines in various styles.

__init__(xdata, ydata, linewidth=None, linestyle=None, color=None, marker=None, markersize=None, markeredgewidth=None, markeredgecolor=None, markerfacecolor=None, markerfacecoloralt=u'none', fillstyle=None, antialiased=None, dash_capstyle=None, solid_capstyle=None, dash_joinstyle=None, solid_joinstyle=None, pickradius=5, drawstyle=None, markevery=None, **kwargs)[source]

Create a Line2D instance with x and y data in sequences xdata, ydata.

The kwargs are Line2D properties:

agg_filter: unknown alpha: float (0.0 transparent through 1.0 opaque) animated: [True | False] antialiased or aa: [True | False] axes: an Axes instance clip_box: a matplotlib.transforms.Bbox instance clip_on: [True | False] clip_path: [ (Path, Transform) | Patch | None ] color or c: any matplotlib color contains: a callable function dash_capstyle: [‘butt’ | ‘round’ | ‘projecting’] dash_joinstyle: [‘miter’ | ‘round’ | ‘bevel’] dashes: sequence of on/off ink in points drawstyle: [‘default’ | ‘steps’ | ‘steps-pre’ | ‘steps-mid’ | ‘steps-post’] figure: a matplotlib.figure.Figure instance fillstyle: [‘full’ | ‘left’ | ‘right’ | ‘bottom’ | ‘top’ | ‘none’] gid: an id string label: string or anything printable with ‘%s’ conversion. linestyle or ls: [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | ''] linewidth or lw: float value in points marker: A valid marker style markeredgecolor or mec: any matplotlib color markeredgewidth or mew: float value in points markerfacecolor or mfc: any matplotlib color markerfacecoloralt or mfcalt: any matplotlib color markersize or ms: float markevery: [None | int | length-2 tuple of int | slice | list/array of int | float | length-2 tuple of float] path_effects: unknown picker: float distance in points or callable pick function fn(artist, event) pickradius: float distance in points rasterized: [True | False | None] sketch_params: unknown snap: unknown solid_capstyle: [‘butt’ | ‘round’ | ‘projecting’] solid_joinstyle: [‘miter’ | ‘round’ | ‘bevel’] transform: a matplotlib.transforms.Transform instance url: a url string visible: [True | False] xdata: 1D array ydata: 1D array zorder: any number

See set_linestyle() for a decription of the line styles, set_marker() for a description of the markers, and set_drawstyle() for a description of the draw styles.

Methods

__init__(xdata, ydata[, linewidth, ...]) Create a Line2D instance with x and y data in sequences xdata, ydata.
add_callback(func) Adds a callback function that will be called whenever one of the Artist‘s properties changes.
contains(mouseevent) Test whether the mouse event occurred on the line.
convert_xunits(x) For artists in an axes, if the xaxis has units support,
convert_yunits(y) For artists in an axes, if the yaxis has units support,
draw(artist, renderer, *args, **kwargs) draw the Line with renderer unless visibility is False
findobj([match, include_self]) Find artist objects.
format_cursor_data(data) Return cursor data string formatted.
get_aa() alias for get_antialiased
get_agg_filter() return filter function to be used for agg filter
get_alpha() Return the alpha value used for blending - not supported on all
get_animated() Return the artist’s animated state
get_antialiased()
get_axes() Return the Axes instance the artist resides in, or None.
get_c() alias for get_color
get_children() Return a list of the child Artist`s this :class:`Artist contains.
get_clip_box() Return artist clipbox
get_clip_on() Return whether artist uses clipping
get_clip_path() Return artist clip path
get_color()
get_contains() Return the _contains test used by the artist, or None for default.
get_cursor_data(event) Get the cursor data for a given event.
get_dash_capstyle() Get the cap style for dashed linestyles
get_dash_joinstyle() Get the join style for dashed linestyles
get_data([orig]) Return the xdata, ydata.
get_drawstyle()
get_figure() Return the Figure instance the artist belongs to.
get_fillstyle() return the marker fillstyle
get_gid() Returns the group id
get_label() Get the label used for this artist in the legend.
get_linestyle()
get_linewidth()
get_ls() alias for get_linestyle
get_lw() alias for get_linewidth
get_marker()
get_markeredgecolor()
get_markeredgewidth()
get_markerfacecolor()
get_markerfacecoloralt()
get_markersize()
get_markevery() return the markevery setting
get_mec() alias for get_markeredgecolor
get_mew() alias for get_markeredgewidth
get_mfc() alias for get_markerfacecolor
get_mfcalt([alt]) alias for get_markerfacecoloralt
get_ms() alias for get_markersize
get_path() Return the Path object associated with this line.
get_path_effects()
get_picker() Return the picker object used by this artist
get_pickradius() return the pick radius used for containment tests
get_rasterized() return True if the artist is to be rasterized
get_sketch_params() Returns the sketch parameters for the artist.
get_snap() Returns the snap setting which may be:
get_solid_capstyle() Get the cap style for solid linestyles
get_solid_joinstyle() Get the join style for solid linestyles
get_transform() Return the Transform instance used by this artist.
get_transformed_clip_path_and_affine() Return the clip path with the non-affine part of its transformation applied, and the remaining affine part of its transformation.
get_url() Returns the url
get_visible() Return the artist’s visiblity
get_window_extent(renderer)
get_xdata([orig]) Return the xdata.
get_xydata() Return the xy data as a Nx2 numpy array.
get_ydata([orig]) Return the ydata.
get_zorder() Return the Artist‘s zorder.
have_units() Return True if units are set on the x or y axes
hitlist(event) List the children of the artist which contain the mouse event event.
is_dashed() return True if line is dashstyle
is_figure_set() Returns True if the artist is assigned to a Figure.
is_transform_set() Returns True if Artist has a transform explicitly set.
pchanged() Fire an event when property changed, calling all of the registered callbacks.
pick(mouseevent) call signature:
pickable() Return True if Artist is pickable.
properties() return a dictionary mapping property name -> value for all Artist props
recache([always])
recache_always()
remove() Remove the artist from the figure if possible.
remove_callback(oid) Remove a callback based on its id.
set(**kwargs) A property batch setter.
set_aa(val) alias for set_antialiased
set_agg_filter(filter_func) set agg_filter fuction.
set_alpha(alpha) Set the alpha value used for blending - not supported on all backends.
set_animated(b) Set the artist’s animation state.
set_antialiased(b) True if line should be drawin with antialiased rendering
set_axes(axes) Set the Axes instance in which the artist resides, if any.
set_c(val) alias for set_color
set_clip_box(clipbox) Set the artist’s clip Bbox.
set_clip_on(b) Set whether artist uses clipping.
set_clip_path(path[, transform]) Set the artist’s clip path, which may be:
set_color(color) Set the color of the line
set_contains(picker) Replace the contains test used by this artist.
set_dash_capstyle(s) Set the cap style for dashed linestyles
set_dash_joinstyle(s) Set the join style for dashed linestyles
set_dashes(seq) Set the dash sequence, sequence of dashes with on off ink in points.
set_data(*args) Set the x and y data
set_drawstyle(drawstyle) Set the drawstyle of the plot
set_figure(fig) Set the Figure instance the artist belongs to.
set_fillstyle(fs) Set the marker fill style; ‘full’ means fill the whole marker.
set_gid(gid) Sets the (group) id for the artist
set_label(s) Set the label to s for auto legend.
set_linestyle(ls) Set the linestyle of the line (also accepts drawstyles,
set_linewidth(w) Set the line width in points
set_ls(val) alias for set_linestyle
set_lw(val) alias for set_linewidth
set_marker(marker) Set the line marker
set_markeredgecolor(ec) Set the marker edge color
set_markeredgewidth(ew) Set the marker edge width in points
set_markerfacecolor(fc) Set the marker face color.
set_markerfacecoloralt(fc) Set the alternate marker face color.
set_markersize(sz) Set the marker size in points
set_markevery(every) Set the markevery property to subsample the plot when using markers.
set_mec(val) alias for set_markeredgecolor
set_mew(val) alias for set_markeredgewidth
set_mfc(val) alias for set_markerfacecolor
set_mfcalt(val) alias for set_markerfacecoloralt
set_ms(val) alias for set_markersize
set_path_effects(path_effects) set path_effects, which should be a list of instances of
set_picker(p) Sets the event picker details for the line.
set_pickradius(d) Sets the pick radius used for containment tests
set_rasterized(rasterized) Force rasterized (bitmap) drawing in vector backend output.
set_sketch_params([scale, length, randomness]) Sets the sketch parameters.
set_snap(snap) Sets the snap setting which may be:
set_solid_capstyle(s) Set the cap style for solid linestyles
set_solid_joinstyle(s) Set the join style for solid linestyles
set_transform(t) set the Transformation instance used by this artist
set_url(url) Sets the url for the artist
set_visible(b) Set the artist’s visiblity.
set_xdata(x) Set the data np.array for x
set_ydata(y) Set the data np.array for y
set_zorder(level) Set the zorder for the artist.
update(props) Update the properties of this Artist from the dictionary prop.
update_from(other) copy properties from other to self

Attributes

aname
axes The Axes instance the artist resides in, or None.
drawStyleKeys
drawStyles
fillStyles
filled_markers
lineStyles
markers
mouseover
stale If the artist is ‘stale’ and needs to be re-drawn for the output to match the internal state of the artist.
validCap
validJoin
zorder