CMS 3D CMS Logo

Public Member Functions | Public Attributes

svgfig::Plot Class Reference

List of all members.

Public Member Functions

def __init__
def __repr__
def SVG

Public Attributes

 arrows
 atx
 aty
 axis_attr
 d
 flipx
 flipy
 height
 last_window
 minusInfinity
 text_attr
 trans
 width
 x
 xlabels
 xlogbase
 xminiticks
 xticks
 y
 ylabels
 ylogbase
 ymax
 yminiticks
 yticks

Detailed Description

Acts like Fig, but draws a coordinate axis. You also need to supply plot ranges.

Plot(xmin, xmax, ymin, ymax, obj, obj, obj..., keyword options...)

xmin, xmax      required        minimum and maximum x values (in the objs' coordinates)
ymin, ymax      required        minimum and maximum y values (in the objs' coordinates)
obj             optional list   drawing primatives
keyword options keyword list    options defined below

The following are keyword options, with their default values:

trans           None          transformation function
x, y            5, 5          upper-left corner of the Plot in SVG coordinates
width, height   90, 90        width and height of the Plot in SVG coordinates
flipx, flipy    False, True   flip the sign of the coordinate axis
minusInfinity   -1000         if an axis is logarithmic and an object is plotted at 0 or
                              a negative value, -1000 will be used as a stand-in for NaN
atx, aty        0, 0          the place where the coordinate axes cross
xticks          -10           request ticks according to the standard tick specification
                              (see help(Ticks))
xminiticks      True          request miniticks according to the standard minitick
                              specification
xlabels         True          request tick labels according to the standard tick label
                              specification
xlogbase        None          if a number, the axis and transformation are logarithmic
                              with ticks at the given base (10 being the most common)
(same for y)
arrows          None          if a new identifier, create arrow markers and draw them
                              at the ends of the coordinate axes
text_attr       {}            a dictionary of attributes for label text
axis_attr       {}            a dictionary of attributes for the axis lines

Definition at line 782 of file svgfig.py.


Constructor & Destructor Documentation

def svgfig::Plot::__init__ (   self,
  xmin,
  xmax,
  ymin,
  ymax,
  d,
  kwds 
)

Definition at line 822 of file svgfig.py.

00823                                                         :
00824     self.xmin, self.xmax, self.ymin, self.ymax = xmin, xmax, ymin, ymax
00825     self.d = list(d)
00826     defaults = {"trans":None, "x":5, "y":5, "width":90, "height":90, "flipx":False, "flipy":True, "minusInfinity":-1000, \
00827                 "atx":0, "xticks":-10, "xminiticks":True, "xlabels":True, "xlogbase":None, \
00828                 "aty":0, "yticks":-10, "yminiticks":True, "ylabels":True, "ylogbase":None, \
00829                 "arrows":None, "text_attr":{}, "axis_attr":{}}
00830     defaults.update(kwds)
00831     kwds = defaults
00832 
00833     self.trans = kwds["trans"]; del kwds["trans"]
00834     self.x = kwds["x"]; del kwds["x"]
00835     self.y = kwds["y"]; del kwds["y"]
00836     self.width = kwds["width"]; del kwds["width"]
00837     self.height = kwds["height"]; del kwds["height"]
00838     self.flipx = kwds["flipx"]; del kwds["flipx"]
00839     self.flipy = kwds["flipy"]; del kwds["flipy"]
00840     self.minusInfinity = kwds["minusInfinity"]; del kwds["minusInfinity"]
00841     self.atx = kwds["atx"]; del kwds["atx"]
00842     self.xticks = kwds["xticks"]; del kwds["xticks"]
00843     self.xminiticks = kwds["xminiticks"]; del kwds["xminiticks"]
00844     self.xlabels = kwds["xlabels"]; del kwds["xlabels"]
00845     self.xlogbase = kwds["xlogbase"]; del kwds["xlogbase"]
00846     self.aty = kwds["aty"]; del kwds["aty"]
00847     self.yticks = kwds["yticks"]; del kwds["yticks"]
00848     self.yminiticks = kwds["yminiticks"]; del kwds["yminiticks"]
00849     self.ylabels = kwds["ylabels"]; del kwds["ylabels"]
00850     self.ylogbase = kwds["ylogbase"]; del kwds["ylogbase"]
00851     self.arrows = kwds["arrows"]; del kwds["arrows"]
00852     self.text_attr = kwds["text_attr"]; del kwds["text_attr"]
00853     self.axis_attr = kwds["axis_attr"]; del kwds["axis_attr"]
00854     if len(kwds) != 0:
00855       raise TypeError, "Plot() got unexpected keyword arguments %s" % kwds.keys()


Member Function Documentation

def svgfig::Plot::__repr__ (   self)

Definition at line 816 of file svgfig.py.

00817                     :
00818     if self.trans == None:
00819       return "<Plot (%d items)>" % len(self.d)
00820     else:
00821       return "<Plot (%d items) %s>" % (len(self.d), self.trans.func_name)

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

Definition at line 856 of file svgfig.py.

00857                            :
00858     """Apply the transformation "trans" and return an SVG object."""
00859     if trans == None: trans = self.trans
00860     if isinstance(trans, basestring): trans = totrans(trans)
00861 
00862     self.last_window = window(self.xmin, self.xmax, self.ymin, self.ymax, x=self.x, y=self.y, width=self.width, height=self.height, \
00863                               xlogbase=self.xlogbase, ylogbase=self.ylogbase, minusInfinity=self.minusInfinity, flipx=self.flipx, flipy=self.flipy)
00864 
00865     d = [Axes(self.xmin, self.xmax, self.ymin, self.ymax, self.atx, self.aty, \
00866               self.xticks, self.xminiticks, self.xlabels, self.xlogbase, \
00867               self.yticks, self.yminiticks, self.ylabels, self.ylogbase, \
00868               self.arrows, self.text_attr, **self.axis_attr)] \
00869         + self.d
00870 
00871     return Fig(Fig(*d, **{"trans":trans})).SVG(self.last_window)
    

Member Data Documentation

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 856 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 816 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.

Definition at line 822 of file svgfig.py.