Package csb :: Package io :: Module plots
[frames] | no frames]

Module plots

source code

Plotting facilities, based on Python's MPL library.

The Chart object is a facade which provides intuitive access to MPL's plotting objects. The following examples show a typical use of Chart:

  1. Instantiation
    >>> chart = Chart()                     # a chart with a single plot    
    >>> chart = Chart(rows=2, columns=2)    # a chart with 2x2=4 plots
  2. Accessing plots (equivalent to MPL's subplots)
    >>> chart.plots[0]                      # first plot (at row=0, column=0) 
    Plot (matplotlib.axes.AxesSubplot)    
    >>> chart.plots[0, 1]
    Plot (matplotlib.axes.AxesSubplot)      # plot at row=0, column=1
  3. Plotting
    >>> chart.plots[0].hist(...)
    >>> chart.plots[0].set_title('T')
    >>> chart.plots[1].scatter(...)
    >>> chart.plots[1].set_xlabel('X')
  4. Using the GUI
    >>> chart.show()
    >>> chart.hide()
  5. Saving as image
    >>> chart.save(filename, format=chart.formats.PDF)

If using the GUI, do not forget to dispose the chart at the end:

>>> chart.dispose()

or simply use the chart in a context manager:

>>> with Chart() as chart:
        chart...
Classes
  Backend
Abstract class defining the behavior of all Chart GUI backends.
  Backends
Enumeration of chart backends.
  Chart
Simple and clean facade to Matplotlib's plotting API.
  PlotsCollection
A list-like collection of all plots in the chart (0-based).
  WxBackendImpl
WxPython Backend implementor.
Variables
  __package__ = 'csb.io'