The following classes are part of the module graph.axis.axis.
However, there is a shortcut to access those classes via
graph.axis directly.
Instances of the following classes can be passed to the **axes keyword arguments of a graph. Those instances should only be used once.
| min=None, max=None, reverse=0, divisor=None, title=None, parter=parter.autolinear(), manualticks=[], density=1, maxworse=2, rater=rater.linear(), texter=texter.mixed(), painter=painter.regular(), linkpainter=painter.linked()) |
reverse can be set to indicate a reversed axis starting with bigger values first. Alternatively you can fix the axis range by min and max accordingly. When divisor is set, it is taken to divide all data range and position informations while creating ticks. You can create ticks not taking into account a factor by that. title is the title of the axis.
parter is a partitioner instance, which creates suitable ticks for the axis range. Those ticks are merged with ticks manually given by manualticks before proceeding with rating, painting etc. Manually placed ticks win against those created by the partitioner. For automatic partitioners, which are able to calculate several possible tick lists for a given axis range, the density is a (linear) factor to favour more or less ticks. It should not be stressed to much (its likely, that the result would be unappropriate or not at all valid in terms of rating label distances). But within a range of say 0.5 to 2 (even bigger for large graphs) it can help to get less or more ticks than the default would lead to. maxworse is the number of trials with more and less ticks when a better rating was already found. rater is a rater instance, which rates the ticks and the label distances for being best suitable. It also takes into account density. The rater is only needed, when the partitioner creates several tick lists.
texter is a texter instance. It creates labels for those ticks, which claim to have a label, but do not have a label string set already. Ticks created by partitioners typically receive their label strings by texters. The painter is finally used to construct the output. Note, that usually several output constructions are needed, since the rater is also used to rate the distances between the labels for an optimum. The linkedpainter is used as the axis painter, when automatic link axes are created by the createlinked() method.
| ...) |
| min=None, max=None, reverse=0, divisor=None, title=None, parter=parter.autologarithmic(), manualticks=[], density=1, maxworse=2, rater=rater.logarithmic(), texter=texter.mixed(), painter=painter.regular(), linkpainter=painter.linked()) |
| ...) |
| subaxes=None, defaultsubaxis=linear(painter=None, linkpainter=None, parter=None, texter=None), dist=0.5, firstdist=None, lastdist=None, title=None, reverse=0, painter=painter.bar(), linkpainter=painter.linkedbar()) |
The first item is taken to be one of the discrete values valid on this axis. The discrete values can be any hashable type and the order of the subaxes is defined by the order the data is received or the inverse of that when reverse is set.
The second item is passed to the corresponding subaxis. The result of the conversion done by the subaxis is mapped to the graph coordinate range reserved for this subaxis. This range is defined by a size attribute of the subaxis, which can be added to any axis. (see the sized linear axes described below for some axes already having a size argument). When no size information is available for a subaxis, a size value of 1 is used. The baraxis itself calculates its size by suming up the sizes of its subaxes plus firstdist, lastdist and dist times the number of subaxes minus 1.
subaxes should be a list or a dictionary mapping a discrete value of the bar axis to the corresponding subaxis. When no subaxes are set or data is received for an unknown discrete axis value, instances of defaultsubaxis are used as the subaxis for this discrete value.
dist is used as the spacing between the ranges for each
distinct value. It is measured in the same units as the subaxis
results, thus the default value of 0.5 means half the width
between the distinct values as the width for each distinct value.
firstdist and lastdist are used before the first and
after the last value. When set to None, half of dist
is used.
title is the title of the split axes and painter is a specialized painter for an bar axis and linkpainter is used as the painter, when automatic link axes are created by the createlinked() method.
| subaxes=None, defaultsubaxis=bar(dist=0, painter=None, linkpainter=None), dist=0.5, firstdist=None, lastdist=None, title=None, reverse=0, painter=painter.bar(), linkpainter=painter.linkedbar()) |
| subaxes=None, defaultsubaxis=linear(), dist=0.5, firstdist=0, lastdist=0, title=None, reverse=0, painter=painter.split(), linkpainter=painter.linkedsplit()) |
Sometimes you want to alter the default size of 1 of the subaxes. For
that you have to add a size attribute to the axis data. The two
classes sizedlinear and autosizedlinear do that for
linear axes. Their short names are sizedlin and
autosizedlin. sizedlinear extends the usual linear
axis by an first argument size. autosizedlinear creates
the size out of its data range automatically but sets an
autolinear parter with extendtick being None in
order to disable automatic range modifications while painting the
axis.
The axis module also contains classes implementing so called anchored axes, which combine an axis with an positioner and a storage place for axis related data. Since these features are not interesting for the average PyX user, we'll not go into all the details of their parameters and except for some handy axis position methods:
| x1=None, x2=None) |
None
the beginning and end of the path is taken, which might cover a
longer range, when the axis is embedded as a subaxis. For that case,
a None value extends the range to the point of the middle
between two subaxes or the beginning or end of the whole axis, when
the subaxis is the first or last of the subaxes.
| v1=None, v2=None) |
| x) |
None when no grid path is available.
| v) |
| x) |
| v) |
| x) |
| v) |
| v) |
However, there are two anchored axes implementations linkedaxis and anchoredpathaxis which are available to the user to create special forms of anchored axes.
| linkedaxis=None, errorname="manual-linked", painter=_marker) |
| linkedaxis) |
| path, axis, direction=1) |
1 (left) and -1 (right).
The anchoredpathaxis contains as any anchored axis after calling its create method the painted axis in the canvas member attribute. The function pathaxis has the same signature like the anchoredpathaxis class, but immediately creates the axis and returns the painted axis.