chaco.plots.lineplot module

Defines the LinePlot class.

class chaco.plots.lineplot.LinePlot(**kwtraits)

Bases: chaco.base_xy_plot.BaseXYPlot

A plot consisting of a line.

This is the most fundamental object to use to create line plots. However, it is somewhat low-level and therefore creating one properly to do what you want can require some verbose code. The create_line_plot() function in plot_factory.py can hide some of this verbosity for common cases.

color = black_color_trait(requires_redraw=True)

The color of the line.

effective_color = Property(Tuple, observe=["color", "alpha"])

The RGBA tuple for rendering lines. It is always a tuple of length 4. It has the same RGB values as color, and its alpha value is the alpha value of self.color multiplied by self.alpha.

get_screen_points()

Returns the currently visible screen-space points.

Intended for use with overlays.

hittest(screen_pt, threshold=7.0, return_distance=False)

Tests whether the given screen point is within threshold pixels of any data points on the line. If so, then it returns the (x,y) value of a data point near the screen point. If not, then it returns None.

interpolate(index_value)

Returns the value of the plot at the given index value in screen space. Raises an IndexError when index_value exceeds the bounds of indexes on the value.

line_style = LineStyle(requires_redraw=True)

The line dash style.

line_width = Float(1.0, requires_redraw=True)

The thickness of the line.

metadata_name = Str("selections")

The name of the key in self.metadata that holds the selection mask

render_style = Enum("connectedpoints", "hold", "connectedhold")

The rendering style of the line plot.

connectedpoints

“normal” style (default); each point is connected to subsequent and prior points by line segments

hold

each point is represented by a line segment parallel to the abscissa (index axis) and spanning the length between the point and its subsequent point.

connectedhold

like “hold” style, but line segments are drawn at each point of the plot to connect the hold lines of the prior point and the current point. Also called a “right angle plot”.

selected_color = ColorTrait("lightyellow")

The color to use to highlight the line when selected.

selected_line_style = LineStyle("solid")

The style of the selected line.

traits_view

TraitsUI View for customizing the plot.