Package qubx :: Module plot
[hide private]
[frames] | no frames]

Module plot

source code

Cairo-based right-handed 2D graphics with rulers.

Copyright 2007-2010 Research Foundation State University of New York This file is part of QUB Express.

QUB Express is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QUB Express is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License, named LICENSE.txt, in the QUB Express program directory. If not, see <http://www.gnu.org/licenses/>.


Version: 1.3.0

Classes [hide private]
  RulerPlot
Base class for math-style 2D plots.
  ScrollPlot
A specialization of RulerPlot for data that arrives point-by-point, scrolling in the positive x direction.
  SampledScrollPlot
A specialization of RulerPlot for evenly sampled data that arrives one or more point at a time, scrolling in the positive x direction.
  StaticPlot
Specialization of RulerPlot for (x,y) data given all-at-once.
Functions [hide private]
 
SetupMajorMinor(distance)
Returns (major, minor) ticks for total axis distance, according to the following:
source code
 
PlotDotsPairs(context, xPix, yPix, data, thick=1.0)
Plots (x,y) in data on a cairo context as rectangles with "radius" of thick px.
source code
 
PlotDots(context, xPix, yPix, xx, yy, thick=1.0)
Plots (xx[i], yy[i]) on a cairo context as rectangles with "radius" of thick px.
source code
 
PlotLinesPairs(context, xPix, yPix, data, thick=1.0)
Plots (x,y) in data on a cairo context as a line series with line_width of thick px.
source code
 
PlotLines(context, xPix, yPix, xx, yy, thick=1.0)
Plots (xx[i],yy[i]) on a cairo context as a line series with line_width of thick px.
source code
 
PlotLinesBounded(context, xPix, yPix, xx, yy, ymin, ymax, thick=1.0)
Plots (xx[i],yy[i]) on a cairo context as a line series with line_width of thick px.
source code
 
PlotHist(context, xPix, yPix, xx, yy, thick=1.0, hist_width=0.8)
Plots (xx[i], yy[i]) on a cairo context as histogram bins with line_width of thick px.
source code
 
PlotMany(context, xPix, yPix, xx, yy, dataColor=(1, 1, 1), with_std=True) source code
 
ScaleUnit(value, sUnit='')
Returns a scaled value of "val" as function return with a single character unit scaler from the metric scale set as a tuple of the form (Scaled Value, Scaler Char+sUnit)
source code
 
