chaco.plots.candle_plot module

class chaco.plots.candle_plot.CandlePlot(**kwtraits)

Bases: chaco.base_candle_plot.BaseCandlePlot

A plot consisting of a filled bar with an optional centerline and stems extending to extrema. Usually used to represent some statistics on bins of data, with the centerline representing the mean, the bar extents representing +/- 1 standard dev or 10th/90th percentiles, and the stems extents representing the minimum and maximum samples.

The values in the index datasource indicate the centers of the bins; the widths of the bins are not specified in data space, and are determined by the minimum space between adjacent index values.

bar_max = Instance(AbstractDataSource)

The “upper” extent of the “bar”, i.e. the value closest to the corresponding value in max_values at each index.

bar_min = Instance(AbstractDataSource)

The “lower” extent of the “bar”, i.e. the value closest to the corresponding value in min_values at each index.

center_values = Instance(AbstractDataSource)

Values that appear inside the bar, between bar_min and bar_max. These Are usually mean or median values, and are rendered with a solid line of a different color than the bar fill color. This can be None.

map_data(screen_pt, all_values=True)

Maps a screen space point into the “index” space of the plot.

Overrides the BaseXYPlot implementation, and always returns an array of (index, value) tuples.

map_index(screen_pt, threshold=0.0, outside_returns_none=True, index_only=True)

Maps a screen space point to an index into the plot’s index array(s).

Implements the AbstractPlotRenderer interface.

Parameters
  • screen_pt – Screen space point

  • threshold (float) – Maximum distance from screen space point to plot data point. A value of 0.0 means no threshold (any distance will do).

  • outside_returns_none (bool) – If True, a screen space point outside the data range returns None. Otherwise, it returns either 0 (outside the lower range) or the last index (outside the upper range)

  • index_only (bool) – If True, the threshold is measured on the distance between the index values, otherwise as Euclidean distance between the (x,y) coordinates.

max_values = Instance(AbstractDataSource)

The maximum value at each index point. If None, then no stem and no endcap line will be drawn above each bar.

min_values = Instance(AbstractDataSource)

The minimum values at each index point. If None, then no stem and no endcap line will be drawn below each bar.

chaco.plots.candle_plot.broaden(mask)

Takes a 1D boolean mask array and returns a copy with all the non-zero runs widened by 1.