CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
svgfig.LineAxis Class Reference
Inheritance diagram for svgfig.LineAxis:
svgfig.Line svgfig.Ticks svgfig.Curve svgfig.XAxis svgfig.YAxis

Public Member Functions

def __init__ (self, x1, y1, x2, y2, start=0., end=1., ticks=-10, miniticks=True, labels=True, logbase=None, arrow_start=None, arrow_end=None, exclude=None, text_attr={}, **attr)
 
def __repr__ (self)
 
def interpret (self)
 
def SVG (self, trans=None)
 
- Public Member Functions inherited from svgfig.Line
def __init__ (self, x1, y1, x2, y2, arrow_start=None, arrow_end=None, **attr)
 
def Path (self, trans=None, local=False)
 
- Public Member Functions inherited from svgfig.Curve
def __init__ (self, f, low, high, loop=False, **attr)
 
def sample (self, trans=None)
 end nested class More...
 
def subsample (self, left, right, depth, trans=None)
 
- Public Member Functions inherited from svgfig.Ticks
def __init__ (self, f, low, high, ticks=-10, miniticks=True, labels=True, logbase=None, arrow_start=None, arrow_end=None, text_attr={}, **attr)
 
def compute_logminiticks (self, base)
 
def compute_logticks (self, base, N, format)
 
def compute_miniticks (self, original_ticks)
 
def compute_ticks (self, N, format)
 
def orient_tickmark (self, t, trans=None)
 
def regular_miniticks (self, N)
 

Public Attributes

 end
 
 exclude
 
 f
 
 high
 
 low
 
 start
 
- Public Attributes inherited from svgfig.Line
 arrow_end
 
 attr
 
 f
 
 high
 
 loop
 
 low
 
 y2
 
- Public Attributes inherited from svgfig.Curve
 attr
 
 f
 
 high
 
 last_samples
 
 loop
 
 low
 
- Public Attributes inherited from svgfig.Ticks
 arrow_end
 
 arrow_start
 
 attr
 
 f
 
 high
 
 labels
 
 last_miniticks
 
 logbase
 
 low
 
 miniticks
 
 text_attr
 
 ticks
 

Static Public Attributes

dictionary defaults = {"stroke-width":"0.25pt"}
 
dictionary text_defaults = {"stroke":"none", "fill":"black", "font-size":5}
 
- Static Public Attributes inherited from svgfig.Line
dictionary defaults = {}
 
- Static Public Attributes inherited from svgfig.Curve
dictionary defaults = {}
 
int discontinuity_limit = 5.
 
float linearity_limit = 0.05
 
bool random_sampling = True
 
int recursion_limit = 15
 
- Static Public Attributes inherited from svgfig.Ticks
dictionary defaults = {"stroke-width":"0.25pt"}
 
float minitick_end = 0.75
 
float minitick_start = -0.75
 
int text_angle = 0.
 
dictionary text_defaults = {"stroke":"none", "fill":"black", "font-size":5}
 
float text_start = 2.5
 
float tick_end = 1.5
 
float tick_start = -1.5
 

Detailed Description

Draws an axis with tick marks along a line.

LineAxis(x1, y1, x2, y2, start, end, ticks, miniticks, labels, logbase,
arrow_start, arrow_end, text_attr, attribute=value)

x1, y1                  required        starting point
x2, y2                  required        ending point
start, end              default=0, 1    values to start and end labeling
ticks                   default=-10     request ticks according to the standard
                                        tick specification (see help(Ticks))
miniticks               default=True    request miniticks according to the
                                        standard minitick specification
labels                  True            request tick labels according to the
                                        standard tick label specification
logbase                 default=None    if a number, the x axis is logarithmic
                                        with ticks at the given base (usually 10)
arrow_start             default=None    if a new string identifier, draw an arrow
                                        at the low-end of the axis, referenced by
                                        that identifier; if an SVG marker object,
                                        use that marker
arrow_end               default=None    if a new string identifier, draw an arrow
                                        at the high-end of the axis, referenced by
                                        that identifier; if an SVG marker object,
                                        use that marker
text_attr               default={}      SVG attributes for the text labels
attribute=value pairs   keyword list    SVG attributes

Definition at line 2852 of file svgfig.py.

Constructor & Destructor Documentation

◆ __init__()

