LinearScale
The LinearScale class maps a numeric value from a specified domain to an output range using a linear transformation.
pydreamplet.scales.LinearScale
Parameters
- domain(NumericPair): The input domain as a minimum and maximum value.
- output_range(NumericPair): The target output range.
from pydreamplet.scales import LinearScale
scale = LinearScale((0, 100), (0, 1))
print(scale.map(50))  # Output: 0.5
print(scale.invert(0.75))  # Output: 75.0
map
Scales a value from the domain to the output range.
invert
Maps a value from the output range back to the domain.
domain
Get or set the input domain.
output_range
Get or set the target output range.