CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
svgfig Namespace Reference

Classes

class  Axes
 
class  Curve
 
class  CurveAxis
 
class  Dots
 
class  Ellipse
 
class  Fig
 
class  Frame
 
class  Grid
 
class  HGrid
 
class  HLine
 
class  Line
 
class  LineAxis
 
class  LineGlobal
 
class  Path
 
class  Plot
 
class  Poly
 
class  Rect
 
class  SVG
 
class  Text
 
class  TextGlobal
 
class  Ticks
 
class  VGrid
 
class  VLine
 
class  XAxis
 
class  XErrorBars
 
class  YAxis
 
class  YErrorBars
 

Functions

def attr_preprocess
 
def canvas
 
def canvas_outline
 
def funcRtoC
 
def funcRtoR
 
def funcRtoR2
 
def load
 
def load_stream
 
def make_marker
 
def make_symbol
 
def pathtoPath
 
def rgb
 
def rotate
 
def template
 
def totrans
 
def unumber
 
def window
 

Variables

dictionary _canvas_defaults
 
tuple _circular_dot = make_symbol("circular_dot")
 
tuple _default_directory
 
string _default_fileName = "tmp.svg"
 
int _epsilon = 1
 
dictionary _hacks = {}
 
dictionary _marker_templates
 
dictionary _symbol_templates
 
 all_whitespace
 
 output
 
 stack
 

Function Documentation

def svgfig.attr_preprocess (   attr)

Definition at line 46 of file svgfig.py.

def svgfig.canvas (   sub,
  attr 
)
Creates a top-level SVG object, allowing the user to control the
image size and aspect ratio.

canvas(sub, sub, sub..., attribute=value)

sub                     optional list       nested SVG elements or text/Unicode
attribute=value pairs   optional keywords   SVG attributes

Default attribute values:

width           "400px"
height          "400px"
viewBox         "0 0 100 100"
xmlns           "http://www.w3.org/2000/svg"
xmlns:xlink     "http://www.w3.org/1999/xlink"
version         "1.1"
style           "stroke:black; fill:none; stroke-width:0.5pt; stroke-linejoin:round; text-anchor:middle"
font-family     "Helvetica,Arial,FreeSans?,Sans,sans,sans-serif"

Definition at line 481 of file svgfig.py.

Referenced by main(), tfwliteselectortest::ThingsTSelector.terminate(), tfwliteselectortest::ThingsTSelector2.terminate(), examples::TrackAnalysisAlgorithm.terminate(), __class__< T >.terminate(), and TestResolution.~TestResolution().

def svgfig.canvas_outline (   sub,
  attr 
)
Same as canvas(), but draws an outline around the drawable area,
so that you know how close your image is to the edges.

Definition at line 509 of file svgfig.py.

def svgfig.funcRtoC (   expr,
  var = "t",
  globals = None,
  locals = None 
)
Converts a complex "z(t)" string to a function acceptable for Curve.

expr    required        string in the form "z(t)"
var     default="t"   name of the independent variable
globals default=None    dict of global variables used in the expression;
                        you may want to use Python's builtin globals()
locals  default=None    dict of local variables

Definition at line 1451 of file svgfig.py.

def svgfig.funcRtoR (   expr,
  var = "x",
  globals = None,
  locals = None 
)
Converts a "f(x)" string to a function acceptable for Curve.

expr    required        string in the form "f(x)"
var     default="x"   name of the independent variable
globals default=None    dict of global variables used in the expression;
                        you may want to use Python's builtin globals()
locals  default=None    dict of local variables

Definition at line 1483 of file svgfig.py.

def svgfig.funcRtoR2 (   expr,
  var = "t",
  globals = None,
  locals = None 
)
Converts a "f(t), g(t)" string to a function acceptable for Curve.

expr    required        string in the form "f(t), g(t)"
var     default="t"   name of the independent variable
globals default=None    dict of global variables used in the expression;
                        you may want to use Python's builtin globals()
locals  default=None    dict of local variables

Definition at line 1468 of file svgfig.py.

def svgfig.load (   fileName)
def svgfig.load_stream (   stream)
Loads an SVG image from a stream (can be a string or a file object).