def svgfig.LineAxis.__init__ (   self,
  x1,
  y1,
  x2,
  y2,
  start = 0.,
  end = 1.,
  ticks = -10,
  miniticks = True,
  labels = True,
  logbase = None,
  arrow_start = None,
  arrow_end = None,
  exclude = None,
  text_attr = {},
**  attr 
)

Definition at line 2886 of file svgfig.py.

2886  def __init__(self, x1, y1, x2, y2, start=0., end=1., ticks=-10, miniticks=True, labels=True, logbase=None, arrow_start=None, arrow_end=None, exclude=None, text_attr={}, **attr):
2887  self.start = start
2888  self.end = end
2889  self.exclude = exclude
2890  tattr = dict(self.text_defaults)
2891  tattr.update(text_attr)
2892  Line.__init__(self, x1, y1, x2, y2, **attr)
2893  Ticks.__init__(self, None, None, None, ticks, miniticks, labels, logbase, arrow_start, arrow_end, tattr, **attr)
2894 

Member Function Documentation

◆ __repr__()

def svgfig.LineAxis.__repr__ (   self)

◆ interpret()

def svgfig.LineAxis.interpret (   self)
Evaluate and return optimal ticks and miniticks according to
the standard minitick specification.

Normally only used internally.

Reimplemented from svgfig.Ticks.

Definition at line 2895 of file svgfig.py.

2895  def interpret(self):
2896  if self.exclude != None and not (isinstance(self.exclude, (tuple, list)) and len(self.exclude) == 2 and \
2897  isinstance(self.exclude[0], (int, long, float)) and isinstance(self.exclude[1], (int, long, float))):
2898  raise TypeError("exclude must either be None or (low, high)")
2899 
2900  ticks, miniticks = Ticks.interpret(self)
2901  if self.exclude == None: return ticks, miniticks
2902 
2903  ticks2 = {}
2904  for loc, label in ticks.items():
2905  if self.exclude[0] <= loc <= self.exclude[1]:
2906  ticks2[loc] = ""
2907  else:
2908  ticks2[loc] = label
2909 
2910  return ticks2, miniticks
2911 

References svgfig.LineAxis.exclude.

◆ SVG()

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

Reimplemented from svgfig.Line.

Reimplemented in svgfig.YAxis, and svgfig.XAxis.

Definition at line 2912 of file svgfig.py.

2912  def SVG(self, trans=None):
2913  """Apply the transformation "trans" and return an SVG object."""
2914  line = Line.SVG(self, trans) # must be evaluated first, to set self.f, self.low, self.high
2915 
2916  f01 = self.f
2917  self.f = lambda t: f01(1. * (t - self.start) / (self.end - self.start))
2918  self.low = self.start
2919  self.high = self.end
2920 
2921  if self.arrow_start != False and self.arrow_start != None:
2922  if isinstance(self.arrow_start, str):
2923  line.attr["marker-start"] = "url(#%s)" % self.arrow_start
2924  else:
2925  line.attr["marker-start"] = "url(#%s)" % self.arrow_start.id
2926 
2927  if self.arrow_end != False and self.arrow_end != None:
2928  if isinstance(self.arrow_end, str):
2929  line.attr["marker-end"] = "url(#%s)" % self.arrow_end
2930  else:
2931  line.attr["marker-end"] = "url(#%s)" % self.arrow_end.id
2932 
2933  ticks = Ticks.SVG(self, trans) # returns a <g />
2934  ticks.append(line)
2935  return ticks

References hippyaddtobaddatafiles.KeepWhileOpenFile.f, and svgfig.Curve.f.

Member Data Documentation

◆ defaults

dictionary svgfig.LineAxis.defaults = {"stroke-width":"0.25pt"}
static

Definition at line 2880 of file svgfig.py.

Referenced by tree.Tree.reset(), and tree.Tree.var().

◆ end

svgfig.LineAxis.end

◆ exclude

svgfig.LineAxis.exclude

Definition at line 2889 of file svgfig.py.

Referenced by svgfig.LineAxis.interpret().

◆ f

svgfig.LineAxis.f

◆ high

svgfig.LineAxis.high

Definition at line 2919 of file svgfig.py.

◆ low

svgfig.LineAxis.low

Definition at line 2918 of file svgfig.py.

◆ start

svgfig.LineAxis.start

◆ text_defaults

dictionary svgfig.LineAxis.text_defaults = {"stroke":"none", "fill":"black", "font-size":5}
static

Definition at line 2881 of file svgfig.py.

str
#define str(s)
Definition: TestProcessor.cc:53