Table Of Contents

Previous topic

API

Next topic

gui Package

This Page

avoplot Package

avoplot Package

avoplot.__init__.call_on_idle(func, *args, **kwargs)

Registers a callable to be executed when the event loop is empty. The callable will only be called once. This is used to execute the _destroy() method of AvoPlotElementBase.

avoplot.__init__.get_avoplot_icons_dir()

Returns the full path to the directory where the AvoPlot icons are stored.

avoplot.__init__.get_avoplot_rw_dir()

Returns the path used by AvoPlot for things like caching settings, storing templates etc. This is platform dependent, but on Linux it will be in ~/.AvoPlot

avoplot.__init__.get_avoplot_sys_dir()

Returns the path used by AvoPlot to store user independent files, e.g. icons. On Linux at least this will probably be something like /usr/local/share/AvoPlot

avoplot.__init__.get_license_file()

Returns the full path to the COPYING file installed with AvoPlot

controls Module

class avoplot.controls.AvoPlotControlPanelBase(name)

Bases: wx._windows.ScrolledWindow

Base class for control panels - these are the tabs shown in the “Control Panel” frame.

Add(*args, **kwargs)

Adds a new element into the control panel’s sizer - *args and **kwargs are the same as for a wx.BoxSizer.

get_name()

Returns the name of this control panel - this will be the text displayed in the tab heading.

is_initialised()

Returns True if the setup() method has already been run for this control panel, False otherwise.

setup(parent)

Control panels are typically instanciated before their parent frame is known. Therefore, the majority of the setup of the panel should be done in the setup method - this is passed the parent window as its only argument. Subclasses that override this method should be sure to call the setup method of their parent class before doing anything else.

core Module

The core module provides the base class for AvoPlot elements, which are used to represent the hierarchy of plots - i.e. a figure may contain many subplots, a subplot may contain many data series etc.

The element framework is designed to cope with the fact that many different components of the GUI may modify plot elements and all of these components will need to be notified of the changes. For example, a figure may be renamed by using the right-click menu on the its tab in the plots panel. It can also be renamed using the navigation panel - both of these panels need to be notified when the name of a figure gets changed. The way this is implemented is as follows: the panel doing the renaming calls figure.rename_element(). This changes the name of the element and generates an AvoPlotElementRenameEvent. Both the plots panel and the navigation panel handle this event and use it to update their appearance. Adding and deleting elements works in a similar way.

class avoplot.core.AvoPlotElementBase(name)

Bases: object

Base class for all AvoPlot elements. Elements are essentially a container class that holds child elements. For example, a figure element can contain several subplots as its children.

add_control_panel(panel)

Adds a control to the element. This must be an instance of a subclass of avoplot.controls.AvoPlotControlPanelBase.

delete()

Sets the element’s parent to None, and calls the delete() method of any child elements. Generates a AvoPlotElementDeleteEvent event.

get_avoplot_id()

Returns the element’s unique id number (integer)

get_child_elements()

Returns a list of child elements (instances of AvoPlotElementBase or its subclasses).

get_control_panels()

Returns a list of control panel objects (instances of avoplot.controls.AvoPlotControlPanelBase) that relate to the element.

get_name()

Returns the elements name.

get_parent_element()

Returns the parent element of this element (this will be an instance of AvoPlotElementBase or one of its subclasses)

set_name(name)

Sets the name of the element. If the parent element already contains a child element with the specified name, then ‘(n)’ will be appended to the name assigned (where n is an integer counter). This will generate an AvoPlotElementRenameEvent.

set_parent_element(parent)

Reparents the element to the element specified. parent must be an instance of AvoPlotElementBase or one of its subclasses, or None.

If the new parent already has a child of the same name, then the element’s name will be updated using set_name().

set_selected()

Generates an AvoPlotElementSelectEvent for the element.

setup_controls(parent)

Calls the setup method of all the control panels associated with this element. parent should be the parent window for the controls.

update()

Redraws the element in the display. This should be called after the element is changed to reflect the changes in the display. This must be overridden in subclasses.

avoplot.core.new_id()

Returns a unique ID number. This is used to identify different elements across a single instance of the AvoPlot program.

figure Module

class avoplot.figure.AvoPlotFigure(parent, name)

Bases: avoplot.core.AvoPlotElementBase, wx._windows.ScrolledWindow

The AvoPlotFigure class represents a single plot tab in the plotting window. The parent argument should be the plotting window.

finalise()

Creates the canvas for the figure to be drawn into. This is done here rather than in __init__ so that we have the option of vetoing the displaying of the figure if something goes wrong during its construction, e.g. if the file cannot be loaded etc.

get_mpl_figure()

Returns the matplotlib figure object associated with this figure.

go_home()

Returns all subplots within the figure to their default zoom level.

on_mouse_button(evnt)

Event handler for mouse click events in the figure canvas.

pan()

Toggles the pan/zoom functionality for the figure.

save_figure_as_image()

Opens a file save dialog for exporting the figure to an image file - all matplotlib output formats are supported.

set_status_bar(statbar)

Associates a status bar with this figure.

set_subplot_layout_basic(positions)

Not yet implemented! positions = {name1:(row, col),name2:(row,col)}

