Axes¶
Component Architecture¶
Axes in PyX convert data values into normalized graph coordinates \(v \in [0, 1]\)
and render the visual axis elements (baseline, tick marks, grid lines, tick
labels, and axis title). Although most commonly used inside a
graph.graphxy or graph.graphxyz, axes can also be drawn
standalone along any arbitrary path using graph.axis.pathaxis().
Internally, each axis delegates its work to six modular components located in
submodules of graph.axis:
axis(graph.axis.axis)Defines the mathematical mapping between data values and normalized graph coordinates \([0, 1]\), orchestrates automatic range adjustment, and combines the partitioner, texter, painter, and rater to choose the optimal tick layout.
Because an axis instance itself is stateless, a graph wraps each axis in an
anchoredaxiscontainer that pairs the axis with a geometricpositionerand holds per-graph range and tick data.tick(graph.axis.tick)Represents individual ticks and subticks placed along an axis, using exact rational arithmetic (
rational) to avoid floating-point rounding artifacts.parter(graph.axis.parter)Short for partitioner: generates one or more candidate lists of tick and subtick positions for a given data range.
texter(graph.axis.texter)Formats numeric or rational tick positions into label strings (using decimal, scientific/exponential, or fraction notation).
painter(graph.axis.painter)Paints the axis baseline, ticks, grid lines, tick labels, and axis title onto an axis canvas.
rater(graph.axis.rater)Evaluates candidate tick partitionings by scoring the number of ticks/labels and checking the painted label boxes for overlaps or crowding. The candidate with the lowest penalty score is selected.
positioner(graph.axis.positioner)Defines the geometric curve (straight line or arbitrary path), tick direction, and grid paths of an anchored axis on the canvas.
Customizing Axes and Subcomponents via Keyword Splitting¶
Every axis, painter, and texter instance in graph.axis is callable
(implementing __call__ via utils.merge_members_kwargs()) and supports
underscore-separated keyword forwarding (utils.kwsplit()). This means you
can customize nested components without verbose boilerplate:
from pyx import *
# Equivalent ways to enable grid lines and set a custom label prefix on a linear axis:
ax1 = graph.axis.linear(min=0, max=10,
painter=graph.axis.painter.regular(gridattrs=[color.gray(0.8)]),
texter=graph.axis.texter.default(mantissatexter_prefix=r"\$"))
ax2 = graph.axis.linear(min=0, max=10,
painter_gridattrs=[color.gray(0.8)],
texter_mantissatexter_prefix=r"\$")
Module graph.axis.axis: Axis Classes¶
All classes in graph.axis.axis are also exposed directly in
graph.axis (e.g. graph.axis.linear, graph.axis.log,
graph.axis.bar).
Continuous Regular Axes (linear and logarithmic)¶
- class graph.axis.axis.linear(min=None, max=None, reverse=0, divisor=None, title=None, parter=parter.autolinear(), manualticks=[], rater=rater.linear(), maxworse=2, texter=texter.default(), painter=painter.regular(), linkpainter=painter.linked(), fallbackrange=None, **kwargs)¶
A linear axis mapping \([\text{min}, \text{max}]\) linearly onto \([0, 1]\). Also available under the short alias
lin.min, max: Fixed lower and upper bounds of the axis. When left as
None, the bounds are determined automatically from the plotted data and extended to the nearest outer tick if allowed by parter. Ifmin > max, the bounds are swapped and reverse is toggled automatically.reverse: When true, reverses the direction of the axis so values decrease from
0to1in graph coordinates.divisor: Optional number by which all data values are divided before partitioning and formatting ticks (for example,
divisor=math.pipaired withtexter=graph.axis.texter.rational(suffix=r"\pi")labels ticks in multiples of \(\pi\)).title: Axis title string, typeset using the graph’s text engine.
parter: Partitioner instance (default
parter.autolinear) orNoneto draw only manualticks.manualticks: List of
tickinstances merged with the ticks generated by parter (manual ticks override automatic ticks at identical positions).rater, maxworse: Rater instance (
rater.linear) and maximum number of consecutively worse partitioning candidates to explore before stopping the search in each direction.texter: Texter instance (default
texter.default) used to format unlabeled ticks.painter: Painter instance (default
painter.regular) used to draw the primary axis.linkpainter: Painter instance (default
painter.linked) used when an opposite linked axis (such asx2ory2) is created automatically.fallbackrange: Minimal range width (or
(min, max)tuple) used when the plotted data has zero span (for example, a constant function).**kwargs: Underscore-split keyword arguments forwarded to
painter,texter,linkpainter,parter, orrater(e.g.painter_gridattrs=...).
- class graph.axis.axis.logarithmic(min=None, max=None, reverse=0, divisor=None, title=None, parter=parter.autologarithmic(), linearparter=parter.autolinear(extendtick=None), manualticks=[], maxworse=2, rater=rater.logarithmic(), texter=texter.default(), painter=painter.regular(), linkpainter=painter.linked(), fallbackrange=None, **kwargs)¶
A logarithmic axis mapping positive (or negative) values logarithmically onto \([0, 1]\). Also available under the short alias
log.All arguments work as in
linear, with defaults tailored for logarithmic scales (parter.autologarithmicandrater.logarithmic). If the data spans such a narrow interval that no valid logarithmic partitioning without overlapping labels can be found, the axis logs a warning and automatically falls back to linearparter (unlesslinearparter=None).
- class graph.axis.axis.log(...)¶
Alias for
logarithmic.
Discrete and Segmented Axes (bar, nestedbar, and split)¶
- class graph.axis.axis.bar(subaxes=None, defaultsubaxis=linear(painter=None, linkpainter=None, parter=None), dist=0.5, firstdist=None, lastdist=None, title=None, reverse=0, epsilon=1e-10, painter=painter.bar(), linkpainter=painter.linkedbar(), **kwargs)¶
Discrete categorical axis for bar charts (
graph.style.bar). A bar axis maps a 2-tuple(name, subvalue)to a normalized graph coordinate:nameselects one of the discrete categories along the bar axis (ordered by their appearance in the data, or reversed whenreverse=1).subvalueis converted by the subaxis associated withnameand mapped into the sub-interval of \([0, 1]\) allocated to that category.subaxes: Optional dictionary or sequence mapping category names to explicit subaxis instances; any category not in subaxes uses a copy of defaultsubaxis.
dist, firstdist, lastdist: Spacing between consecutive category intervals, before the first category, and after the last category, measured relative to a unit subaxis size of
1(defaultdist=0.5, with firstdist and lastdist defaulting to0.5 * dist).**kwargs: Underscore-split keyword arguments forwarded to
defaultsubaxis,painter, orlinkpainter.
- class graph.axis.axis.nestedbar(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(), **kwargs)¶
A two-level hierarchical bar axis for grouped side-by-side bar charts, where defaultsubaxis is itself a
baraxis withdist=0. Data values passed to anestedbaraxis have the nested tuple form((category, subcategory), subvalue).
- class graph.axis.axis.split(subaxes=None, defaultsubaxis=linear(), dist=0.5, firstdist=0, lastdist=0, title=None, reverse=0, painter=painter.split(), linkpainter=painter.linkedsplit(), **kwargs)¶
A segmented continuous axis divided into multiple continuous sub-ranges separated by visual break markers (painted by
painter.split). Data values can be routed to subaxes automatically usinggraph.data.splitatvalue().
- class graph.axis.axis.sizedlinear(size=1, **kwargs)¶
- class graph.axis.axis.autosizedlinear(**kwargs)¶
Subclasses of
linear(also aliased assizedlinandautosizedlin) for use as subaxes in abarorsplitaxis.sizedlinearassigns a fixed relative width size to the subaxis, whereasautosizedlinearscales the width of each subaxis proportionally to its data spanmax - min.
Anchored, Linked, and Standalone Path Axes¶
- class graph.axis.axis.anchoredaxis(axis, textengine, errorname)¶
Combines an
_axisinstance with apositioner.positionerand per-graph storage (self.dataandself.canvas). Graph instances store their anchored axes ing.axes[name]. Once the axis layout has been created,anchoredaxisprovides the following geometric methods:- basepath(x1=None, x2=None)¶
- vbasepath(v1=None, v2=None)¶
Returns a
path.pathalong the axis baseline between data values x1 and x2 (or graph coordinates v1 and v2).
- gridpath(x)¶
- vgridpath(v)¶
Returns the grid line
path.pathacross the graph at data value x (or graph coordinate v), orNoneif no grid path is defined.
- tickpoint(x)¶
- tickpoint_pt(x)¶
- vtickpoint(v)¶
- vtickpoint_pt(v)¶
Returns the canvas coordinates
(x, y)of the point on the axis baseline corresponding to data value x (or graph coordinate v).
- tickdirection(x)¶
- vtickdirection(v)¶
Returns the unit normal vector
(dx, dy)pointing toward the interior of the graph at data value x (or graph coordinate v).
- class graph.axis.axis.linkedaxis(linkedaxis=None, errorname='manual-linked', painter=_marker, **kwargs)¶
An anchored axis that shares the data range, scaling, and tick positions of another
anchoredaxisinstance linkedaxis (for example, to link an axis in one graph to the axis of an adjacent graph in a multi-panel figure).- setlinkedaxis(linkedaxis)¶
Binds or updates the target linkedaxis after construction.
- class graph.axis.axis.anchoredpathaxis(path, axis, textengine=text.defaulttextengine, direction=1)¶
- graph.axis.axis.pathaxis(path, axis, **kwargs)¶
Creates and paints a standalone axis (which must have explicit min and max bounds) along an arbitrary geometric
path.path. direction specifies whether ticks point to the left (1, default) or right (-1) of the path tangent.pathaxis()immediately builds the axis and returns its paintedcanvas.canvasso it can be inserted directly into any canvas:c = canvas.canvas() c.insert(graph.axis.pathaxis(path.curve(0, 0, 2, 2, 4, -2, 6, 0), graph.axis.linear(min=0, max=10)))
Module graph.axis.timeaxis: Date and Time Axes¶
The graph.axis.timeaxis module provides classes for plotting Python
datetime.datetime (or datetime.date) objects along a
continuous axis:
- class graph.axis.timeaxis.timeaxis(parter=None, rater=rater.linear(), **args)¶
A continuous axis (inheriting from
linear) whose data bounds and values are Pythondatetime.datetimeinstances.
- class graph.axis.timeaxis.timetick(year, month, day, ticklevel=0, labellevel=0, label=None, labelattrs=[], **kwargs)¶
A tick subclassing
datetime.datetimewith tick and label hierarchy levels ticklevel and labellevel and optional explicit label.
Module graph.axis.tick: Axis Ticks¶
- class graph.axis.tick.rational(x, power=1, floatprecision=10)¶
Exact rational number
num / denomused internally by partitioners and texters to avoid floating-point rounding errors. x can be:A
float(converted using precision floatprecision),A decimal or fraction string (such as
"0.25"or"1/3"),A 2-tuple of integers
(num, denom), orAny object with
.numand.denominteger attributes (or a Pythonfractions.Fraction).
If power is given, the rational number is raised to the integer exponent power.
- class graph.axis.tick.tick(x, ticklevel=0, labellevel=0, label=None, labelattrs=[], power=1, floatprecision=10)¶
Represents a tick mark and/or label at position x (interpreted as a
rational). Instances oftickcan be passed to themanualtickslist of any regular axis:ax = graph.axis.linear(min=0, max=4, manualticks=[graph.axis.tick.tick(math.pi, label=r"$\pi$")])
ticklevel: Non-negative integer specifying the tick hierarchy level (
0for a major tick,1for a subtick,2for a sub-subtick, etc.), orNoneto draw no tick mark at this position.labellevel: Non-negative integer specifying the label hierarchy level (
0for a major label,1for a sublabel, etc.), orNoneto omit the label at this position.label: Explicit label string, or
Noneto let the axis’stextergenerate the label automatically.labelattrs: Additional text attributes applied to this specific tick’s label.
Module graph.axis.parter: Axis Partitioners¶
Partitioners generate candidate lists of tick instances
for a given axis range.
Linear Partitioners¶
- class graph.axis.parter.linear(tickdists=None, labeldists=None, extendtick=0, extendlabel=None, epsilon=1e-10)¶
- class graph.axis.parter.lin(...)¶
Places ticks at fixed equidistant intervals specified in tickdists (a list of intervals
[major_step, subtick_step, ...], where each step can be a number, string, orrational).labeldists: Optional list of step sizes for labeled ticks. When
None(default), labels are placed at major ticks (level0) only.extendtick, extendlabel: Tick or label level (default
0for extendtick,Nonefor extendlabel) to which an auto-ranged axis is expanded if the data exceeds the outermost tick by more than epsilon.
- class graph.axis.parter.autolinear(variants=defaultvariants, extendtick=0, epsilon=1e-10)¶
Logarithmic Partitioners¶
- class graph.axis.parter.preexp(pres, exp)¶
Specifies a repeating sequence of logarithmic tick positions of the form \(p_i \cdot \text{exp}^n\) for all integers \(n\) and prefixes \(p_i \in \text{pres}\).
- class graph.axis.parter.logarithmic(tickpreexps=None, labelpreexps=None, extendtick=0, extendlabel=None, epsilon=1e-10)¶
- class graph.axis.parter.log(...)¶
Places ticks on a logarithmic axis according to the list of
preexpinstances in tickpreexps (for ticks, subticks, …) and labelpreexps (for labels, sublabels, …).Predefined
preexpconstants onlogarithmic:logarithmic.pre1exp— powers of 10 (\(10^n\))logarithmic.pre125exp— \(1, 2, 5 \times 10^n\)logarithmic.pre1to9exp— \(1, 2, \dots, 9 \times 10^n\)
- class graph.axis.parter.autologarithmic(variants=defaultvariants, extendtick=0, extendlabel=None, autoexponent=10, epsilon=1e-10)¶
- class graph.axis.parter.autolog(...)¶
Evaluates candidate logarithmic tick and label patterns from variants (ordered from densest to sparsest) for rating by the axis rater.
Module graph.axis.texter: Axis Texters¶
Texters format the numeric value of each tick whose
labellevel is not None and whose label is not already set manually.
All texters are callable so you can clone and tweak them via keyword arguments.
- class graph.axis.texter.default(multiplicationtex='\\cdot{}', multiplicationunicode='·', base=Fraction(10), skipmantissaunity=skipmantissaunity.all, minusunity='-', minexponent=4, minnegexponent=None, uniformexponent=True, mantissatexter=decimal(), basetexter=decimal(), exponenttexter=decimal(), labelattrs=[text.mathmode], **kwargs)¶
The default texter for linear and logarithmic axes. Formats moderate numbers in plain decimal notation and automatically switches to scientific notation (\(m \cdot 10^e\)) for large or small exponents, producing a
text.MultiEngineTextthat works seamlessly with both TeX/LaTeX engines andtext.UnicodeEngine.multiplicationtex, multiplicationunicode: Multiplication symbol placed between the mantissa and base for TeX engines and
text.UnicodeEngine, respectively.base: Exponent base (default
Fraction(10)).skipmantissaunity: Controls when a mantissa of
1is omitted (so \(1 \cdot 10^5\) is written simply as \(10^5\)):skipmantissaunity.never(0): Always write \(1 \cdot 10^e\).skipmantissaunity.each(1): Omit1on any individual tick whose mantissa is unity.skipmantissaunity.all(2, default): Omit1only when all exponentially formatted ticks on the axis have a mantissa of unity (as on a standard logarithmic axis).
minexponent, minnegexponent: Minimum positive exponent (default
4, i.e. \(10^4\)) and minimum negative exponent magnitude (defaults to minexponent, i.e. \(10^{-4}\)) at which exponential notation is used.uniformexponent: When
True(default), if any non-zero tick on the axis triggers exponential notation, all non-zero ticks on the axis are formatted in exponential notation for visual consistency.mantissatexter, basetexter, exponenttexter:
decimaltexters used to format the mantissa, base, and exponent (can also be configured via underscore-split keywords such asmantissatexter_equalprecision=True).labelattrs: Text attributes added to each formatted tick (default
[text.mathmode]).
- class graph.axis.texter.decimal(prefix='', infix='', suffix='', equalprecision=False, decimalsep='.', thousandsep='', thousandthpartsep='', plus='', minus='-', period='\\overline{%s}', labelattrs=[text.mathmode])¶
Formats ticks in fixed-point decimal notation.
prefix, infix, suffix: Strings inserted before the sign, immediately after the sign, and at the end of the number, respectively.
equalprecision: When
True, pads all decimal tick labels on the axis with trailing zeros to match the tick with the most decimal places.decimalsep, thousandsep, thousandthpartsep: Separators for the decimal point and 3-digit groups in the integer and fractional parts.
plus, minus: Sign strings for non-negative and negative values.
period: Format string with a single
%splaceholder used to render repeating decimal periods (defaultr"\overline{%s}").
- class graph.axis.texter.rational(prefix='', infix='', suffix='', numprefix='', numinfix='', numsuffix='', denomprefix='', denominfix='', denomsuffix='', plus='', minus='-', minuspos=0, over='{{%s}\\over{%s}}', equaldenom=False, skip1=True, skipnum0=True, skipnum1=True, skipdenom1=True, labelattrs=[text.mathmode])¶
Formats ticks as exact reduced fractions \(\frac{a}{b}\) (especially useful for axes partitioned in multiples of \(\pi\) or rational fractions).
prefix, infix, suffix: Strings placed around the entire fraction.
numprefix, numinfix, numsuffix: Strings placed around the numerator (for example,
numsuffix=r"\pi").denomprefix, denominfix, denomsuffix: Strings placed around the denominator.
minuspos: Placement of the sign:
0(in front of the fraction),1(in the numerator), or-1(in the denominator).over: Format string with two
%splaceholders for numerator and denominator (defaultr"{{%s}\over{%s}}"; user"{{%s}/{%s}}"for inline slash fractions).equaldenom: When
True, expresses all fractions on the axis over their least common denominator instead of reducing each fraction individually.skip1, skipnum0, skipnum1, skipdenom1: Booleans controlling automatic simplification when the fraction is \(\pm 1\), the numerator is
0or \(\pm 1\), or the denominator is1.
Module graph.axis.painter: Axis Painters¶
Painters draw the visual representation of an axis onto an axiscanvas.
Helper Classes (rotatetext and ticklength)¶
- class graph.axis.painter.rotatetext(direction, epsilon=1e-10)¶
Computes a
trafo.rotatetransformation for axis labels or titles at angle direction (in degrees) relative to the inward tick direction, automatically flipping the text by 180° whenever it would otherwise appear upside-down.- parallel¶
rotatetext(90)— orients text parallel to the axis baseline.
- orthogonal¶
rotatetext(180)— orients text perpendicular to the axis baseline.
- class graph.axis.painter.ticklength(initial, factor)¶
A changeable attribute (
attr.changeattr) that generates a geometric progression of visual lengths \(\text{initial} \cdot \text{factor}^k\) for major ticks (\(k = 0\)), subticks (\(k = 1\)), sub-subticks (\(k = 2\)), etc.Predefined instances with
factor = 1 / goldenmeanand base length0.12 * unit.v_cmscaled by powers of \(\sqrt{2}\) are provided as class attributes:ticklength.SHORT,ticklength.SHORt,ticklength.SHOrt,ticklength.SHort,ticklength.Short,ticklength.short,ticklength.normal,ticklength.long,ticklength.Long,ticklength.LOng,ticklength.LONg, andticklength.LONG.
Painter Classes¶
- class graph.axis.painter.regular(innerticklength=ticklength.normal, outerticklength=None, tickattrs=[], gridattrs=None, basepathattrs=[], labeldist=0.3 * unit.v_cm, labelattrs=[], labeldirection=None, labelhequalize=0, labelvequalize=1, titledist=0.3 * unit.v_cm, titleattrs=[], titledirection=rotatetext.parallel, titlepos=0.5, textengine=None)¶
Default painter for continuous axes (
linear,logarithmic,timeaxis).innerticklength, outerticklength: Visual length (or changeable
ticklength) of ticks pointing inside and outside the graph, orNoneto omit inner or outer ticks.tickattrs: Stroke attributes for ticks (supports changeable attributes to style major ticks and subticks differently), or
Noneto suppress ticks.gridattrs: Stroke attributes for grid lines across the graph (for example,
[color.gray(0.8)]or[attr.changelist([style.linestyle.solid, style.linestyle.dotted])]), orNone(default) to disable grid lines.basepathattrs: Stroke attributes for the axis baseline (merged with
[style.linecap.square]), orNoneto omit the baseline.labeldist: Visual distance between the axis baseline (or outer ticks) and the tick labels (default
0.3 * unit.v_cm).labelattrs: Text attributes for tick labels (merged with
[text.halign.center, text.vshift.mathaxis]), orNoneto suppress tick labels.labeldirection: Optional
rotatetextinstance to rotate tick labels relative to the axis.labelhequalize, labelvequalize: Aligns all tick labels along a common horizontal or vertical line on straight vertical or horizontal axes.
titledist, titleattrs, titledirection, titlepos: Distance, text attributes (or
Noneto hide), rotation (rotatetext.parallelby default), and normalized position (\(0.5\) = centered) of the axis title.textengine: Optional text engine override (defaults to the graph’s text engine).
- class graph.axis.painter.linked(innerticklength=ticklength.short, outerticklength=None, tickattrs=[], gridattrs=None, basepathattrs=[], labeldist=0.3 * unit.v_cm, labelattrs=None, labeldirection=None, labelhequalize=0, labelvequalize=1, titledist=0.3 * unit.v_cm, titleattrs=None, titledirection=rotatetext.parallel, titlepos=0.5, textengine=None)¶
Subclass of
regularused by default for opposite linked axes (x2,y2), withinnerticklength=ticklength.shortand labels and titles disabled (labelattrs=None, titleattrs=None).
- class graph.axis.painter.bar(innerticklength=None, outerticklength=None, tickattrs=[], basepathattrs=[], namedist=0.3 * unit.v_cm, nameattrs=[], namedirection=None, namepos=0.5, namehequalize=0, namevequalize=1, titledist=0.3 * unit.v_cm, titleattrs=[], titledirection=rotatetext.parallel, titlepos=0.5, textengine=None)¶
- class graph.axis.painter.linkedbar(...)¶
Painters for
barandnestedbaraxes. Thename*parameters control the placement and formatting of the categorical bar labels, while innerticklength and outerticklength optionally mark the boundaries of each bar subaxis.linkedbardisables category names and the axis title by default.
- class graph.axis.painter.split(breaklinesdist=0.05 * unit.v_cm, breaklineslength=0.5 * unit.v_cm, breaklinesangle=-60, titledist=0.3 * unit.v_cm, titleattrs=[], titledirection=rotatetext.parallel, titlepos=0.5, textengine=None)¶
Module graph.axis.rater: Axis Raters¶
When an automatic partitioner (autolinear or
autologarithmic) produces multiple candidate tick
lists, an axis rater assigns a non-negative penalty score to each
candidate (where smaller scores are better):
Tick count and range rating: Scores the number of ticks, subticks, and labels against target optima (
cube) and penalizes excessive range expansion beyond the data bounds.Label layout rating: For the top-ranked candidates, paints the axis and checks the spacing between adjacent label boxes (
distance). Any candidate whose labels overlap is rejected completely.
- class graph.axis.rater.cube(opt, left=None, right=None, weight=1)¶
Cubic penalty function \(\text{weight} \cdot ((x - \text{opt}) / (\text{other} - \text{opt}))^3\) evaluating how far a count \(x\) deviates from the optimal value opt, where other is left (default
0) for \(x < \text{opt}\) and right (default3 * opt) for \(x > \text{opt}\).
- class graph.axis.rater.distance(opt=1 * unit.v_cm, weight=0.1)¶
Rates the visual separation between adjacent tick label boxes against the optimal separation opt (rejecting negative separations where labels overlap).
- class graph.axis.rater.rater(ticks, labels, range, distance=distance(1 * unit.v_cm), density=1)¶
Combines lists of
cuberaters for ticks and labels at each hierarchy level, acuberater for range extension, and adistancerater for label spacing. Increasing density (e.g.density=1.5or2) scales the optimal tick and label counts upward to favor denser ticks; decreasing density (e.g.density=0.7) favors fewer ticks.
- class graph.axis.rater.linear(ticks=[cube(4), cube(10, weight=0.5)], labels=[cube(4)], range=cube(1, weight=2), **kwargs)¶
- class graph.axis.rater.lin(...)¶
Default rater for linear axes.
- class graph.axis.rater.logarithmic(ticks=[cube(5, right=20), cube(20, right=100, weight=0.5)], labels=[cube(5, right=20), cube(5, right=20, weight=0.5)], range=cube(1, weight=2), **kwargs)¶
- class graph.axis.rater.log(...)¶
Default rater for logarithmic axes.
Module graph.axis.positioner: Axis Positioners¶
Positioner instances define the geometric placement of an axis on a canvas and
are created automatically by graph.graphxy, graph.graphxyz,
and graph.axis.pathaxis(). Every positioner implements the following
interface:
- class graph.axis.positioner._positioner¶
- vbasepath(v1=None, v2=None)¶
Returns the
path.pathof the axis baseline between normalized graph coordinates v1 and v2.
- vgridpath(v)¶
Returns the grid line
path.pathat normalized coordinate v, orNoneif no grid is defined.
- vtickpoint_pt(v)¶
Returns
(x_pt, y_pt)in PostScript points on the baseline at normalized coordinate v.
- vtickdirection(v)¶
Returns the unit normal vector
(dx, dy)pointing toward the graph interior at normalized coordinate v.