|
(This page applies only to the 1.x branch of SVGFig.) class LineAxisLineAxis draws an axis along an arbitrary line. If the coordinate transformation is curved, the axis will curve with it. ArgumentsLineAxis(x1, y1, x2, y2, start, end, ticks, miniticks, labels, logbase, arrow_start, arrow_end, text_attr, attribute=value) | x1, y1 | required | starting point | | x2, y2 | required | ending point | | start, end | default=0, 1 | values to start and end labeling | | ticks | default=-10 | request ticks according to the standard tick specification | | miniticks | default=True | request miniticks according to the standard minitick specification | | labels | True | request tick labels according to the standard tick label specification | | logbase | default=None | if a number, the x axis is logarithmic with ticks at the given base (10 being the most common) | | arrow_start | default=None | if a new string identifier, draw an arrow at the low-end of the axis, referenced by that identifier; if an SVG marker object, use that marker | | arrow_end | default=None | if a new string identifier, draw an arrow at the high-end of the axis, referenced by that identifier; if an SVG marker object, use that marker | | text_attr | default={} | SVG attributes for the text labels | | attribute=value pairs | keyword list | SVG attributes |
Tick labels on a LineAxis do not need to specify real coordinate positions; they are uniformly spaced between start and end. Arrows must be referenced by new string identifiers, otherwise, they could reference the wrong markers. SVG methodLineAxis has an SVG method, as described in General features for all primatives. DefaultsLineAxis has defaults as described in General features for all primatives. | defaults | {"stroke-width":"0.25pt"} | default SVG attributes for the curve and tick marks | | text_defaults | {"stroke":"none", "fill":"black", "font-size":5} | default SVG attributes for the text |
LineAxis also has the same defaults as Curve. | random_sampling | True | if False, bisect with a point exactly halfway between pairs of points; if True, randomly choose a point between 30% and 70% | | recursion_limit | 15 | number of subdivisions before giving up; if 15, sampling algorithm can visit at most 215 points | | linearity_limit | 0.05 | maximum deviation (in SVG units) from a straight line | | discontinuity_limit | 5 | minimum deviation (in SVG units) between points that is considered continuous |
Special data membersAfter the LineAxis has been evaluated with SVG, it gains three new data memebers. - last_ticks: explicit dict of value, label pairs for major ticks
- last_miniticks: explicit list of values for miniticks
- last_samples: an iterable of Curve.Sample objects:
>>> c = LineAxis(funcRtoR("x**2"), 0, 1)
>>> c.SVG()
>>> for s in c.last_samples:
... print s.x, s.y, s.X, s.Y
...Curve.Sample has four data members, x, y, X, Y. These are coordinates in local (lowercase) and global (uppercase) coordinates. If a coordinate is None, there is a break in the curve, due to a discontinuity in the supplied function.
|