chaco.data_view module

Defines the DataView class, and associated property traits and property functions.

class chaco.data_view.DataView(**kwtraits)

Bases: chaco.plot_containers.OverlayPlotContainer

Represents a mapping from 2-D data space into 2-D screen space.

It can house renderers and other plot components, and otherwise behaves just like a normal PlotContainer.

auto_axis = Bool(True)

Whether to automatically create the x_axis and y_axis if they were not already set by the caller.

auto_grid = Bool(True)

Whether to automatically create the x_grid and y_grid if they were not already set by the caller.

bgcolor = "white"

Background color (overrides Enable Component)

default_origin = Enum(

The default location of the origin for new plots

index_axis = AxisProperty

Convenience property for accessing the index axis, which can be X or Y, depending on orientation.

index_grid = GridProperty

Convenience property for accessing the index grid, which can be horizontal or vertical, depending on orientation.

index_mapper = Instance(Base1DMapper)

The mapper to use for the index data.

index_range = Property

The range used for the index data.

index_scale = Enum("linear", "log")

For x-y plots, the scale of the index axis.

map_data(screen_pt)

Maps a screen space point into the 2D data space of this plot. (Note that this differs from the BaseXYPlot implementation, which by default only maps into the 1D index space.)

map_screen(data_array)

Maps an array of data points to screen space and returns an array of screen space points.

orientation = Enum("h", "v")

The orientation of the index axis.

origin = Property(observe="default_origin")

The origin reported to axes, etc

padding_bottom = Property(

Bottom Padding default

padding_left = Property(

Left Padding default

padding_right = Property(

Right Padding default

padding_top = Property(

Top Padding default

range2d = Instance(DataRange2D)

The 2-D data range whose x- and y-ranges are exposed as the index_range and value_range property traits. This allows supporting both XY plots and 2-D (image) plots.

value_axis = AxisProperty

Convenience property for accessing the value axis, which can be Y or X, depending on orientation.

value_grid = GridProperty

Convenience property for accessing the value grid, which can be vertical or horizontal, depending on orientation.

value_mapper = Instance(Base1DMapper)

The mapper to use for value data.

value_range = Property

The range used for the value data.

value_scale = Enum("linear", "log")

For x-y plots, the scale of the index axis.

x_axis = Instance(AbstractOverlay)

The horizontal axis. Its position relative to the plot area can be “top”, “bottom”, or “float”. The default position for a new x-axis is “bottom”.

TODO: For now, this is an instance of AbstractOverlay instead of PlotAxis because scales_axis.PlotAxis doesn’t inherit from PlotAxis, but instead is a semi-reimplementation. Thus, rather than making scales_axis.PlotAxis inherit a concrete class, I chose to loosen this trait by specifying a more general base class of PlotAxis. This incurs lower risk of subtle and difficult-to-catch bugs being introduced by changes to the axis.PlotAxis class. This same comment applies to the y_axis trait below. –pwang x_axis = Instance(PlotAxis)

x_grid = Instance(PlotGrid)

The grid that intersects the x-axis, i.e., a set of vertical lines.

x_mapper = OrientedMapperProperty

Convenience property that offers access to whatever mapper corresponds to the X-axis.

y_axis = Instance(AbstractOverlay)

The vertical axis. Its position relative to the plot area can be “left”, “right”, or “float”. The default position for a new y-axis is “left”. y_axis = Instance(PlotAxis)

y_grid = Instance(PlotGrid)

The grid that intersects the y-axis, i.e., a set of horizontal lines.

y_mapper = OrientedMapperProperty

Convenience property that offers access to whatever mapper corresponds to the Y-axis

chaco.data_view.get_axis(self, attr_name)

Getter function used by AxisProperty.

chaco.data_view.get_grid(self, attr_name)

Getter function used by GridProperty.

chaco.data_view.get_mapper(self, attr_name)

Getter function used by OrientedMapperProperty.

chaco.data_view.set_axis(self, attr_name, new)

Setter function used by AxisProperty.

chaco.data_view.set_grid(self, attr_name, new)

Setter function used by GridProperty.

chaco.data_view.set_mapper(self, attr_name, new)

Setter function used by OrientedMapperProperty.