Public Member Functions | |
def | __init__ |
def | __repr__ |
def | interpret |
def | SVG |
Public Attributes | |
end | |
exclude | |
f | |
high | |
low | |
start | |
Static Public Attributes | |
dictionary | defaults = {"stroke-width":"0.25pt"} |
dictionary | text_defaults = {"stroke":"none", "fill":"black", "font-size":5} |
Draws an axis with tick marks along a line. LineAxis(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 (see help(Ticks)) 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 (usually 10) 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
def svgfig::LineAxis::__init__ | ( | self, | |
x1, | |||
y1, | |||
x2, | |||
y2, | |||
start = 0. , |
|||
end = 1. , |
|||
ticks = -10 , |
|||
miniticks = True , |
|||
labels = True , |
|||
logbase = None , |
|||
arrow_start = None , |
|||
arrow_end = None , |
|||
exclude = None , |
|||
text_attr = {} , |
|||
attr | |||
) |
Definition at line 2887 of file svgfig.py.
02887 {}, **attr): 02888 self.start = start 02889 self.end = end 02890 self.exclude = exclude 02891 tattr = dict(self.text_defaults) 02892 tattr.update(text_attr) 02893 Line.__init__(self, x1, y1, x2, y2, **attr) 02894 Ticks.__init__(self, None, None, None, ticks, miniticks, labels, logbase, arrow_start, arrow_end, tattr, **attr) 02895
def svgfig::LineAxis::__repr__ | ( | self | ) |
Reimplemented from svgfig::Line.
Reimplemented in svgfig::XAxis, and svgfig::YAxis.
def svgfig::LineAxis::interpret | ( | self | ) |
Evaluate and return optimal ticks and miniticks according to the standard minitick specification. Normally only used internally.
Reimplemented from svgfig::Ticks.
Definition at line 2896 of file svgfig.py.
02897 : 02898 if self.exclude != None and not (isinstance(self.exclude, (tuple, list)) and len(self.exclude) == 2 and \ 02899 isinstance(self.exclude[0], (int, long, float)) and isinstance(self.exclude[1], (int, long, float))): 02900 raise TypeError, "exclude must either be None or (low, high)" 02901 02902 ticks, miniticks = Ticks.interpret(self) 02903 if self.exclude == None: return ticks, miniticks 02904 02905 ticks2 = {} 02906 for loc, label in ticks.items(): 02907 if self.exclude[0] <= loc <= self.exclude[1]: 02908 ticks2[loc] = "" 02909 else: 02910 ticks2[loc] = label 02911 02912 return ticks2, miniticks
def svgfig::LineAxis::SVG | ( | self, | |
trans = None |
|||
) |
Apply the transformation "trans" and return an SVG object.
Reimplemented from svgfig::Line.
Reimplemented in svgfig::XAxis, and svgfig::YAxis.
Definition at line 2913 of file svgfig.py.
02914 : 02915 """Apply the transformation "trans" and return an SVG object.""" 02916 line = Line.SVG(self, trans) # must be evaluated first, to set self.f, self.low, self.high 02917 02918 f01 = self.f 02919 self.f = lambda t: f01(1. * (t - self.start) / (self.end - self.start)) 02920 self.low = self.start 02921 self.high = self.end 02922 02923 if self.arrow_start != False and self.arrow_start != None: 02924 if isinstance(self.arrow_start, basestring): 02925 line.attr["marker-start"] = "url(#%s)" % self.arrow_start 02926 else: 02927 line.attr["marker-start"] = "url(#%s)" % self.arrow_start.id 02928 02929 if self.arrow_end != False and self.arrow_end != None: 02930 if isinstance(self.arrow_end, basestring): 02931 line.attr["marker-end"] = "url(#%s)" % self.arrow_end 02932 else: 02933 line.attr["marker-end"] = "url(#%s)" % self.arrow_end.id 02934 02935 ticks = Ticks.SVG(self, trans) # returns a <g /> 02936 ticks.append(line) return ticks
dictionary svgfig::LineAxis::defaults = {"stroke-width":"0.25pt"} [static] |
Reimplemented from svgfig::Line.
Reimplemented in svgfig::XAxis, and svgfig::YAxis.
Reimplemented from svgfig::Line.
Reimplemented from svgfig::Line.
Reimplemented from svgfig::Line.
dictionary svgfig::LineAxis::text_defaults = {"stroke":"none", "fill":"black", "font-size":5} [static] |
Reimplemented from svgfig::Ticks.
Reimplemented in svgfig::XAxis, and svgfig::YAxis.