EnsureRange(value, vLow, vHigh)
Returns value moved within (vLow, vHigh).
source code
Variables [hide private]
  have_numpy = True
  INVALID_NONE = 0
  INVALID_PLOT = 1
  INVALID_XRULE = 2
  INVALID_YRULE = 4
  INVALID_XUSER = 8
  INVALID_YUSER = 16
  INVALID_ALL = 255
  HIST_WIDTH = 0.8
  ALLOW_THREADS = 1
  BUFSIZE = 10000
  CLIP = 0
  ERR_CALL = 3
  ERR_DEFAULT = 0
  ERR_DEFAULT2 = 2084
  ERR_IGNORE = 0
  ERR_LOG = 5
  ERR_PRINT = 4
  ERR_RAISE = 2
  ERR_WARN = 1
  FLOATING_POINT_SUPPORT = 1
  FPE_DIVIDEBYZERO = 1
  FPE_INVALID = 8
  FPE_OVERFLOW = 2
  FPE_UNDERFLOW = 4
  False_ = False
  Inf = inf
  Infinity = inf
  MAXDIMS = 32
  NAN = nan
  NINF = -inf
  NZERO = -0.0
  NaN = nan
  PINF = inf
  PZERO = 0.0
  RAISE = 2
  SHIFT_DIVIDEBYZERO = 0
  SHIFT_INVALID = 9
  SHIFT_OVERFLOW = 3
  SHIFT_UNDERFLOW = 6
  ScalarType = (<type 'int'>, <type 'float'>, <type 'complex'>, ...
  True_ = True
  UFUNC_BUFSIZE_DEFAULT = 10000
  UFUNC_PYVALS_NAME = 'UFUNC_PYVALS'
  WRAP = 1
  __package__ = 'qubx'
  absolute = <ufunc 'absolute'>
  add = <ufunc 'add'>
  arccos = <ufunc 'arccos'>
  arccosh = <ufunc 'arccosh'>
  arcsin = <ufunc 'arcsin'>
  arcsinh = <ufunc 'arcsinh'>
  arctan = <ufunc 'arctan'>
  arctan2 = <ufunc 'arctan2'>
  arctanh = <ufunc 'arctanh'>
  bitwise_and = <ufunc 'bitwise_and'>
  bitwise_not = <ufunc 'invert'>
  bitwise_or = <ufunc 'bitwise_or'>
  bitwise_xor = <ufunc 'bitwise_xor'>
  c_ = <numpy.lib.index_tricks.CClass object at 0x93ec28c>
  cast = {<type 'numpy.int64'>: <function <lambda> at 0x94219cc>...
  ceil = <ufunc 'ceil'>
  conj = <ufunc 'conjugate'>
  conjugate = <ufunc 'conjugate'>
  cos = <ufunc 'cos'>
  cosh = <ufunc 'cosh'>
  deg2rad = <ufunc 'deg2rad'>
  degrees = <ufunc 'degrees'>
  divide = <ufunc 'divide'>
  e = 2.71828182846
  equal = <ufunc 'equal'>
  exp = <ufunc 'exp'>
  exp2 = <ufunc 'exp2'>
  expm1 = <ufunc 'expm1'>
  fabs = <ufunc 'fabs'>
  floor = <ufunc 'floor'>
  floor_divide = <ufunc 'floor_divide'>
  fmax = <ufunc 'fmax'>
  fmin = <ufunc 'fmin'>
  fmod = <ufunc 'fmod'>
  frexp = <ufunc 'frexp'>
  greater = <ufunc 'greater'>
  greater_equal = <ufunc 'greater_equal'>
  hypot = <ufunc 'hypot'>
  index_exp = <numpy.lib.index_tricks.IndexExpression object at ...
  inf = inf
  infty = inf
  invert = <ufunc 'invert'>
  isfinite = <ufunc 'isfinite'>
  isinf = <ufunc 'isinf'>
  isnan = <ufunc 'isnan'>
  ldexp = <ufunc 'ldexp'>
  left_shift = <ufunc 'left_shift'>
  less = <ufunc 'less'>
  less_equal = <ufunc 'less_equal'>
  little_endian = True
  log = <ufunc 'log'>
  log10 = <ufunc 'log10'>
  log1p = <ufunc 'log1p'>
  logaddexp = <ufunc 'logaddexp'>
  logaddexp2 = <ufunc 'logaddexp2'>
  logical_and = <ufunc 'logical_and'>
  logical_not = <ufunc 'logical_not'>
  logical_or = <ufunc 'logical_or'>
  logical_xor = <ufunc 'logical_xor'>
  maximum = <ufunc 'maximum'>
  mgrid = <numpy.lib.index_tricks.nd_grid object at 0x93ec16c>
  minimum = <ufunc 'minimum'>
  mod = <ufunc 'remainder'>
  modf = <ufunc 'modf'>
  multiply = <ufunc 'multiply'>
  nan = nan
  nbytes = {<type 'numpy.int64'>: 8, <type 'numpy.int16'>: 2, <t...
  negative = <ufunc 'negative'>
  newaxis = None
hash(x)
  not_equal = <ufunc 'not_equal'>
  ogrid = <numpy.lib.index_tricks.nd_grid object at 0x93ec18c>
  ones_like = <ufunc 'ones_like'>
  pi = 3.14159265359
  power = <ufunc 'power'>
  r_ = <numpy.lib.index_tricks.RClass object at 0x93ec20c>
  rad2deg = <ufunc 'rad2deg'>
  radians = <ufunc 'radians'>
  reciprocal = <ufunc 'reciprocal'>
  remainder = <ufunc 'remainder'>
  right_shift = <ufunc 'right_shift'>
  rint = <ufunc 'rint'>
  s_ = <numpy.lib.index_tricks.IndexExpression object at 0x93ec42c>
  sctypeDict = {0: <type 'numpy.bool_'>, 1: <type 'numpy.int8'>,...
  sctypeNA = {'?': 'Bool', 'B': 'UInt8', 'Bool': <type 'numpy.bo...
  sctypes = {'complex': [<type 'numpy.complex64'>, <type 'numpy....
  sign = <ufunc 'sign'>
  signbit = <ufunc 'signbit'>
  sin = <ufunc 'sin'>
  sinh = <ufunc 'sinh'>
  sqrt = <ufunc 'sqrt'>
  square = <ufunc 'square'>
  subtract = <ufunc 'subtract'>
  tan = <ufunc 'tan'>
  tanh = <ufunc 'tanh'>
  true_divide = <ufunc 'true_divide'>
  trunc = <ufunc 'trunc'>
  typeDict = {0: <type 'numpy.bool_'>, 1: <type 'numpy.int8'>, 2...
  typeNA = {'?': 'Bool', 'B': 'UInt8', 'Bool': <type 'numpy.bool...
  typecodes = {'All': '?bhilqpBHILQPfdgFDGSUVO', 'AllFloat': 'fd...
Function Details [hide private]

SetupMajorMinor(distance)

source code 

Returns (major, minor) ticks for total axis distance, according to the following:

   express distance as x.xxxxxx * 10^y
   truncate to xEy
   if x >= 5:
   major = 5Ey
      minor = 1Ey
   else:
      major = 1Ey
      minor = 2E(y-1)

PlotDotsPairs(context, xPix, yPix, data, thick=1.0)

source code 

Plots (x,y) in data on a cairo context as rectangles with "radius" of thick px.

Parameters:
  • xPix - width of a pixel
  • yPix - height of a pixel

PlotLinesBounded(context, xPix, yPix, xx, yy, ymin, ymax, thick=1.0)

source code 

Plots (xx[i],yy[i]) on a cairo context as a line series with line_width of thick px. yy[i] is brought within yBounds.


Variables Details [hide private]

ScalarType

Value:
(<type 'int'>,
 <type 'float'>,
 <type 'complex'>,
 <type 'long'>,
 <type 'bool'>,
 <type 'str'>,
 <type 'unicode'>,
 <type 'buffer'>,
...

cast

Value:
{<type 'numpy.int64'>: <function <lambda> at 0x94219cc>, <type 'numpy.\
int16'>: <function <lambda> at 0x9421a04>, <type 'numpy.object_'>: <fu\
nction <lambda> at 0x9421a3c>, <type 'numpy.uint32'>: <function <lambd\
a> at 0x9421a74>, <type 'numpy.bool_'>: <function <lambda> at 0x9421aa\
c>, <type 'numpy.float96'>: <function <lambda> at 0x9421ae4>, <type 'n\
umpy.int32'>: <function <lambda> at 0x9421b1c>, <type 'numpy.string_'>\
: <function <lambda> at 0x9421b54>, <type 'numpy.uint32'>: <function <\
lambda> at 0x9421b8c>, <type 'numpy.complex64'>: <function <lambda> at\
...

index_exp

Value:
<numpy.lib.index_tricks.IndexExpression object at 0x93ec3ec>

nbytes

Value:
{<type 'numpy.int64'>: 8, <type 'numpy.int16'>: 2, <type 'numpy.object\
_'>: 4, <type 'numpy.uint32'>: 4, <type 'numpy.bool_'>: 1, <type 'nump\
y.float96'>: 12, <type 'numpy.int32'>: 4, <type 'numpy.string_'>: 0, <\
type 'numpy.uint32'>: 4, <type 'numpy.complex64'>: 8, <type 'numpy.flo\
at32'>: 4, <type 'numpy.unicode_'>: 0, <type 'numpy.uint64'>: 8, <type\
 'numpy.int8'>: 1, <type 'numpy.complex128'>: 16, <type 'numpy.uint8'>\
: 1, <type 'numpy.void'>: 0, <type 'numpy.float64'>: 8, <type 'numpy.c\
omplex192'>: 24, <type 'numpy.uint16'>: 2, <type 'numpy.int32'>: 4}

sctypeDict

Value:
{0: <type 'numpy.bool_'>,
 1: <type 'numpy.int8'>,
 2: <type 'numpy.uint8'>,
 3: <type 'numpy.int16'>,
 4: <type 'numpy.uint16'>,
 5: <type 'numpy.int32'>,
 6: <type 'numpy.uint32'>,
 7: <type 'numpy.int32'>,
...

sctypeNA

Value:
{'?': 'Bool',
 'B': 'UInt8',
 'Bool': <type 'numpy.bool_'>,
 'Complex32': <type 'numpy.complex64'>,
 'Complex64': <type 'numpy.complex128'>,
 'Complex96': <type 'numpy.complex192'>,
 'D': 'Complex64',
 'F': 'Complex32',
...

sctypes

Value:
{'complex': [<type 'numpy.complex64'>,
             <type 'numpy.complex128'>,
             <type 'numpy.complex192'>],
 'float': [<type 'numpy.float32'>,
           <type 'numpy.float64'>,
           <type 'numpy.float96'>],
 'int': [<type 'numpy.int8'>,
         <type 'numpy.int16'>,
...

typeDict

Value:
{0: <type 'numpy.bool_'>,
 1: <type 'numpy.int8'>,
 2: <type 'numpy.uint8'>,
 3: <type 'numpy.int16'>,
 4: <type 'numpy.uint16'>,
 5: <type 'numpy.int32'>,
 6: <type 'numpy.uint32'>,
 7: <type 'numpy.int32'>,
...

typeNA

Value:
{'?': 'Bool',
 'B': 'UInt8',
 'Bool': <type 'numpy.bool_'>,
 'Complex32': <type 'numpy.complex64'>,
 'Complex64': <type 'numpy.complex128'>,
 'Complex96': <type 'numpy.complex192'>,
 'D': 'Complex64',
 'F': 'Complex32',
...

typecodes

Value:
{'All': '?bhilqpBHILQPfdgFDGSUVO',
 'AllFloat': 'fdgFDG',
 'AllInteger': 'bBhHiIlLqQpP',
 'Character': 'c',
 'Complex': 'FDG',
 'Float': 'fdg',
 'Integer': 'bhilqp',
 'UnsignedInteger': 'BHILQP'}