Inherits from
- DataView: enthought.chaco.data_view.DataView
Attributes
- auto_colors
List of colors to cycle through when auto-coloring is requested. Picked and ordered to be red-green color-blind friendly, though should not be an issue for blue-yellow.
auto_colors = List([ 'green', 'lightgreen', 'blue', 'lightblue', 'red', 'pink', 'darkgray', 'silver' ])
- color_mapper
Optional mapper for the color axis. Not instantiated until first use; destroyed if no color plots are on the plot.
color_mapper = Instance(AbstractColormap)
- data
The PlotData instance that drives this plot.
data = Instance(AbstractPlotData)
- datasources
Mapping of data names from self.data to their respective datasources.
datasources = Dict(Str, Instance(AbstractDataSource))
- default_index
The default index to use when adding new subplots.
default_index = Instance(AbstractDataSource)
- legend
The legend on the plot.
legend = Instance(Legend)
- legend_alignment
Convenience attribute for legend.align; can be "ur", "ul", "ll", "lr".
legend_alignment = Property
- plots
Mapping of plot names to lists of plot renderers.
plots = Dict(Str, List)
- title
The title of the plot.
title = Property
- title_angle
title_angle = Delegate('_title', prefix = 'angle', modify = True)
- title_color
title_color = Delegate('_title', prefix = 'color', modify = True)
- title_font
The font to use for the title.
title_font = Str('swiss 16')
- title_position
Convenience attribute for title.overlay_position; can be "top", "bottom", "left", or "right".
title_position = Property
- title_text
Use delegates to expose the other PlotLabel attributes of the plot title
title_text = Delegate('_title', prefix = 'text', modify = True)
Inherited from base classes
- accepts_focus
- active_tool
- aspect_ratio
- auto_center
- auto_handle_event
- auto_size
- backbuffer_padding
- border_color
- border_dash
- border_width
- bounds
- classes
- components
- container
- controller
- cursor_color
- cursor_style
- default_size
- draw_order
- draw_valid
- drawn_outer_bounds
- drawn_outer_position
- event_state
- fill_padding
- fit_components
- fit_window
- height
- hpadding
- id
- inset_border
- intercept_events
- invisible_layout
- layout_controller
- layout_needed
- on_trait_event
- outer_bounds
- outer_height
- outer_position
- outer_width
- outer_x
- outer_x2
- outer_y
- outer_y2
- overlay_border
- overlays
- padding
- padding_accepts_focus
- padding_bottom
- padding_left
- padding_right
- padding_top
- pointer
- position
- resizable
- resolver
- set
- tools
- tooltip
- trait_added
- trait_modified
- underlays
- unified_draw
- use_backbuffer
- use_selection
- viewports
- visible
- vpadding
- width
- window
- wrappers
- x
- x2
- y
- y2
Method summary
- __init__(self, data = None, **kwtraits)
- __title_changed(self, old, new)
- contour_plot(self, data, type = 'line', name = None, poly_cmap = None, xbounds = None, ybounds = None, origin = None, **styles)
- delplot(self, *names)
- hideplot(self, *names)
- img_plot(self, data, name = None, colormap = None, xbounds = None, ybounds = None, origin = None, **styles)
- plot(self, data, type = 'line', name = None, index_scale = 'linear', value_scale = 'linear', origin = None, **styles)
- showplot(self, *names)
Inherited from base classes
- __components_changed(self, event)
- __components_items_changed(self, event)
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name, is_set)
- __reduce_ex__(self, protocol)
- __setstate__(self, state, trait_change_notify = True)
- add(self, *components)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- as_coordinates(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- cleanup(self, window)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- compact(self)
- components_at(self, x, y)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- dispatch(self, event, suffix)
- do_layout(self, size = None, force = False)
- draw(self, gc, view_bounds = None, mode = 'default')
- draw_select_box(self, gc, position, bounds, width, dash, inset, color, bgcolor, marker_size)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get(self, **kw)
- get_absolute_coords(self, *coords)
- get_event_transform(self, event = None, suffix = '')
- get_preferred_size(self, components = None)
- has_traits_interface(self, *interfaces)
- insert(self, index, component)
- invalidate_and_redraw(self)
- invalidate_draw(self, damaged_regions = None, self_relative = False)
- is_in(self, x, y)
- lower_component(self, component)
- normal_mouse_leave(self, event)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same', priority = False, deferred = False)
- print_traits(self, show_help = False, **metadata)
- raise_component(self, component)
- remove(self, *components)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- request_redraw(self)
- reset_traits(self, traits = None, **metadata)
- set_outer_bounds(self, ndx, val)
- set_outer_position(self, ndx, val)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_get(self, *names, **metadata)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_set(self, trait_change_notify = True, **traits)
- trait_setq(self, **traits)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- __init__(self, data = None, **kwtraits)
- __title_changed(self, old, new)
- contour_plot(self, data, type = 'line', name = None, poly_cmap = None, xbounds = None, ybounds = None, origin = None, **styles)
Adds contour plots to this Plot object.
Parameters
- data : string
- The name of the data array in self.plot_data, which must be floating point data.
- type : comma-delimited string of "line", "poly"
- The type of contour plot to add. If the value is "poly" and no colormap is provided, then a ValueError is thrown.
- name : string
- The name of the plot; if omitted, then a name is generated.
- poly_cmap : string
- The name of the color-map function to call (in chaco.default_colormaps) or an AbstractColormap instance to use for contour poly plots (ignored for contour line plots)
- xbounds, ybounds : tuples of (low, high) in data space
- Bounds where this image resides.
- origin : string
- Which corner the origin of this plot should occupy:
- "bottom left", "top left", "bottom right", "top right"
- styles : series of keyword arguments
- Attributes and values that apply to one or more of the plot types requested, e.g.,'line_color' or 'line_width'.
- delplot(self, *names)
Removes the named sub-plots.
- hideplot(self, *names)
Convenience function to sets the named plots to be invisible. Their renderers are not removed, and they are still in the list of plots.
- img_plot(self, data, name = None, colormap = None, xbounds = None, ybounds = None, origin = None, **styles)
Adds image plots to this Plot object.
If data has shape (N, M, 3) or (N, M, 4), then it is treated as RGB or RGBA (respectively) and colormap is ignored.
If data is an array of floating-point data, and no colormap is provided, then a ValueError is thrown.
Data should be in row-major order, so that xbounds corresponds to data's second axis, and ybounds corresponds to the first axis.
Parameters
- data : string
- The name of the data array in self.plot_data
- name : string
- The name of the plot; if omitted, then a name is generated.
- xbounds, ybounds : tuples of (low, high)
- Bounds in data space where this image resides.
- origin : string
- Which corner the origin of this plot should occupy:
- "bottom left", "top left", "bottom right", "top right"
- styles : series of keyword arguments
- Attributes and values that apply to one or more of the plot types requested, e.g.,'line_color' or 'line_width'.
- plot(self, data, type = 'line', name = None, index_scale = 'linear', value_scale = 'linear', origin = None, **styles)
Adds a new sub-plot using the given data and plot style.
Parameters
- data : string, tuple(string), list(string)
The data to be plotted. The type of plot and the number of arguments determines how the arguments are interpreted:
- one item: (line/scatter)
- The data is treated as the value and self.default_index is used as the index. If default_index does not exist, one is created from arange(len(data))
- two or more items: (line/scatter)
- Interpreted as (index, value1, value2, ...). Each index,value pair forms a new plot of the type specified.
- two items: (cmap_scatter)
- Interpreted as (value, color_values). Uses default_index.
- three or more items: (cmap_scatter)
- Interpreted as (index, val1, color_val1, val2, color_val2, ...)
- type : comma-delimited string of "line", "scatter", "cmap_scatter"
- The types of plots to add.
- name : string
- The name of the plot. If None, then a default one is created (usually "plotNNN").
- index_scale : string
- The type of scale to use for the index axis. If not "linear", then a log scale is used.
- value_scale : string
- The type of scale to use for the value axis. If not "linear", then a log scale is used.
- origin : string
- Which corner the origin of this plot should occupy:
- "bottom left", "top left", "bottom right", "top right"
- styles : series of keyword arguments
- attributes and values that apply to one or more of the plot types requested, e.g.,'line_color' or 'line_width'.
Examples
plot("my_data", type="line", name="myplot", color=lightblue) plot(("x-data", "y-data"), type="scatter") plot(("x", "y1", "y2", "y3"))Returns
[str] -> list of names of the new plots created
- showplot(self, *names)
Convenience function to sets the named plots to be visible.