generated from mwc/lab_scatter
Completed all functions for the turtle graphing exercise.
This commit is contained in:
parent
fc2336e978
commit
de61eded10
15
transform.py
15
transform.py
|
@ -34,9 +34,9 @@ def clamp(value, low, high):
|
|||
"""
|
||||
if value >= low and value <= high:
|
||||
return value
|
||||
elif value > high:
|
||||
elif value > high:
|
||||
return "High" ,m
|
||||
else:
|
||||
else:
|
||||
return "Low"
|
||||
|
||||
def ratio(value, start, end):
|
||||
|
@ -49,12 +49,15 @@ def ratio(value, start, end):
|
|||
|
||||
def scale(value, domain_min, domain_max, range_min, range_max):
|
||||
"Given a value within a domain, returns the scaled equivalent within range."
|
||||
raise NotImplementedError
|
||||
#raise NotImplementedError
|
||||
r = ratio(value, domain_min, domain_max)
|
||||
return range_min + r * (range_max - range_min)
|
||||
|
||||
def get_x_values(points):
|
||||
"Returns the first value for each point in points."
|
||||
raise NotImplementedError
|
||||
x_vals = points[0]
|
||||
return x_vals
|
||||
|
||||
def get_y_values(points):
|
||||
"Returns the second value for each point in points."
|
||||
raise NotImplementedError
|
||||
y_vals = points[1]
|
||||
return y_vals
|
||||
|
|
Loading…
Reference in New Issue