Bases: matplotlib.artist.Artist
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.
Create a Line2D
instance with x and y data in sequences xdata, ydata.
The kwargs are Line2D
properties:
Property Descriptionagg_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) arrayalpha
floatanimated
boolantialiased
or aa boolclip_box
Bbox
clip_on
boolclip_path
[(Path
,Transform
) |Patch
| None]color
or c colorcontains
callabledash_capstyle
{'butt', 'round', 'projecting'}dash_joinstyle
{'miter', 'round', 'bevel'}dashes
sequence of floats (on/off ink in points) or (None, None)drawstyle
or ds {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'figure
Figure
fillstyle
{'full', 'left', 'right', 'bottom', 'top', 'none'}gid
strin_layout
boollabel
objectlinestyle
or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}linewidth
or lw floatmarker
marker stylemarkeredgecolor
or mec colormarkeredgewidth
or mew floatmarkerfacecolor
or mfc colormarkerfacecoloralt
or mfcalt colormarkersize
or ms floatmarkevery
None or int or (int, int) or slice or List[int] or float or (float, float)path_effects
AbstractPathEffect
picker
float or callable[[Artist, Event], Tuple[bool, dict]]pickradius
floatrasterized
bool or Nonesketch_params
(scale: float, length: float, randomness: float)snap
bool or Nonesolid_capstyle
{'butt', 'round', 'projecting'}solid_joinstyle
{'miter', 'round', 'bevel'}transform
matplotlib.transforms.Transform
url
strvisible
boolxdata
1D arrayydata
1D arrayzorder
float
See set_linestyle()
for a description of the line styles, set_marker()
for a description of the markers, and set_drawstyle()
for a description of the draw styles.
axes
¶
The Axes
instance the artist resides in, or None.
contains
(self, mouseevent)[source]¶
Test whether the mouse event occurred on the line. The pick radius determines the precision of the location test (usually within five points of the value). Use get_pickradius()
or set_pickradius()
to view or modify it.
matplotlib.backend_bases.MouseEvent
Whether any values are within the radius.
A dictionary {'ind': pointlist}
, where pointlist is a list of points of the line that are within the pickradius around the event position.
TODO: sort returned indices by distance
draw
(self, renderer)[source]¶
Draw the Artist using the given renderer.
This method will be overridden in the Artist subclasses. Typically, it is implemented to not have any effect if the Artist is not visible (Artist.get_visible
is False).
drawStyleKeys
= ['default', 'steps-mid', 'steps-pre', 'steps-post', 'steps']¶
drawStyles
= {'default': '_draw_lines', 'steps': '_draw_steps_pre', 'steps-mid': '_draw_steps_mid', 'steps-post': '_draw_steps_post', 'steps-pre': '_draw_steps_pre'}¶
fillStyles
= ('full', 'left', 'right', 'bottom', 'top', 'none')¶
filled_markers
= ('o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd', 'P', 'X')¶
get_aa
(self)¶
Alias for get_antialiased
.
get_antialiased
(self)[source]¶
Return whether antialiased rendering is used.
get_c
(self)¶
Alias for get_color
.
get_color
(self)[source]¶
Return the line color.
See also set_color
.
get_dash_capstyle
(self)[source]¶
Return the cap style for dashed lines.
See also set_dash_capstyle
.
get_dash_joinstyle
(self)[source]¶
Return the join style for dashed lines.
See also set_dash_joinstyle
.
get_data
(self, orig=True)[source]¶
Return the xdata, ydata.
If orig is True, return the original data.
get_drawstyle
(self)[source]¶
Return the drawstyle.
See also set_drawstyle
.
get_ds
(self)¶
Alias for get_drawstyle
.
get_fillstyle
(self)[source]¶
Return the marker fill style.
See also set_fillstyle
.
get_linestyle
(self)[source]¶
Return the linestyle.
See also set_linestyle
.
get_linewidth
(self)[source]¶
Return the linewidth in points.
See also set_linewidth
.
get_ls
(self)¶
Alias for get_linestyle
.
get_lw
(self)¶
Alias for get_linewidth
.
get_marker
(self)[source]¶
Return the line marker.
See also set_marker
.
get_markeredgecolor
(self)[source]¶
Return the marker edge color.
See also set_markeredgecolor
.
get_markeredgewidth
(self)[source]¶
Return the marker edge width in points.
See also set_markeredgewidth
.
get_markerfacecolor
(self)[source]¶
Return the marker face color.
See also set_markerfacecolor
.
get_markerfacecoloralt
(self)[source]¶
Return the alternate marker face color.
See also set_markerfacecoloralt
.
get_markersize
(self)[source]¶
Return the marker size in points.
See also set_markersize
.
get_markevery
(self)[source]¶
Return the markevery setting for marker subsampling.
See also set_markevery
.
get_mec
(self)¶
Alias for get_markeredgecolor
.
get_mew
(self)¶
Alias for get_markeredgewidth
.
get_mfc
(self)¶
Alias for get_markerfacecolor
.
get_mfcalt
(self)¶
Alias for get_markerfacecoloralt
.
get_ms
(self)¶
Alias for get_markersize
.
get_path
(self)[source]¶
Return the Path
object associated with this line.
get_pickradius
(self)[source]¶
Return the pick radius used for containment tests.
See contains
for more details.
get_solid_capstyle
(self)[source]¶
Return the cap style for solid lines.
See also set_solid_capstyle
.
get_solid_joinstyle
(self)[source]¶
Return the join style for solid lines.
See also set_solid_joinstyle
.
get_window_extent
(self, renderer)[source]¶
Get the axes bounding box in display space.
The bounding box' width and height are nonnegative.
Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0.
Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
get_xdata
(self, orig=True)[source]¶
Return the xdata.
If orig is True, return the original data, else the processed data.
get_xydata
(self)[source]¶
Return the xy data as a Nx2 numpy array.
get_ydata
(self, orig=True)[source]¶
Return the ydata.
If orig is True, return the original data, else the processed data.
is_dashed
(self)[source]¶
Return whether line has a dashed linestyle.
See also set_linestyle
.
lineStyles
= {'': '_draw_nothing', ' ': '_draw_nothing', '-': '_draw_solid', '--': '_draw_dashed', '-.': '_draw_dash_dot', ':': '_draw_dotted', 'None': '_draw_nothing'}¶
markers
= {'.': 'point', ',': 'pixel', 'o': 'circle', 'v': 'triangle_down', '^': 'triangle_up', '<': 'triangle_left', '>': 'triangle_right', '1': 'tri_down', '2': 'tri_up', '3': 'tri_left', '4': 'tri_right', '8': 'octagon', 's': 'square', 'p': 'pentagon', '*': 'star', 'h': 'hexagon1', 'H': 'hexagon2', '+': 'plus', 'x': 'x', 'D': 'diamond', 'd': 'thin_diamond', '|': 'vline', '_': 'hline', 'P': 'plus_filled', 'X': 'x_filled', 0: 'tickleft', 1: 'tickright', 2: 'tickup', 3: 'tickdown', 4: 'caretleft', 5: 'caretright', 6: 'caretup', 7: 'caretdown', 8: 'caretleftbase', 9: 'caretrightbase', 10: 'caretupbase', 11: 'caretdownbase', 'None': 'nothing', None: 'nothing', ' ': 'nothing', '': 'nothing'}¶
recache
(self, always=False)[source]¶
recache_always
(self)[source]¶
set_aa
(self, b)¶
Alias for set_antialiased
.
set_antialiased
(self, b)[source]¶
Set whether to use antialiased rendering.
set_c
(self, color)¶
Alias for set_color
.
set_color
(self, color)[source]¶
Set the color of the line.
Parameters:set_dash_capstyle
(self, s)[source]¶
Set the cap style for dashed lines.
Parameters:set_dash_joinstyle
(self, s)[source]¶
Set the join style for dashed lines.
set_dashes
(self, seq)[source]¶
Set the dash sequence.
The dash sequence is a sequence of floats of even length describing the length of dashes and spaces in points.
For example, (5, 2, 1, 2) describes a sequence of 5 point and 1 point dashes separated by 2 point spaces.
Parameters:If seq is empty or (None, None)
, the linestyle will be set to solid.
set_data
(self, *args)[source]¶
Set the x and y data.
Parameters:set_drawstyle
(self, drawstyle)[source]¶
Set the drawstyle of the plot.
The drawstyle determines how the points are connected.
Parameters:For 'default', the points are connected with straight lines.
The steps variants connect the points with step-like lines, i.e. horizontal lines with vertical steps. They differ in the location of the step:
set_ds
(self, drawstyle)¶
Alias for set_drawstyle
.
set_fillstyle
(self, fs)[source]¶
Set the marker fill style.
Parameters:Possible values:
For examples see Marker filling-styles.
set_linestyle
(self, ls)[source]¶
Set the linestyle of the line.
Parameters:Possible values:
A string:
Linestyle Description'-'
or 'solid'
solid line '--'
or 'dashed'
dashed line '-.'
or 'dashdot'
dash-dotted line ':'
or 'dotted'
dotted line 'None'
or ' '
or ''
draw nothing
Optionally, the string may be preceded by a drawstyle, e.g. 'steps--'
. See set_drawstyle()
for details.
Alternatively a dash tuple of the following form can be provided:
(offset, onoffseq)
where onoffseq
is an even length tuple of on and off ink in points. See also set_dashes()
.
set_linewidth
(self, w)[source]¶
Set the line width in points.
Parameters:Line width, in points.
set_ls
(self, ls)¶
Alias for set_linestyle
.
set_lw
(self, w)¶
Alias for set_linewidth
.
set_marker
(self, marker)[source]¶
Set the line marker.
Parameters:See markers
for full description of possible arguments.
set_markeredgecolor
(self, ec)[source]¶
Set the marker edge color.
set_markeredgewidth
(self, ew)[source]¶
Set the marker edge width in points.
Parameters:Marker edge width, in points.
set_markerfacecolor
(self, fc)[source]¶
Set the marker face color.
set_markerfacecoloralt
(self, fc)[source]¶
Set the alternate marker face color.
set_markersize
(self, sz)[source]¶
Set the marker size in points.
Parameters:Marker size, in points.
set_markevery
(self, every)[source]¶
Set the markevery property to subsample the plot when using markers.
e.g., if every=5
, every 5-th marker will be plotted.
Which markers to plot.
Notes
Setting the markevery property will only show markers at actual data points. When using float arguments to set the markevery property on irregularly spaced data, the markers will likely not appear evenly spaced because the actual data points do not coincide with the theoretical spacing between markers.
When using a start offset to specify the first marker, the offset will be from the first data point which may be different from the first the visible data point if the plot is zoomed in.
If zooming in on a plot when using float arguments then the actual data points that have markers will change because the distance between markers is always determined from the display-coordinates axes-bounding-box-diagonal regardless of the actual axes data limits.
set_mec
(self, ec)¶
Alias for set_markeredgecolor
.
set_mew
(self, ew)¶
Alias for set_markeredgewidth
.
set_mfc
(self, fc)¶
Alias for set_markerfacecolor
.
set_mfcalt
(self, fc)¶
Alias for set_markerfacecoloralt
.
set_ms
(self, sz)¶
Alias for set_markersize
.
set_picker
(self, p)[source]¶
Sets the event picker details for the line.
Parameters:If a float, it is used as the pick radius in points.
set_pickradius
(self, d)[source]¶
Set the pick radius used for containment tests.
See contains
for more details.
Pick radius, in points.
set_solid_capstyle
(self, s)[source]¶
Set the cap style for solid lines.
Parameters:set_solid_joinstyle
(self, s)[source]¶
Set the join style for solid lines.
set_transform
(self, t)[source]¶
Set the Transformation instance used by this artist.
set_xdata
(self, x)[source]¶
Set the data array for x.
set_ydata
(self, y)[source]¶
Set the data array for y.
update_from
(self, other)[source]¶
Copy properties from other to self.
validCap
= ('butt', 'round', 'projecting')¶
validJoin
= ('miter', 'round', 'bevel')¶
verticalOffset
¶
zorder
= 2¶
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4