update()

Redraws the entire figure.

zoom()

Toggles the zoom functionality for the figure.

class avoplot.figure.FigureControls(figure)

Bases: avoplot.controls.AvoPlotControlPanelBase

Control panel for figure elements allowing the user to change the background colour, title etc. of the figure.

The figure argument must be an instance of AvoPlotFigure (or a subclass).

on_bkgd_colour_change(evnt)

Event handler for background colour selections.

on_suptitle_change(evnt)

Event handler for figure title changes.

setup(parent)

Creates all the figure editing controls.

persist Module

avoplot.persist.PersistentStorage()

Returns a reference to the global persistant storage class. Which can be used for storing settings across program restarts.

series Module

class avoplot.series.DataSeriesBase(name)

Bases: avoplot.core.AvoPlotElementBase

Base class for all data series.

get_mpl_lines()

Returns a list of matplotlib line objects associated with the data series.

is_plotted()

Returns True if the series has already been plotted. False otherwise.

plot(subplot)

Plots the data series into the specified subplot (AvoPlotSubplotBase instance) and returns the list of matplotlib lines associated with the series. This method should be overridden by subclasses.

preprocess(*args)

Runs any preprocessing required on the data and returns it. This should be overridden by subclasses.

set_parent_element(parent)

Overrides AvoPlotElementBase method. Does exactly the same, but ensures that parent is an instance of AvoPlotSubplotBase or a subclass thereof.

update()

Redraws the series.

class avoplot.series.XYDataSeries(name, xdata=None, ydata=None)

Bases: avoplot.series.DataSeriesBase

Class to represent 2D XY data series.

get_data()

Returns a tuple (xdata, ydata) of the data held by the series, with any pre-processing operations applied to it.

get_raw_data()

Returns a tuple (xdata, ydata) of the raw data held by the series (without any pre-processing operations performed). In general you should use the get_data() method instead.

static get_supported_subplot_type()

Static method that returns the class of subplot that the data series can be plotted into. This will be a subclass of AvoPlotSubplotBase.

plot(subplot)

plots the x,y data into the subplot as a line plot.

preprocess(xdata, ydata)

Runs any required preprocessing operations on the x and y data and returns them.

set_xy_data(xdata=None, ydata=None)

Sets the x and y values of the data series.

class avoplot.series.XYSeriesControls(series)

Bases: avoplot.controls.AvoPlotControlPanelBase

Control panel to allow user editing of data series (line styles, colours etc.)

on_line_colour_change(evnt)

Event handler for line colour change events.

on_linestyle(evnt)

Event handler for line style change events.

on_marker(evnt)

Event handler for marker style change events.

on_marker_colour(evnt)

Event handler for marker colour change events

setup(parent)

Creates all the controls in the panel

subplots Module

class avoplot.subplots.AvoPlotSubplotBase(fig, name='subplot')

Bases: avoplot.core.AvoPlotElementBase

The AvoPlotSubplotBase class is the base class for all subplots - which represent a set of axes in the figure.

add_data_series(data)

Adds a data series to the subplot. data should be an instance of avoplot.series.DataSeriesBase or a subclass.

get_figure()

Returns the AvoPlotFigure instance that this subplot is contained within. Use get_figure().get_mpl_figure() to get the matplotlib figure object that the subplot is associated with.

my_init()

This method should be overridden by subclasses wishing to customise the look of the subplot before it is displayed.

on_mouse_button(evnt)

Event handler for mouse click events. These will be passed to the subplot from its parent figure. This should be overriden by subclasses.

set_parent_element(parent)

Overrides the AvoPlotElementBase class’s method. Does the exactly the same as the base class but ensures that the parent is an AvoPlotFigure instance.

class avoplot.subplots.AvoPlotXYSubplot(fig, name='xy subplot')

Bases: avoplot.subplots.AvoPlotSubplotBase

Subplot for containing 2D (XY) data series.

add_data_series(data)

Adds (i.e. plots) a data series into the subplot. data should be an avoplot.series.XYDataSeries instance or subclass thereof.

get_mpl_axes()

Returns the matplotlib axes object associated with this subplot.

on_mouse_button(evnt)

Event handler for mouse click events.

on_right_click()

Called by on_mouse_button() if the event was a right-click. Creates a PopupMenu for adding new data series to the subplot.

update()

Redraws the subplot.

class avoplot.subplots.MetaCallMyInit

Bases: type

Metaclass which ensures that a class’s my_init() and setup_controls() methods get called once, after it’s __init__ method has returned.

class avoplot.subplots.XYSubplotControls(subplot)

Bases: avoplot.controls.AvoPlotControlPanelBase

Control panel for allowing the user to edit subplot parameters (title, axis labels etc.). The subplot argument should be an AvoPlotXYSubplot instance.

on_bkgd_colour(evnt)

Event handler for the background colour selector.

on_grid(evnt)

Event handler for the gridlines checkbox.

on_title(evnt)

Event handler for the subplot title text box.

on_xlabel(evnt)

Event handler for the x-axis title text box.

on_ylabel(evnt)

Event handler for the y-axis title text box.

setup(parent)

Creates all the controls for the panel.