CMS 3D CMS Logo

Public Member Functions | Static Public Attributes

svgfig::CurveAxis Class Reference

Inheritance diagram for svgfig::CurveAxis:
svgfig::Curve svgfig::Ticks

List of all members.

Public Member Functions

def __init__
def __repr__
def SVG

Static Public Attributes

dictionary defaults = {"stroke-width":"0.25pt"}
dictionary text_defaults = {"stroke":"none", "fill":"black", "font-size":5}

Detailed Description

Draw an axis with tick marks along a parametric curve.

CurveAxis(f, low, high, ticks, miniticks, labels, logbase, arrow_start, arrow_end,
text_attr, attribute=value)

f                      required         a Python callable or string in
                                        the form "f(t), g(t)", just like Curve
low, high              required         left and right endpoints
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 (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

Definition at line 2792 of file svgfig.py.


Constructor & Destructor Documentation

def svgfig::CurveAxis::__init__ (   self,
  f,
  low,
  high,
  ticks = -10,
  miniticks = True,
  labels = True,
  logbase = None,
  arrow_start = None,
  arrow_end = None,
  text_attr = {},
  attr 
)

Reimplemented from svgfig::Ticks.

Definition at line 2827 of file svgfig.py.

02827                                                                                                                                      {}, **attr):
02828     tattr = dict(self.text_defaults)
02829     tattr.update(text_attr)
02830     Curve.__init__(self, f, low, high)
02831     Ticks.__init__(self, f, low, high, ticks, miniticks, labels, logbase, arrow_start, arrow_end, tattr, **attr)
02832 

Member Function Documentation

def svgfig::CurveAxis::__repr__ (   self)

Reimplemented from svgfig::Curve.

Definition at line 2824 of file svgfig.py.

02825                     :
02826     return "<CurveAxis %s [%s, %s] ticks=%s labels=%s %s>" % (self.f, self.low, self.high, str(self.ticks), str(self.labels), self.attr)

def svgfig::CurveAxis::SVG (   self,
  trans = None 
)
Apply the transformation "trans" and return an SVG object.

Reimplemented from svgfig::Curve.

Definition at line 2833 of file svgfig.py.

02834                            :
02835     """Apply the transformation "trans" and return an SVG object."""
02836     func = Curve.SVG(self, trans)
02837     ticks = Ticks.SVG(self, trans) # returns a <g />
02838 
02839     if self.arrow_start != False and self.arrow_start != None:
02840       if isinstance(self.arrow_start, basestring):
02841         func.attr["marker-start"] = "url(#%s)" % self.arrow_start
02842       else:
02843         func.attr["marker-start"] = "url(#%s)" % self.arrow_start.id
02844 
02845     if self.arrow_end != False and self.arrow_end != None:
02846       if isinstance(self.arrow_end, basestring):
02847         func.attr["marker-end"] = "url(#%s)" % self.arrow_end
02848       else:
02849         func.attr["marker-end"] = "url(#%s)" % self.arrow_end.id
02850 
02851     ticks.append(func)
02852     return ticks


Member Data Documentation

dictionary svgfig::CurveAxis::defaults = {"stroke-width":"0.25pt"} [static]

Reimplemented from svgfig::Curve.

Definition at line 2821 of file svgfig.py.

dictionary svgfig::CurveAxis::text_defaults = {"stroke":"none", "fill":"black", "font-size":5} [static]

Reimplemented from svgfig::Ticks.

Definition at line 2822 of file svgfig.py.