CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes

svgfig::Grid Class Reference

Inheritance diagram for svgfig::Grid:
svgfig::Ticks

List of all members.

Public Member Functions

def __init__
def __repr__
def SVG

Public Attributes

 attr
 high
 last_xminiticks
 last_yminiticks
 mini_attr
 xmax
 ymax

Static Public Attributes

dictionary defaults = {"stroke-width":"0.25pt", "stroke":"gray"}
dictionary mini_defaults = {"stroke-width":"0.25pt", "stroke":"lightgray", "stroke-dasharray":"1,1"}

Detailed Description

Draws a grid over a specified region using the standard tick
specification (see help(Ticks)) to place the grid lines.

Grid(xmin, xmax, ymin, ymax, ticks, miniticks, logbase, mini_attr, attribute=value)

xmin, xmax              required        the x range
ymin, ymax              required        the y range
ticks                   default=-10     request ticks according to the standard
                                        tick specification (see help(Ticks))
miniticks               default=False   request miniticks according to the
                                        standard minitick specification
logbase                 default=None    if a number, the axis is logarithmic
                                        with ticks at the given base (usually 10)
mini_attr               default={}      SVG attributes for the minitick-lines
                                        (if miniticks != False)
attribute=value pairs   keyword list    SVG attributes for the major tick lines

Definition at line 3222 of file svgfig.py.


Constructor & Destructor Documentation

def svgfig::Grid::__init__ (   self,
  xmin,
  xmax,
  ymin,
  ymax,
  ticks = -10,
  miniticks = False,
  logbase = None,
  mini_attr = {},
  attr 
)

Definition at line 3246 of file svgfig.py.

03246                                                                                                  {}, **attr):
03247     self.xmin, self.xmax = xmin, xmax
03248     self.ymin, self.ymax = ymin, ymax
03249 
03250     self.mini_attr = dict(self.mini_defaults)
03251     self.mini_attr.update(mini_attr)
03252 
03253     Ticks.__init__(self, None, None, None, ticks, miniticks, None, logbase)
03254 
03255     self.attr = dict(self.defaults)
03256     self.attr.update(attr)
03257 

Member Function Documentation

def svgfig::Grid::__repr__ (   self)

Reimplemented from svgfig::Ticks.

Definition at line 3243 of file svgfig.py.

03244                     :
03245     return "<Grid x=(%g, %g) y=(%g, %g) ticks=%s miniticks=%s %s>" % (self.xmin, self.xmax, self.ymin, self.ymax, str(self.ticks), str(self.miniticks), self.attr)

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

Reimplemented from svgfig::Ticks.

Definition at line 3258 of file svgfig.py.

03259                            :
03260     """Apply the transformation "trans" and return an SVG object."""
03261     self.low, self.high = self.xmin, self.xmax
03262     self.last_xticks, self.last_xminiticks = Ticks.interpret(self)
03263     self.low, self.high = self.ymin, self.ymax
03264     self.last_yticks, self.last_yminiticks = Ticks.interpret(self)
03265 
03266     ticksd = []
03267     for t in self.last_xticks.keys():
03268       ticksd += Line(t, self.ymin, t, self.ymax).Path(trans).d
03269     for t in self.last_yticks.keys():
03270       ticksd += Line(self.xmin, t, self.xmax, t).Path(trans).d
03271 
03272     miniticksd = []
03273     for t in self.last_xminiticks:
03274       miniticksd += Line(t, self.ymin, t, self.ymax).Path(trans).d
03275     for t in self.last_yminiticks:
03276       miniticksd += Line(self.xmin, t, self.xmax, t).Path(trans).d
03277 
03278     return SVG("g", Path(d=ticksd, **self.attr).SVG(), Path(d=miniticksd, **self.mini_attr).SVG())


Member Data Documentation

Reimplemented from svgfig::Ticks.

Definition at line 3246 of file svgfig.py.

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

Reimplemented from svgfig::Ticks.

Definition at line 3240 of file svgfig.py.

Reimplemented from svgfig::Ticks.

Definition at line 3258 of file svgfig.py.

Definition at line 3258 of file svgfig.py.

Definition at line 3258 of file svgfig.py.

Definition at line 3246 of file svgfig.py.

dictionary svgfig::Grid::mini_defaults = {"stroke-width":"0.25pt", "stroke":"lightgray", "stroke-dasharray":"1,1"} [static]

Definition at line 3241 of file svgfig.py.

Definition at line 3246 of file svgfig.py.

Definition at line 3246 of file svgfig.py.