Plot Coordinates

Provides a fairly basictwo dimensional coordinate sytem.

exception TotalDepth.util.plot.Coord.ExceptionCoord

Exception class for representing Coordinates.

exception TotalDepth.util.plot.Coord.ExceptionCoordUnitConvert

Exception raised when converting units.

TotalDepth.util.plot.Coord.BASE_UNITS = 'px'

Base units for dimensions

TotalDepth.util.plot.Coord.UNIT_MAP = {'mm': 2.834645669291339, 'pt': 1.0, 'cm': 28.346456692913385, None: 1.0, 'px': 1.0, 'pc': 12.0, 'in': 72.0}

Map of {unit name : conversion factor to base units, ...}

TotalDepth.util.plot.Coord.units()

Returns the unsorted list of acceptable units.

TotalDepth.util.plot.Coord.convert(val, unitFrom, unitTo)

Convert a value from one set of units to another.

class TotalDepth.util.plot.Coord.Dim

Represents a dimension as an engineering value i.e. a number and units.

scale(factor)

Returns a new Dim() multiplied by a factor, units are unchanged.

divide(factor)

Returns a new Dim() divided by a factor, units are unchanged.

convert(u)

Returns a new Dim() with units changed and value converted.

__add__(other)

Overload self+other, returned result has the sum of self and other. The units chosen are self’s unless self’s units are None in which case other’s units are used (if not None).

__sub__(other)

Overload self-other, returned result has the difference of self and other. The units chosen are self’s unless self’s units are None in which case other’s units are used (if not None).

__iadd__(other)

Addition in place, value of other is converted to my units and added.

__isub__(other)

Subtraction in place, value of other is subtracted.

__lt__(other)

Returns true if self value < other value after unit conversion.

__le__(other)

Returns true if self value <= other value after unit conversion.

__eq__(other)

Returns true if self value == other value after unit conversion.

__ne__(other)

Returns true if self value != other value after unit conversion.

__gt__(other)

Returns true if self value > other value after unit conversion.

__ge__(other)

Returns true if self value >= other value after unit conversion.

TotalDepth.util.plot.Coord.dimIn(v)

Returns a Dim object with the value in inches.

class TotalDepth.util.plot.Coord.Box

A named tuple that describes a box with width and depth as Dim() objects.

__str__()

Stringifying.

class TotalDepth.util.plot.Coord.Pad

Padding around another object that forms the Bounding Box. All 4 attributes are Dim() objects

__str__()

Stringifying.

class TotalDepth.util.plot.Coord.Margin

Margin padding around another object. All 4 attributes are Coord.Dim() objects.

__str__()

Stringifying.

class TotalDepth.util.plot.Coord.Pt

A point, an absolute x/y position on the plot area. Members are Coord.Dim().

__eq__(other)

Comparison.

__str__()

Stringifying.

convert(u)

Returns a new Pt() with units changed and value converted.

scale(factor)

Returns a new Pt() scaled by a factor, units are unchanged.

TotalDepth.util.plot.Coord.baseUnitsDim(theLen)

Returns a Coord.Dim() of length and units BASE_UNITS.

TotalDepth.util.plot.Coord.zeroBaseUnitsDim()

Returns a Coord.Dim() of zero length and units BASE_UNITS.

TotalDepth.util.plot.Coord.zeroBaseUnitsBox()

Returns a Coord.Box() of zero dimensions and units BASE_UNITS.

TotalDepth.util.plot.Coord.zeroBaseUnitsPad()

Returns a Coord.Pad() of zero dimensions and units BASE_UNITS.

TotalDepth.util.plot.Coord.zeroBaseUnitsPt()

Returns a Coord.Dim() of zero length and units BASE_UNITS.

TotalDepth.util.plot.Coord.newPt(theP, incX=None, incY=None)

Returns a new Pt object by incrementing existing point incX, incY that are both Dim() objects or None.

TotalDepth.util.plot.Coord.convertPt(theP, theUnits)

Returns a new point with the dimensions of theP converted to theUnits.

Previous topic

Plot Package Reference

Next topic

Plot Pen Stroke

This Page