Coordinate tranformations — PythonQwt 0.14 Manual (original) (raw)
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) )
Modify value to be a valid value for the transformation. The default implementation does nothing.
Transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Inverse transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Returns:
Clone of the transformation
The default implementation does nothing.
QwtNullTransform¶
class qwt.transform.QwtNullTransform[source]¶
Transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Inverse transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Returns:
Clone of the transformation
QwtLogTransform¶
class qwt.transform.QwtLogTransform[source]¶
Logarithmic transformation
QwtLogTransform modifies the values using numpy.log() andnumpy.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
Modify value to be a valid value for the transformation.
Parameters:
value (float) – Value to be bounded
Returns:
Value modified
Transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Inverse transformation function
Parameters:
value (float) – Value
Returns:
Modified value
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 QwtPowerTransformcan be used for scales including negative values.
Transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Inverse transformation function
Parameters:
value (float) – Value
Returns:
Modified value
Returns:
Clone of the transformation