CMS 3D CMS Logo

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.

00047                          :
00048   for name in attr.keys():
00049     name_colon = re.sub("__", ":", name)
00050     if name_colon != name:
00051       attr[name_colon] = attr[name]
00052       del attr[name]
00053       name = name_colon
00054 
00055     name_dash = re.sub("_", "-", name)
00056     if name_dash != name:
00057       attr[name_dash] = attr[name]
00058       del attr[name]
00059       name = name_dash
00060 
00061   return attr

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           "https://www.w3.org/2000/svg"
xmlns:xlink     "https://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 ME_MAP::create_gif(), SiStripHistoPlotter::createStaticPlot(), TrackingMaterialPlotter::draw(), cond::draw(), HcalObjRepresent::ADataRepr::draw(), DTOccupancyClusterBuilder::drawClusters(), ErrorsPropagationAnalyzer::drawHistograms(), ErrorsAnalyzer::drawHistograms(), TauDQMHistPlotter::endRun(), EcalDisplaysByEvent::init2DEcalCanvas(), main(), SiStripHistoPlotter::makeCondDBPlots(), TagProbeFitter::makeEfficiencyPlot1D(), TagProbeFitter::makeEfficiencyPlot2D(), SiPixelHistoPlotter::makePlot(), SiStripHistoPlotter::makePlot(), MuScleFitUtils::minimizeLikelihood(), cond::PayLoadInspector< DataT >::plot(), root::plotTF1(), SoftLeptonTagPlotter::psPlot(), JetTagPlotter::psPlot(), TrackCountingTagPlotter::psPlot(), TrackIPTagPlotter::psPlot(), TrackProbabilityTagPlotter::psPlot(), TagProbeFitter::saveDistributionsPlot(), TagProbeFitter::saveFitPlot(), MaterialAccountingGroup::savePlot(), tfwliteselectortest::ThingsTSelector::terminate(), tselname::terminate(), examples::TrackAnalysisAlgorithm::terminate(), tfwliteselectortest::ThingsTSelector2::terminate(), cond::PayLoadInspector< DataT >::trend_plot(), HFunctionResolution::Write(), HCovarianceVSxy::Write(), TestCorrection::~TestCorrection(), and TestResolution::~TestResolution().

00482                         :
00483   """Creates a top-level SVG object, allowing the user to control the
00484   image size and aspect ratio.
00485 
00486   canvas(sub, sub, sub..., attribute=value)
00487 
00488   sub                     optional list       nested SVG elements or text/Unicode
00489   attribute=value pairs   optional keywords   SVG attributes
00490 
00491   Default attribute values:
00492 
00493   width           "400px"
00494   height          "400px"
00495   viewBox         "0 0 100 100"
00496   xmlns           "https://www.w3.org/2000/svg"
00497   xmlns:xlink     "https://www.w3.org/1999/xlink"
00498   version         "1.1"
00499   style           "stroke:black; fill:none; stroke-width:0.5pt; stroke-linejoin:round; text-anchor:middle"
00500   font-family     "Helvetica,Arial,FreeSans?,Sans,sans,sans-serif"
00501   """
00502   attributes = dict(_canvas_defaults)
00503   attributes.update(attr)
00504 
00505   if sub == None or sub == ():
00506     return SVG("svg", **attributes)
00507   else:
00508     return SVG("svg", *sub, **attributes)

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.

00510                                 :
00511   """Same as canvas(), but draws an outline around the drawable area,
00512   so that you know how close your image is to the edges."""
00513   svg = canvas(*sub, **attr)
00514   match = re.match("[, \t]*([0-9e.+\-]+)[, \t]+([0-9e.+\-]+)[, \t]+([0-9e.+\-]+)[, \t]+([0-9e.+\-]+)[, \t]*", svg["viewBox"])
00515   if match == None: raise ValueError, "canvas viewBox is incorrectly formatted"
00516   x, y, width, height = [float(x) for x in match.groups()]
00517   svg.prepend(SVG("rect", x=x, y=y, width=width, height=height, stroke="none", fill="cornsilk"))
00518   svg.append(SVG("rect", x=x, y=y, width=width, height=height, stroke="black", fill="none"))
00519   return svg

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.

