From fd4b33ae7e77de2561baacd68db105558380b992 Mon Sep 17 00:00:00 2001 From: mbrown Date: Fri, 14 Nov 2025 09:44:10 -0500 Subject: [PATCH] done with scatter --- .cd | 0 scatterplot.py | 32 +++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .cd diff --git a/.cd b/.cd new file mode 100644 index 0000000..e69de29 diff --git a/scatterplot.py b/scatterplot.py index 50f66fb..9359639 100644 --- a/scatterplot.py +++ b/scatterplot.py @@ -35,9 +35,39 @@ def draw_scatterplot(data, size=5, color="black"): def draw_axes(data): "Draws the scatter plot's axes." - + draw_x_axis() + xxx = get_x_values(data) + min, max = bounds(xxx) + ticks = get_tick_values(min, max) + for tick in ticks: + screen_x_position = scale(tick, min, max, 0, constants. PLOT_WIDTH) + draw_x_tick(screen_x_position,tick) + + + + draw_y_axis() + yyy = get_y_values(data) + min, max = bounds(yyy) + ticks = get_tick_values(min, max) + for tick in ticks: + screen_y_position = scale(tick, min, max, 0, constants. PLOT_WIDTH) + draw_y_tick(screen_y_position,tick) + + + + def draw_points(data, color, size): "Draws the scatter plot's points." + xmin,xmax=bounds(get_x_values(data)) + ymin,ymax=bounds(get_y_values(data)) + + for point in data: + x = point[0] + y = point[1] + x_scaled = scale(x, xmin, xmax, 0, constants.PLOT_WIDTH) + y_scaled = scale(y, ymin, ymax, 0, constants.PLOT_WIDTH) + print(f"Printing point onto screen at ({x_scaled},{y_scaled})") + draw_point(x_scaled, y_scaled, color, size) with no_delay(): data = generate_data(50, 10, 500, 5, 400, 1000)