Definition at line 550 of file svgfig.py.

def svgfig.make_marker (   id,
  shape,
  attr 
)
Creates a new instance of an SVG marker to avoid cross-linking objects.

id                     required         a new identifier (string/Unicode)
shape                  required         the shape name from _marker_templates
attribute=value list   keyword list     modify the SVG attributes of the new marker

Definition at line 1964 of file svgfig.py.

def svgfig.make_symbol (   id,
  shape = "dot",
  attr 
)
Creates a new instance of an SVG symbol to avoid cross-linking objects.

id                    required         a new identifier (string/Unicode)
shape                 default="dot"  the shape name from _symbol_templates
attribute=value list  keyword list     modify the SVG attributes of the new symbol

Definition at line 1893 of file svgfig.py.

def svgfig.pathtoPath (   svg)
Converts SVG("path", d="...") into Path(d=[...]).

Definition at line 1006 of file svgfig.py.

def svgfig.rgb (   r,
  g,
  b,
  maximum = 1. 
)
Create an SVG color string "#xxyyzz" from r, g, and b.

r,g,b = 0 is black and r,g,b = maximum is white.

Definition at line 39 of file svgfig.py.

def svgfig.rotate (   angle,
  cx = 0,
  cy = 0 
)
Creates and returns a coordinate transformation which rotates
around (cx,cy) by "angle" degrees.

Definition at line 704 of file svgfig.py.

Referenced by MagGeoBuilderFromDDD::bLayer.bLayer(), CmsTrackerPhase1DiskBuilder.PhiPosNegSplit_innerOuter(), and DetPositioner.rotateGeomDet().

def svgfig.template (   fileName,
  svg,
  replaceme = "REPLACEME" 
)
Loads an SVG image from a file, replacing instances of
<REPLACEME /> with a given svg object.

fileName         required                name of the template SVG
svg              required                SVG object for replacement
replaceme        default="REPLACEME"   fake SVG element to be replaced by the given object

>>> print load("template.svg")
None                 <svg (2 sub) style=u'stroke:black; fill:none; stroke-width:0.5pt; stroke-linejoi
[0]                      <rect height=u'100' width=u'100' stroke=u'none' y=u'0' x=u'0' fill=u'yellow'
[1]                      <REPLACEME />
>>> 
>>> print template("template.svg", SVG("circle", cx=50, cy=50, r=30))
None                 <svg (2 sub) style=u'stroke:black; fill:none; stroke-width:0.5pt; stroke-linejoi
[0]                      <rect height=u'100' width=u'100' stroke=u'none' y=u'0' x=u'0' fill=u'yellow'
[1]                      <circle cy=50 cx=50 r=30 />

Definition at line 520 of file svgfig.py.

Referenced by dd_error_scan(), GenericMVAComputer.eval(), findNameSpaces(), edm::refitem::GetRefPtrImpl< C, T, F, KEY >.getRefPtr_(), edm::refitem::GetRefPtrImpl< C, T, F, unsigned int >.getRefPtr_(), edm::WorkerMaker< T >.makeModule(), and TrackerStablePhiSort().