01452                                                       :
01453   """Converts a complex "z(t)" string to a function acceptable for Curve.
01454 
01455   expr    required        string in the form "z(t)"
01456   var     default="t"   name of the independent variable
01457   globals default=None    dict of global variables used in the expression;
01458                           you may want to use Python's builtin globals()
01459   locals  default=None    dict of local variables
01460   """
01461   g = cmath.__dict__
01462   if globals != None: g.update(globals)
01463   output = eval("lambda %s: (%s)" % (var, expr), g, locals)
01464   split = lambda z: (z.real, z.imag)
01465   output2 = lambda t: split(output(t))
01466   output2.func_name = "%s -> %s" % (var, expr)
01467   return output2

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.

01484                                                       :
01485   """Converts a "f(x)" string to a function acceptable for Curve.
01486 
01487   expr    required        string in the form "f(x)"
01488   var     default="x"   name of the independent variable
01489   globals default=None    dict of global variables used in the expression;
01490                           you may want to use Python's builtin globals()
01491   locals  default=None    dict of local variables
01492   """
01493   g = math.__dict__
01494   if globals != None: g.update(globals)
01495   output = eval("lambda %s: (%s, %s)" % (var, var, expr), g, locals)
01496   output.func_name = "%s -> %s" % (var, expr)
01497   return output

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.

01469                                                        :
01470   """Converts a "f(t), g(t)" string to a function acceptable for Curve.
01471 
01472   expr    required        string in the form "f(t), g(t)"
01473   var     default="t"   name of the independent variable
01474   globals default=None    dict of global variables used in the expression;
01475                           you may want to use Python's builtin globals()
01476   locals  default=None    dict of local variables
01477   """
01478   g = math.__dict__
01479   if globals != None: g.update(globals)
01480   output = eval("lambda %s: (%s)" % (var, expr), g, locals)
01481   output.func_name = "%s -> %s" % (var, expr)
01482   return output

def svgfig::load (   fileName)
Loads an SVG image from a file.

Definition at line 546 of file svgfig.py.

Referenced by edm::RootAutoLibraryLoader::GetClass(), ThePEGInterface::initRepository(), and L1MuDTExtrapolationUnit::run().

