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 is 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.
Example overview for this section
Linking an 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 drawing an axis along a path
This is the basic example how to draw an axis along an arbitrary path. The function pathaxis from the graph.axis module takes a path and returns a canvas.
more ...
Painting of an axis
Axis painters performs the painting of an axis, which means they take all the information of the axis an create a proper drawing for that. more ...
Rating of axis partitionings
In this example several axes with the same parameters are plotted on a path scaled at 3 different sizes. Note that the axes adjust the ticks appropriately to the available space. For that a partitioner (the short form parter is used in the code) creates several possible solutions for placing ticks and labels at the axis.
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 ...
Manual parters and rational number arithmetics
Partitioners (in the code the short form parter is used all over the place) take care of calculating appropriate tick positions for a given axis range. Automatic partitioners create several tick lists, which are than rated by an axis rater instance afterwards. In contrast manual partitioners create a single tick list only, which thus doesn't need to be rated at all.
more ...
Texter
Texters create the label strings written to the ticks. There are texters available for decimal numbers without and with an exponential part as well as fractions. more ...
Logarithmic axes
Logarithmic axes are quite similar to linear axes and differ only in a very few properties, namely the non-linear convert method in which they transform values to positions on the axis, a different default partitioner and a different default rater. more ...
