Coordinate tranformations

QwtTransform

class qwt.transform.QwtTransform[source]

A transformation between coordinate systems

QwtTransform manipulates values, when being mapped between the scale and the paint device coordinate system.

A transformation consists of 2 methods:

  • transform

  • invTransform

where one is is the inverse function of the other.

When p1, p2 are the boundaries of the paint device coordinates and s1, s2 the boundaries of the scale, QwtScaleMap uses the following calculations:

p = p1 + (p2 - p1) * ( T(s) - T(s1) / (T(s2) - T(s1)) )
s = invT( T(s1) + ( T(s2) - T(s1) ) * (p - p1) / (p2 - p1) )
bounded(value)[source]

Modify value to be a valid value for the transformation. The default implementation does nothing.

transform(value)[source]

Transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

invTransform()

invTransform(value)[source]

Inverse transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

transform()

copy()[source]
Returns:

Clone of the transformation

The default implementation does nothing.

QwtNullTransform

class qwt.transform.QwtNullTransform[source]
transform(value)[source]

Transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

invTransform()

invTransform(value)[source]

Inverse transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

transform()

copy()[source]
Returns:

Clone of the transformation

QwtLogTransform

class qwt.transform.QwtLogTransform[source]

Logarithmic transformation

QwtLogTransform modifies the values using numpy.log() and numpy.exp().

Note

In the calculations of QwtScaleMap the base of the log function has no effect on the mapping. So QwtLogTransform can be used for logarithmic scale in base 2 or base 10 or any other base.

Extremum values:

  • QwtLogTransform.LogMin: Smallest allowed value for logarithmic scales: 1.0e-150

  • QwtLogTransform.LogMax: Largest allowed value for logarithmic scales: 1.0e150

bounded(value)[source]

Modify value to be a valid value for the transformation.

Parameters:

value (float) – Value to be bounded

Returns:

Value modified

transform(value)[source]

Transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

invTransform()

invTransform(value)[source]

Inverse transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

transform()

copy()[source]
Returns:

Clone of the transformation

QwtPowerTransform

class qwt.transform.QwtPowerTransform(exponent)[source]

A transformation using numpy.pow()

QwtPowerTransform preserves the sign of a value. F.e. a transformation with a factor of 2 transforms a value of -3 to -9 and v.v. Thus QwtPowerTransform can be used for scales including negative values.

transform(value)[source]

Transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

invTransform()

invTransform(value)[source]

Inverse transformation function

Parameters:

value (float) – Value

Returns:

Modified value

See also

transform()

copy()[source]
Returns:

Clone of the transformation