00547                   :
00548   """Loads an SVG image from a file."""
00549   return load_stream(file(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.

00551                        :
00552   """Loads an SVG image from a stream (can be a string or a file object)."""
00553 
00554   from xml.sax import handler, make_parser
00555   from xml.sax.handler import feature_namespaces, feature_external_ges, feature_external_pes
00556 
00557   class ContentHandler(handler.ContentHandler):
00558     def __init__(self):
00559       self.stack = []
00560       self.output = None
00561       self.all_whitespace = re.compile("^\s*$")
00562 
00563     def startElement(self, name, attr):
00564       s = SVG(name)
00565       s.attr = dict(attr.items())
00566       if len(self.stack) > 0:
00567         last = self.stack[-1]
00568         last.sub.append(s)
00569       self.stack.append(s)
00570 
00571     def characters(self, ch):
00572       if not isinstance(ch, basestring) or self.all_whitespace.match(ch) == None:
00573         if len(self.stack) > 0:
00574           last = self.stack[-1]
00575           if len(last.sub) > 0 and isinstance(last.sub[-1], basestring):
00576             last.sub[-1] = last.sub[-1] + "\n" + ch
00577           else:
00578             last.sub.append(ch)
00579 
00580     def endElement(self, name):
00581       if len(self.stack) > 0:
00582         last = self.stack[-1]
00583         if isinstance(last, SVG) and last.t == "style" and "type" in last.attr and last.attr["type"] == "text/css" and len(last.sub) == 1 and isinstance(last.sub[0], basestring):
00584           last.sub[0] = "<![CDATA[\n" + last.sub[0] + "]]>"
00585 
00586       self.output = self.stack.pop()
00587 
00588   ch = ContentHandler()
00589   parser = make_parser()
00590   parser.setContentHandler(ch)
00591   parser.setFeature(feature_namespaces, 0)
00592   parser.setFeature(feature_external_ges, 0)
00593   parser.parse(stream)
00594   return ch.output

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.

01965                                   :
01966   """Creates a new instance of an SVG marker to avoid cross-linking objects.
01967 
01968   id                     required         a new identifier (string/Unicode)
01969   shape                  required         the shape name from _marker_templates
01970   attribute=value list   keyword list     modify the SVG attributes of the new marker
01971   """
01972   output = copy.deepcopy(_marker_templates[shape])
01973   for i in output.sub: i.attr.update(attr_preprocess(attr))
01974   output["id"] = id
01975   return output

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.

01894                                         :
01895   """Creates a new instance of an SVG symbol to avoid cross-linking objects.
01896 
01897   id                    required         a new identifier (string/Unicode)
01898   shape                 default="dot"  the shape name from _symbol_templates
01899   attribute=value list  keyword list     modify the SVG attributes of the new symbol
01900   """
01901   output = copy.deepcopy(_symbol_templates[shape])
01902   for i in output.sub: i.attr.update(attr_preprocess(attr))
01903   output["id"] = id
01904   return output

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

Definition at line 1006 of file svgfig.py.

01007                    :
01008   """Converts SVG("path", d="...") into Path(d=[...])."""
01009   if not isinstance(svg, SVG) or svg.t != "path":
01010     raise TypeError, "Only SVG <path /> objects can be converted into Paths"
01011   attr = dict(svg.attr)
01012   d = attr["d"]
01013   del attr["d"]
01014   for key in attr.keys():
01015     if not isinstance(key, str):
01016       value = attr[key]
01017       del attr[key]
01018       attr[str(key)] = value
01019   return Path(d, **attr)

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.

Referenced by cert_plot().

00040                             :
00041   """Create an SVG color string "#xxyyzz" from r, g, and b.
00042 
00043   r,g,b = 0 is black and r,g,b = maximum is white.
00044   """
00045   return "#%02x%02x%02x" % (max(0, min(r*255./maximum, 255)), max(0, min(g*255./maximum, 255)), max(0, min(b*255./maximum, 255)))

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(), and DetPositioner::rotateGeomDet().

00705                              :
00706   """Creates and returns a coordinate transformation which rotates
00707   around (cx,cy) by "angle" degrees."""
00708   angle *= math.pi/180.
00709   return lambda x, y: (cx + math.cos(angle)*(x - cx) - math.sin(angle)*(y - cy), cy + math.sin(angle)*(x - cx) + math.cos(angle)*(y - cy))

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_count(), dd_error_scan(), GenericMVAComputer::eval(), findNameSpaces(), edm::refitem::GetPtrImpl< C, T, F, KEY >::getPtr_(), edm::WorkerMaker< T >::implSwapModule(), edm::WorkerMaker< T >::makeWorker(), edm::RefProd< C >::operator*(), edm::RefProd< C >::operator->(), edm::Ref< C, T, F >::product(), edm::Ref< REF_FOR_VECTOR_ARGS >::product(), edm::RefVector< C, T, F >::product(), and TrackerStablePhiSort().

00521                                                   :
00522   """Loads an SVG image from a file, replacing instances of
00523   <REPLACEME /> with a given svg object.
00524 
00525   fileName         required                name of the template SVG
00526   svg              required                SVG object for replacement
00527   replaceme        default="REPLACEME"   fake SVG element to be replaced by the given object
00528 
00529   >>> print load("template.svg")
00530   None                 <svg (2 sub) style=u'stroke:black; fill:none; stroke-width:0.5pt; stroke-linejoi
00531   [0]                      <rect height=u'100' width=u'100' stroke=u'none' y=u'0' x=u'0' fill=u'yellow'
00532   [1]                      <REPLACEME />
00533   >>> 
00534   >>> print template("template.svg", SVG("circle", cx=50, cy=50, r=30))
00535   None                 <svg (2 sub) style=u'stroke:black; fill:none; stroke-width:0.5pt; stroke-linejoi
00536   [0]                      <rect height=u'100' width=u'100' stroke=u'none' y=u'0' x=u'0' fill=u'yellow'
00537   [1]                      <circle cy=50 cx=50 r=30 />
00538   """
00539   output = load(fileName)
00540   for ti, s in output:
00541     if isinstance(s, SVG) and s.t == replaceme:
00542       output[ti] = svg
00543   return output

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.

00598                                                              :
00599   """Converts to a coordinate transformation (a function that accepts
00600   two arguments and returns two values).
00601 
00602   expr       required                  a string expression or a function
00603                                        of two real or one complex value
00604   vars       default=("x", "y")    independent variable names;
00605                                        a singleton ("z",) is interpreted
00606                                        as complex
00607   globals    default=None              dict of global variables
00608   locals     default=None              dict of local variables
00609   """
00610 
00611   if callable(expr):
00612     if expr.func_code.co_argcount == 2:
00613       return expr
00614 
00615     elif expr.func_code.co_argcount == 1:
00616       split = lambda z: (z.real, z.imag)
00617       output = lambda x, y: split(expr(x + y*1j))
00618       output.func_name = expr.func_name
00619       return output
00620 
00621     else:
00622       raise TypeError, "must be a function of 2 or 1 variables"
00623 
00624   if len(vars) == 2:
00625     g = math.__dict__
00626     if globals != None: g.update(globals)
00627     output = eval("lambda %s, %s: (%s)" % (vars[0], vars[1], expr), g, locals)
00628     output.func_name = "%s,%s -> %s" % (vars[0], vars[1], expr)
00629     return output
00630 
00631   elif len(vars) == 1:
00632     g = cmath.__dict__
00633     if globals != None: g.update(globals)
00634     output = eval("lambda %s: (%s)" % (vars[0], expr), g, locals)
00635     split = lambda z: (z.real, z.imag)
00636     output2 = lambda x, y: split(output(x + y*1j))
00637     output2.func_name = "%s -> %s" % (vars[0], expr)
00638     return output2
00639 
00640   else:
00641     raise TypeError, "vars must have 2 or 1 elements"

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.

02284               :
02285   """Converts numbers to a Unicode string, taking advantage of special
02286   Unicode characters to make nice minus signs and scientific notation.
02287   """
02288   output = u"%g" % x
02289 
02290   if output[0] == u"-":
02291     output = u"\u2013" + output[1:]
02292 
02293   index = output.find(u"e")
02294   if index != -1:
02295     uniout = unicode(output[:index]) + u"\u00d710"
02296     saw_nonzero = False
02297     for n in output[index+1:]:
02298       if n == u"+": pass # uniout += u"\u207a"
02299       elif n == u"-": uniout += u"\u207b"
02300       elif n == u"0":
02301         if saw_nonzero: uniout += u"\u2070"
02302       elif n == u"1":
02303         saw_nonzero = True
02304         uniout += u"\u00b9"
02305       elif n == u"2":
02306         saw_nonzero = True
02307         uniout += u"\u00b2"
02308       elif n == u"3":
02309         saw_nonzero = True
02310         uniout += u"\u00b3"
02311       elif u"4" <= n <= u"9":
02312         saw_nonzero = True
02313         if saw_nonzero: uniout += eval("u\"\\u%x\"" % (0x2070 + ord(n) - ord(u"0")))
02314       else: uniout += n
02315 
02316     if uniout[:2] == u"1\u00d7": uniout = uniout[2:]
02317     return uniout
02318 
02319   return output

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(), CSCStripElectronicsSim::channelsToRead(), TIBLayer::groupedCompatibleDetsV(), PixelForwardLayer::groupedCompatibleDetsV(), TOBRod::groupedCompatibleDetsV(), TOBLayer::groupedCompatibleDetsV(), PixelBlade::groupedCompatibleDetsV(), CompositeTECPetal::groupedCompatibleDetsV(), GeometricSearchDet::groupedCompatibleDetsV(), CompositeTECWedge::groupedCompatibleDetsV(), PixelBarrelLayer::groupedCompatibleDetsV(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::MuonSystemMapPlot1D(), MuonResidualsFitter::plotsimple(), MuonResidualsFitter::plotweighted(), and ecaldqm::EnergyTask::runOnRecHits().

00643                                                                                                                                                :
00644   """Creates and returns a coordinate transformation (a function that
00645   accepts two arguments and returns two values) that transforms from
00646       (xmin, ymin), (xmax, ymax)
00647   to
00648       (x, y), (x + width, y + height).
00649 
00650   xlogbase, ylogbase    default=None, None     if a number, transform
00651                                                logarithmically with given base
00652   minusInfinity         default=-1000          what to return if
00653                                                log(0 or negative) is attempted
00654   flipx                 default=False          if true, reverse the direction of x
00655   flipy                 default=True           if true, reverse the direction of y
00656 
00657   (When composing windows, be sure to set flipy=False.)
00658   """
00659 
00660   if flipx:
00661     ox1 = x + width
00662     ox2 = x
00663   else:
00664     ox1 = x
00665     ox2 = x + width
00666   if flipy:
00667     oy1 = y + height
00668     oy2 = y
00669   else:
00670     oy1 = y
00671     oy2 = y + height
00672   ix1 = xmin
00673   iy1 = ymin
00674   ix2 = xmax
00675   iy2 = ymax
00676   
00677   if xlogbase != None and (ix1 <= 0. or ix2 <= 0.): raise ValueError, "x range incompatible with log scaling: (%g, %g)" % (ix1, ix2)
00678 
00679   if ylogbase != None and (iy1 <= 0. or iy2 <= 0.): raise ValueError, "y range incompatible with log scaling: (%g, %g)" % (iy1, iy2)
00680 
00681   def maybelog(t, it1, it2, ot1, ot2, logbase):
00682     if t <= 0.: return minusInfinity
00683     else:
00684       return ot1 + 1.*(math.log(t, logbase) - math.log(it1, logbase))/(math.log(it2, logbase) - math.log(it1, logbase)) * (ot2 - ot1)
00685 
00686   xlogstr, ylogstr = "", ""
00687 
00688   if xlogbase == None:
00689     xfunc = lambda x: ox1 + 1.*(x - ix1)/(ix2 - ix1) * (ox2 - ox1)
00690   else:
00691     xfunc = lambda x: maybelog(x, ix1, ix2, ox1, ox2, xlogbase)
00692     xlogstr = " xlog=%g" % xlogbase
00693 
00694   if ylogbase == None:
00695     yfunc = lambda y: oy1 + 1.*(y - iy1)/(iy2 - iy1) * (oy2 - oy1)
00696   else:
00697     yfunc = lambda y: maybelog(y, iy1, iy2, oy1, oy2, ylogbase)
00698     ylogstr = " ylog=%g" % ylogbase
00699 
00700   output = lambda x, y: (xfunc(x), yfunc(y))
00701 
00702   output.func_name = "(%g, %g), (%g, %g) -> (%g, %g), (%g, %g)%s%s" % (ix1, ix2, iy1, iy2, ox1, ox2, oy1, oy2, xlogstr, ylogstr)
00703   return output


Variable Documentation

Initial value:
00001 {"width": "400px", "height": "400px", "viewBox": "0 0 100 100", \
00002                    "xmlns": "https://www.w3.org/2000/svg", "xmlns:xlink": "https://www.w3.org/1999/xlink", "version":"1.1", \
00003                    "style": {"stroke":"black", "fill":"none", "stroke-width":"0.5pt", "stroke-linejoin":"round", "text-anchor":"middle"}, \
00004                    "font-family": ["Helvetica", "Arial", "FreeSans", "Sans", "sans", "sans-serif"], \
00005                    }

Definition at line 475 of file svgfig.py.

tuple svgfig::_circular_dot = make_symbol("circular_dot")

Definition at line 1905 of file svgfig.py.

Initial value:
00001 _winreg.QueryValueEx(_winreg.OpenKey(_winreg.HKEY_CURRENT_USER, \
00002                        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.

Definition at line 20 of file svgfig.py.

dictionary svgfig::_hacks = {}

Definition at line 36 of file svgfig.py.

Initial value:
00001 {"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"), \
00002                     "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"), \
00003                     }

Definition at line 1960 of file svgfig.py.

Initial value:
00001 {"dot": SVG("symbol", SVG("circle", cx=0, cy=0, r=1, stroke="none", fill="black"), viewBox="0 0 1 1", overflow="visible"), \
00002                     "box": SVG("symbol", SVG("rect", x1=-1, y1=-1, x2=1, y2=1, stroke="none", fill="black"), viewBox="0 0 1 1", overflow="visible"), \
00003                     "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"), \
00004                     "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"), \
00005                     }

Definition at line 1887 of file svgfig.py.

Definition at line 550 of file svgfig.py.

Definition at line 550 of file svgfig.py.