PyX — Examples: Graph axes

This section demonstrates the axis subsystem of the graph module. The axes delegate a lot of tasks to different components like painters (which control how the baseline of the axis, the ticks and the axis title are drawn), texters (which create the label strings written on the ticks), parters (short for partionioners, which take care of determining appropriate tick positions along the axis, and raters (which adjust the number of ticks to match the available size).

In the present section, we will explain various basic aspects of these components. Most of the time, the examples will not show a complete graph but just a single axis. In that case, we will take an axis created along an arbitrary path, partially in order to demonstrate the flexibility of PyX's axis system but also too increase the coolness factor. Of course, in a real-world example, you will use the shown features mostly for simple, boring, straight axes.

Overview for this section


Logarithmic axes

Logarithmic axes are quite similar to linear axes and differ only in a very few properties, namely a non-linear mapping of values to axis positions. They also have different default partitioners and raters (see below). more ...


Linking one axis to another one

When plotting two or more related graphs, you sometimes want to have identical axes. This example demonstrates how to achieve this goal in PyX using a linkedaxis. more ...


Minimal example for drawing an isolated axis

This is the basic example of how to draw an axis alone -- without the whole graph. It serves to simplify the following examples. more ...


Painter: Controlling the visual features of an axis

The visual features of an axis (such as ticklengths, linewidths, distances of the labels, their orientation, text attributes, etc.) are controlled by its painter. You can modify these attributes by creating a painter explicitly. more ...


Texter: Controlling the formatting of tick labels

Texters do the formatting of the tick labels: They create the strings which are then passed to the painter. You can choose between fractions and decimal numbers with/without an exponential part. more ...


Manually place ticks at certain positions

Ticks can be set manually by passing tick instances to the manualticks argument of the axis instance as shown at the right axis in this example. more ...


Rater: How a nicely looking axis partition is chosen

We here demonstrate how an axis actually chooses its partition. more ...


Parter: Control over the partitioning of the axis

In the above example, the (default) automatic choice of a good partitioning has been selected. Here, we show how to gain more control over the ticks, in order to fix their intervals. more ...