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:
|
if value >= low and value <= high:
|
||||||
return value
|
return value
|
||||||
elif value > high:
|
elif value > high:
|
||||||
return "High" ,m
|
return "High" ,m
|
||||||
else:
|
else:
|
||||||
return "Low"
|
return "Low"
|
||||||
|
|
||||||
def ratio(value, start, end):
|
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):
|
def scale(value, domain_min, domain_max, range_min, range_max):
|
||||||
"Given a value within a domain, returns the scaled equivalent within range."
|
"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):
|
def get_x_values(points):
|
||||||
"Returns the first value for each point in points."
|
"Returns the first value for each point in points."
|
||||||
raise NotImplementedError
|
x_vals = points[0]
|
||||||
|
return x_vals
|
||||||
|
|
||||||
def get_y_values(points):
|
def get_y_values(points):
|
||||||
"Returns the second value for each point in points."
|
y_vals = points[1]
|
||||||
raise NotImplementedError
|
return y_vals
|
||||||
|
|
Loading…
Reference in New Issue