CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes

svgfig::Axes Class Reference

List of all members.

Public Member Functions

def __init__
def __repr__
def SVG

Public Attributes

 arrows
 attr
 aty
 text_attr
 xlogbase
 xmax
 ylogbase
 ymax

Static Public Attributes

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

Detailed Description

Draw a pair of intersecting x-y axes.

Axes(xmin, xmax, ymin, ymax, atx, aty, xticks, xminiticks, xlabels, xlogbase,
yticks, yminiticks, ylabels, ylogbase, arrows, text_attr, attribute=value)

xmin, xmax               required       the x range
ymin, ymax               required       the y range
atx, aty                 default=0, 0   point where the axes try to cross;
                                        if outside the range, the axes will
                                        cross at the closest corner
xticks                   default=-10    request ticks according to the standard
                                        tick specification (see help(Ticks))
xminiticks               default=True   request miniticks according to the
                                        standard minitick specification
xlabels                  True           request tick labels according to the
                                        standard tick label specification
xlogbase                 default=None   if a number, the x axis is logarithmic
                                        with ticks at the given base (usually 10)
yticks                   default=-10    request ticks according to the standard
                                        tick specification
yminiticks               default=True   request miniticks according to the
                                        standard minitick specification
ylabels                  True           request tick labels according to the
                                        standard tick label specification
ylogbase                 default=None   if a number, the y axis is logarithmic
                                        with ticks at the given base (usually 10)
arrows                   default=None   if a new string identifier, draw arrows
                                        referenced by that identifier
text_attr                default={}     SVG attributes for the text labels
attribute=value pairs    keyword list   SVG attributes for all lines

Definition at line 3042 of file svgfig.py.


Constructor & Destructor Documentation

def svgfig::Axes::__init__ (   self,
  xmin,
  xmax,
  ymin,
  ymax,
  atx = 0,
  aty = 0,
  xticks = -10,
  xminiticks = True,
  xlabels = True,
  xlogbase = None,
  yticks = -10,
  yminiticks = True,
  ylabels = True,
  ylogbase = None,
  arrows = None,
  text_attr = {},
  attr 
)

Definition at line 3080 of file svgfig.py.

03080                                                                                                                                                                                                       {}, **attr):
03081     self.xmin, self.xmax = xmin, xmax
03082     self.ymin, self.ymax = ymin, ymax
03083     self.atx, self.aty = atx, aty
03084     self.xticks, self.xminiticks, self.xlabels, self.xlogbase = xticks, xminiticks, xlabels, xlogbase
03085     self.yticks, self.yminiticks, self.ylabels, self.ylogbase = yticks, yminiticks, ylabels, ylogbase
03086     self.arrows = arrows
03087 
03088     self.text_attr = dict(self.text_defaults)
03089     self.text_attr.update(text_attr)
03090 
03091     self.attr = dict(self.defaults)
03092     self.attr.update(attr)
03093 

Member Function Documentation

def svgfig::Axes::__repr__ (   self)

Definition at line 3077 of file svgfig.py.

03078                     :
03079     return "<Axes x=(%g, %g) y=(%g, %g) at (%g, %g) %s>" % (self.xmin, self.xmax, self.ymin, self.ymax, self.atx, self.aty, self.attr)

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

Definition at line 3094 of file svgfig.py.

03095                            :
03096     """Apply the transformation "trans" and return an SVG object."""
03097     atx, aty = self.atx, self.aty
03098     if atx < self.xmin: atx = self.xmin
03099     if atx > self.xmax: atx = self.xmax
03100     if aty < self.ymin: aty = self.ymin
03101     if aty > self.ymax: aty = self.ymax
03102 
03103     xmargin = 0.1 * abs(self.ymin - self.ymax)
03104     xexclude = atx - xmargin, atx + xmargin
03105     
03106     ymargin = 0.1 * abs(self.xmin - self.xmax)
03107     yexclude = aty - ymargin, aty + ymargin
03108 
03109     if self.arrows != None and self.arrows != False:
03110       xarrow_start = self.arrows + ".xstart"
03111       xarrow_end = self.arrows + ".xend"
03112       yarrow_start = self.arrows + ".ystart"
03113       yarrow_end = self.arrows + ".yend"
03114     else:
03115       xarrow_start = xarrow_end = yarrow_start = yarrow_end = None
03116 
03117     xaxis = XAxis(self.xmin, self.xmax, aty, self.xticks, self.xminiticks, self.xlabels, self.xlogbase, xarrow_start, xarrow_end, exclude=xexclude, text_attr=self.text_attr, **self.attr).SVG(trans)
03118     yaxis = YAxis(self.ymin, self.ymax, atx, self.yticks, self.yminiticks, self.ylabels, self.ylogbase, yarrow_start, yarrow_end, exclude=yexclude, text_attr=self.text_attr, **self.attr).SVG(trans)
03119     return SVG("g", *(xaxis.sub + yaxis.sub))


Member Data Documentation

Definition at line 3080 of file svgfig.py.

Definition at line 3080 of file svgfig.py.

Definition at line 3080 of file svgfig.py.

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

Definition at line 3074 of file svgfig.py.

Definition at line 3080 of file svgfig.py.

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

Definition at line 3075 of file svgfig.py.

Definition at line 3080 of file svgfig.py.

Definition at line 3080 of file svgfig.py.

Definition at line 3080 of file svgfig.py.

Definition at line 3080 of file svgfig.py.