scatterplot.py

This commit is contained in:
njmason2
2025-10-12 18:24:23 -04:00
parent 1c4cee2704
commit 640ff70865
3 changed files with 43 additions and 16 deletions

View File

@@ -4,7 +4,6 @@
# The functions in this module transform data.
# None of them are finished; this is your job!
import sys
def maximum(data):
highest = None
@@ -49,8 +48,8 @@ def clamp(value, low, high):
return high
def ratio(value, start, end):
ratio = (value - start)/(end - start)
def ratio(value, domain_min, domain_max):
ratio = (value - domain_min)/(domain_max - domain_min)
return clamp(ratio,0,1)
@@ -61,12 +60,15 @@ def scale(value, domain_min, domain_max, range_min, range_max):
def get_x_values(points):
for (x, y) in points:
return ([x], )
x_values=[]
for ([x, y]) in points:
x_values.append(x)
return x_values
def get_y_values(points):
for (x, y) in points:
return ([y], )
y_values=[]
for ([x, y]) in points:
y_values.append(y)
return y_values