def svgfig.totrans (   expr,
  vars = ("x", "y",
  globals = None,
  locals = None 
)
Converts to a coordinate transformation (a function that accepts
two arguments and returns two values).

expr       required                  a string expression or a function
                                     of two real or one complex value
vars       default=("x", "y")    independent variable names;
                                     a singleton ("z",) is interpreted
                                     as complex
globals    default=None              dict of global variables
locals     default=None              dict of local variables

Definition at line 597 of file svgfig.py.

def svgfig.unumber (   x)
Converts numbers to a Unicode string, taking advantage of special
Unicode characters to make nice minus signs and scientific notation.

Definition at line 2283 of file svgfig.py.

def svgfig.window (   xmin,
  xmax,
  ymin,
  ymax,
  x = 0,
  y = 0,
  width = 100,
  height = 100,
  xlogbase = None,
  ylogbase = None,
  minusInfinity = -1000,
  flipx = False,
  flipy = True 
)
Creates and returns a coordinate transformation (a function that
accepts two arguments and returns two values) that transforms from
    (xmin, ymin), (xmax, ymax)
to
    (x, y), (x + width, y + height).

xlogbase, ylogbase    default=None, None     if a number, transform
                                             logarithmically with given base
minusInfinity         default=-1000          what to return if
                                             log(0 or negative) is attempted
flipx                 default=False          if true, reverse the direction of x
flipy                 default=True           if true, reverse the direction of y

(When composing windows, be sure to set flipy=False.)

Definition at line 642 of file svgfig.py.

Referenced by LocalCacheFile.cache(), TBLayer.groupedCompatibleDetsV(), l1t::EndCapParamsHelper.SetSt1PhiMatchWindow(), l1t::EndCapParamsHelper.SetSt2PhiMatchWindow(), l1t::EndCapParamsHelper.SetSt3PhiMatchWindow(), and l1t::EndCapParamsHelper.SetSt4PhiMatchWindow().

Variable Documentation

dictionary svgfig._canvas_defaults
Initial value:
1 = {"width": "400px", "height": "400px", "viewBox": "0 0 100 100", \
2  "xmlns": "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "version":"1.1", \
3  "style": {"stroke":"black", "fill":"none", "stroke-width":"0.5pt", "stroke-linejoin":"round", "text-anchor":"middle"}, \
4  "font-family": ["Helvetica", "Arial", "FreeSans", "Sans", "sans", "sans-serif"], \
5  }

Definition at line 475 of file svgfig.py.

tuple svgfig._circular_dot = make_symbol("circular_dot")

Definition at line 1905 of file svgfig.py.

tuple svgfig._default_directory
Initial value:
1 = _winreg.QueryValueEx(_winreg.OpenKey(_winreg.HKEY_CURRENT_USER, \
2  r"Software\Microsoft\Windows\Current Version\Explorer\Shell Folders"), "Desktop")

Definition at line 26 of file svgfig.py.

string svgfig._default_fileName = "tmp.svg"

Definition at line 34 of file svgfig.py.

int svgfig._epsilon = 1

Definition at line 20 of file svgfig.py.

dictionary svgfig._hacks = {}

Definition at line 36 of file svgfig.py.

dictionary svgfig._marker_templates
Initial value:
1 = {"arrow_start": SVG("marker", SVG("path", d="M 9 3.6 L 10.5 0 L 0 3.6 L 10.5 7.2 L 9 3.6 Z"), viewBox="0 0 10.5 7.2", refX="9", refY="3.6", markerWidth="10.5", markerHeight="7.2", markerUnits="strokeWidth", orient="auto", stroke="none", fill="black"), \
2  "arrow_end": SVG("marker", SVG("path", d="M 1.5 3.6 L 0 0 L 10.5 3.6 L 0 7.2 L 1.5 3.6 Z"), viewBox="0 0 10.5 7.2", refX="1.5", refY="3.6", markerWidth="10.5", markerHeight="7.2", markerUnits="strokeWidth", orient="auto", stroke="none", fill="black"), \
3  }

Definition at line 1960 of file svgfig.py.

dictionary svgfig._symbol_templates
Initial value:
1 = {"dot": SVG("symbol", SVG("circle", cx=0, cy=0, r=1, stroke="none", fill="black"), viewBox="0 0 1 1", overflow="visible"), \
2  "box": SVG("symbol", SVG("rect", x1=-1, y1=-1, x2=1, y2=1, stroke="none", fill="black"), viewBox="0 0 1 1", overflow="visible"), \
3  "uptri": SVG("symbol", SVG("path", d="M -1 0.866 L 1 0.866 L 0 -0.866 Z", stroke="none", fill="black"), viewBox="0 0 1 1", overflow="visible"), \
4  "downtri": SVG("symbol", SVG("path", d="M -1 -0.866 L 1 -0.866 L 0 0.866 Z", stroke="none", fill="black"), viewBox="0 0 1 1", overflow="visible"), \
5  }

Definition at line 1887 of file svgfig.py.

svgfig.all_whitespace

Definition at line 560 of file svgfig.py.

svgfig.output

Definition at line 559 of file svgfig.py.

svgfig.stack

Definition at line 558 of file svgfig.py.