5.1 Component architecture

Axes are a fundamental component of graphs although there might be applications outside of the graph system. Internally axes are constructed out of components, which handle different tasks axes need to fulfill:

axis
Implements the conversion of a data value to a graph coordinate of range [0:1]. It does also handle the proper usage of the components in complicated tasks (i.e. combine the partitioner, texter, painter and rater to find the best partitioning).

An anchoredaxis is a container to combine an axis with an positioner and provide a storage area for all kind of axis data. That way axis instances are reusable (they do not store any data locally). The anchoredaxis and the positioner are created by a graph corresponding to its geometry.

tick
Ticks are plotted along the axis. They might be labeled with text as well.
partitioner, we use ``parter'' as a short form
Creates one or several choices of tick lists suitable to a certain axis range.
texter
Creates labels for ticks when they are not set manually.
painter
Responsible for painting the axis.
rater
Calculate ratings, which can be used to select the best suitable partitioning.
positioner
Defines the position of an axis.

The names above map directly to modules which are provided in the directory graph/axis except for the anchoredaxis, which is part of the axis module as well. Sometimes it might be convenient to import the axis directory directly rather than to access iit through the graph. This would look like:

  from pyx import *
  graph.axis.painter() # and the like

  from pyx.graph import axis
  axis.painter() # this is shorter ...

In most cases different implementations are available through different classes, which can be combined in various ways. There are various axis examples distributed with PyX, where you can see some of the features of the axis with a few lines of code each. Hence we can here directly come to the reference of the available components.