generated from mwc/lab_scatter
Kathryn Odell-Hamilton
Stopped working on section 2023.8.25 Within Unit 2, lab_scatter, I used the top-down method for planning_scatter.md, transform.py writing code to transform data with function, and build the scatter plot. I'm requesting assistance to complete several sections within transform.py and scatterplot.py files. Checkpoint 1 I believe I could write about a quarter or small segments of the code for the scatterplot.py, but would not be able to complete it without guidance from an instructor. The top-down method to break down the process of the scatterplot into small blocks was straight forward when thinking, planning, and writing it out. Honestly, I wouldn't know how to begin the scatterplot program without additional information and instruction from the instructor. It's abstract and frustrating. I don't have the background experience using Python. Checkpoint 2 From 2.1, minimum to 2.4, clamp, I understood how to and code the simple functions with transforming data. From 2.5, ratio to the end, 2.8, get_y_values, I was confused and lost. I felt the information provided was minimal, my perspective only. I could look back to the beginning information to use some of the strategies, but unable to complete these sections. I rewatched the videos and searched within Discord to see what issues if any my colleagues were faced with. There was little information online about transforming data with functions using def statements with only a return and not printing. More examples and explanation needed to be provided to better understand what was expected. Checkpoint 3 The program scatterplot.py is incomplete with the following: Find the scaled y-position for the point. Use draw_point(scaled_x, scaled_y, color, size) to draw the point. Also, it won't run correctly because transform.py file is incomplete. Sections 2.5, ratio to the end, 2.8, get_y_values I understood the scatterplot.py and how the data from the other files was imported into this program file. From Checkpoint 1, I would have still used the same format and structure. You could create programs to visualize data such at charts and diagrams.
This commit is contained in:
parent
5d29908f96
commit
b8d6ce9be7
|
@ -1,12 +1,27 @@
|
|||
# Planning the scatter plot
|
||||
|
||||
- from turtle import *
|
||||
- Draw a scatter plot.
|
||||
- Draw the axes.
|
||||
- Draw the x-axis.
|
||||
- Draw the line.
|
||||
- ...
|
||||
- Draw the horizontal line.
|
||||
- Draw 6 ticks (short dashed lines) touching beneath the baseline of x-axis at minimum to maximum
|
||||
location points "14 100 200 300 400 492" evenly spaced across at every 100.
|
||||
- Name x axis labels "14 100 200 300 400 492" centered underneath the x axis ticks.
|
||||
- Draw the y-axis.
|
||||
- Draw the line.
|
||||
- ...
|
||||
- Plot the points.
|
||||
- ...
|
||||
- Draw the vertical line.
|
||||
- Draw 6 ticks (short dashed lines) touching to the left side of the y-axis line at minimum to
|
||||
maximum location points "-927 0 1000 2000 3000 3710" evenly spaced across at every 1,000.
|
||||
- Name the y-axis labels to the left of the y axis ticks.
|
||||
- Plot the data points.
|
||||
Creating a visualization of graph with dots representing data points at x-y locations.
|
||||
- ?Determine the screen size
|
||||
- Set the x-axis value ranges from 14 to 492
|
||||
_ Set the y-axis value ranges from -927 to 3710
|
||||
- Define the "data_points" function
|
||||
- Set the dot style
|
||||
- Set the dot size
|
||||
- Set the dot color
|
||||
- Define a scatter function to plot the "x, y" data points
|
||||
- ? Set a function to show the plot
|
||||
|
|
@ -159,13 +159,13 @@ files = [
|
|||
|
||||
[[package]]
|
||||
name = "furo"
|
||||
version = "2023.7.26"
|
||||
version = "2023.8.19"
|
||||
description = "A clean customisable Sphinx documentation theme."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "furo-2023.7.26-py3-none-any.whl", hash = "sha256:1c7936929ec57c5ddecc7c85f07fa8b2ce536b5c89137764cca508be90e11efd"},
|
||||
{file = "furo-2023.7.26.tar.gz", hash = "sha256:257f63bab97aa85213a1fa24303837a3c3f30be92901ec732fea74290800f59e"},
|
||||
{file = "furo-2023.8.19-py3-none-any.whl", hash = "sha256:12f99f87a1873b6746228cfde18f77244e6c1ffb85d7fed95e638aae70d80590"},
|
||||
{file = "furo-2023.8.19.tar.gz", hash = "sha256:e671ee638ab3f1b472f4033b0167f502ab407830e0db0f843b1c1028119c9cd1"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
@ -285,13 +285,13 @@ files = [
|
|||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.15.1"
|
||||
version = "2.16.1"
|
||||
description = "Pygments is a syntax highlighting package written in Python."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"},
|
||||
{file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"},
|
||||
{file = "Pygments-2.16.1-py3-none-any.whl", hash = "sha256:13fc09fa63bc8d8671a6d247e1eb303c4b343eaee81d861f3404db2935653692"},
|
||||
{file = "Pygments-2.16.1.tar.gz", hash = "sha256:1daff0494820c69bc8941e407aa20f577374ee88364ee10a98fdbe0aece96e29"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
|
@ -331,24 +331,24 @@ files = [
|
|||
|
||||
[[package]]
|
||||
name = "soupsieve"
|
||||
version = "2.4.1"
|
||||
version = "2.5"
|
||||
description = "A modern CSS selector implementation for Beautiful Soup."
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "soupsieve-2.4.1-py3-none-any.whl", hash = "sha256:1c1bfee6819544a3447586c889157365a27e10d88cde3ad3da0cf0ddf646feb8"},
|
||||
{file = "soupsieve-2.4.1.tar.gz", hash = "sha256:89d12b2d5dfcd2c9e8c22326da9d9aa9cb3dfab0a83a024f05704076ee8d35ea"},
|
||||
{file = "soupsieve-2.5-py3-none-any.whl", hash = "sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7"},
|
||||
{file = "soupsieve-2.5.tar.gz", hash = "sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sphinx"
|
||||
version = "7.1.1"
|
||||
version = "7.2.5"
|
||||
description = "Python documentation generator"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "sphinx-7.1.1-py3-none-any.whl", hash = "sha256:4e6c5ea477afa0fb90815210fd1312012e1d7542589ab251ac9b53b7c0751bce"},
|
||||
{file = "sphinx-7.1.1.tar.gz", hash = "sha256:59b8e391f0768a96cd233e8300fe7f0a8dc2f64f83dc2a54336a9a84f428ff4e"},
|
||||
{file = "sphinx-7.2.5-py3-none-any.whl", hash = "sha256:9269f9ed2821c9ebd30e4204f5c2339f5d4980e377bc89cb2cb6f9b17409c20a"},
|
||||
{file = "sphinx-7.2.5.tar.gz", hash = "sha256:1a9290001b75c497fd087e92b0334f1bbfa1a1ae7fddc084990c4b7bd1130b88"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
@ -359,7 +359,7 @@ docutils = ">=0.18.1,<0.21"
|
|||
imagesize = ">=1.3"
|
||||
Jinja2 = ">=3.0"
|
||||
packaging = ">=21.0"
|
||||
Pygments = ">=2.13"
|
||||
Pygments = ">=2.14"
|
||||
requests = ">=2.25.0"
|
||||
snowballstemmer = ">=2.0"
|
||||
sphinxcontrib-applehelp = "*"
|
||||
|
@ -367,12 +367,12 @@ sphinxcontrib-devhelp = "*"
|
|||
sphinxcontrib-htmlhelp = ">=2.0.0"
|
||||
sphinxcontrib-jsmath = "*"
|
||||
sphinxcontrib-qthelp = "*"
|
||||
sphinxcontrib-serializinghtml = ">=1.1.5"
|
||||
sphinxcontrib-serializinghtml = ">=1.1.9"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinxcontrib-websupport"]
|
||||
lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"]
|
||||
test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"]
|
||||
test = ["cython (>=3.0)", "filelock", "html5lib", "pytest (>=4.6)", "setuptools (>=67.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "sphinx-basic-ng"
|
||||
|
@ -393,45 +393,54 @@ docs = ["furo", "ipython", "myst-parser", "sphinx-copybutton", "sphinx-inline-ta
|
|||
|
||||
[[package]]
|
||||
name = "sphinxcontrib-applehelp"
|
||||
version = "1.0.4"
|
||||
version = "1.0.7"
|
||||
description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "sphinxcontrib-applehelp-1.0.4.tar.gz", hash = "sha256:828f867945bbe39817c210a1abfd1bc4895c8b73fcaade56d45357a348a07d7e"},
|
||||
{file = "sphinxcontrib_applehelp-1.0.4-py3-none-any.whl", hash = "sha256:29d341f67fb0f6f586b23ad80e072c8e6ad0b48417db2bde114a4c9746feb228"},
|
||||
{file = "sphinxcontrib_applehelp-1.0.7-py3-none-any.whl", hash = "sha256:094c4d56209d1734e7d252f6e0b3ccc090bd52ee56807a5d9315b19c122ab15d"},
|
||||
{file = "sphinxcontrib_applehelp-1.0.7.tar.gz", hash = "sha256:39fdc8d762d33b01a7d8f026a3b7d71563ea3b72787d5f00ad8465bd9d6dfbfa"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
Sphinx = ">=5"
|
||||
|
||||
[package.extras]
|
||||
lint = ["docutils-stubs", "flake8", "mypy"]
|
||||
test = ["pytest"]
|
||||
|
||||
[[package]]
|
||||
name = "sphinxcontrib-devhelp"
|
||||
version = "1.0.2"
|
||||
description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document."
|
||||
version = "1.0.5"
|
||||
description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"},
|
||||
{file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"},
|
||||
{file = "sphinxcontrib_devhelp-1.0.5-py3-none-any.whl", hash = "sha256:fe8009aed765188f08fcaadbb3ea0d90ce8ae2d76710b7e29ea7d047177dae2f"},
|
||||
{file = "sphinxcontrib_devhelp-1.0.5.tar.gz", hash = "sha256:63b41e0d38207ca40ebbeabcf4d8e51f76c03e78cd61abe118cf4435c73d4212"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
Sphinx = ">=5"
|
||||
|
||||
[package.extras]
|
||||
lint = ["docutils-stubs", "flake8", "mypy"]
|
||||
test = ["pytest"]
|
||||
|
||||
[[package]]
|
||||
name = "sphinxcontrib-htmlhelp"
|
||||
version = "2.0.1"
|
||||
version = "2.0.4"
|
||||
description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "sphinxcontrib-htmlhelp-2.0.1.tar.gz", hash = "sha256:0cbdd302815330058422b98a113195c9249825d681e18f11e8b1f78a2f11efff"},
|
||||
{file = "sphinxcontrib_htmlhelp-2.0.1-py3-none-any.whl", hash = "sha256:c38cb46dccf316c79de6e5515e1770414b797162b23cd3d06e67020e1d2a6903"},
|
||||
{file = "sphinxcontrib_htmlhelp-2.0.4-py3-none-any.whl", hash = "sha256:8001661c077a73c29beaf4a79968d0726103c5605e27db92b9ebed8bab1359e9"},
|
||||
{file = "sphinxcontrib_htmlhelp-2.0.4.tar.gz", hash = "sha256:6c26a118a05b76000738429b724a0568dbde5b72391a688577da08f11891092a"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
Sphinx = ">=5"
|
||||
|
||||
[package.extras]
|
||||
lint = ["docutils-stubs", "flake8", "mypy"]
|
||||
test = ["html5lib", "pytest"]
|
||||
|
@ -452,30 +461,36 @@ test = ["flake8", "mypy", "pytest"]
|
|||
|
||||
[[package]]
|
||||
name = "sphinxcontrib-qthelp"
|
||||
version = "1.0.3"
|
||||
description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document."
|
||||
version = "1.0.6"
|
||||
description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"},
|
||||
{file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"},
|
||||
{file = "sphinxcontrib_qthelp-1.0.6-py3-none-any.whl", hash = "sha256:bf76886ee7470b934e363da7a954ea2825650013d367728588732c7350f49ea4"},
|
||||
{file = "sphinxcontrib_qthelp-1.0.6.tar.gz", hash = "sha256:62b9d1a186ab7f5ee3356d906f648cacb7a6bdb94d201ee7adf26db55092982d"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
Sphinx = ">=5"
|
||||
|
||||
[package.extras]
|
||||
lint = ["docutils-stubs", "flake8", "mypy"]
|
||||
test = ["pytest"]
|
||||
|
||||
[[package]]
|
||||
name = "sphinxcontrib-serializinghtml"
|
||||
version = "1.1.5"
|
||||
description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)."
|
||||
version = "1.1.9"
|
||||
description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
python-versions = ">=3.9"
|
||||
files = [
|
||||
{file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"},
|
||||
{file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"},
|
||||
{file = "sphinxcontrib_serializinghtml-1.1.9-py3-none-any.whl", hash = "sha256:9b36e503703ff04f20e9675771df105e58aa029cfcbc23b8ed716019b7416ae1"},
|
||||
{file = "sphinxcontrib_serializinghtml-1.1.9.tar.gz", hash = "sha256:0c64ff898339e1fac29abd2bf5f11078f3ec413cfe9c046d3120d7ca65530b54"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
Sphinx = ">=5"
|
||||
|
||||
[package.extras]
|
||||
lint = ["docutils-stubs", "flake8", "mypy"]
|
||||
test = ["pytest"]
|
||||
|
|
|
@ -35,6 +35,22 @@ def draw_scatterplot(data, size=5, color="black"):
|
|||
|
||||
def draw_axes(data):
|
||||
"Draws the scatter plot's axes."
|
||||
draw_x_axis()
|
||||
x_values = get_x_values(data)
|
||||
xmin, xmax = bounds(x_values)
|
||||
ticks = get_tick_values(xmin, xmax)
|
||||
for tick in ticks:
|
||||
screen_x_position = scale(tick, xmin, xmax, 0, constants.PLOT_WIDTH)
|
||||
draw_x_tick(screen_x_position, tick)
|
||||
|
||||
draw_y_axis()
|
||||
"Draws the scatter plot's axes."
|
||||
y_values = get_y_values(data)
|
||||
ymin, ymax = bounds(y_values)
|
||||
ticks = get_tick_values(ymin, ymax)
|
||||
for tick in ticks:
|
||||
screen_y_position = scale(tick, ymin, ymax, 0, constants.PLOT_WIDTH)
|
||||
draw_y_tick(screen_y_position, tick)
|
||||
|
||||
def draw_points(data, color, size):
|
||||
"Draws the scatter plot's points."
|
||||
|
|
58
transform.py
58
transform.py
|
@ -6,38 +6,80 @@
|
|||
|
||||
def maximum(data):
|
||||
"Returns the largest number in data"
|
||||
raise NotImplementedError
|
||||
largest = None
|
||||
for number in data:
|
||||
if largest is None:
|
||||
largest = number
|
||||
if number > largest:
|
||||
largest = number
|
||||
return largest
|
||||
|
||||
def minimum(data):
|
||||
"Returns the smallest number in data"
|
||||
raise NotImplementedError
|
||||
smallest = None
|
||||
for number in data:
|
||||
if smallest is None:
|
||||
smallest = number
|
||||
if number < smallest:
|
||||
smallest = number
|
||||
return smallest
|
||||
|
||||
def bounds(data):
|
||||
"Returns a list of the smallest and largest numbers in data"
|
||||
raise NotImplementedError
|
||||
smallest = None
|
||||
largest = None
|
||||
for numbers in data:
|
||||
if numbers < smallest:
|
||||
smallest = numbers
|
||||
elif numbers > largest:
|
||||
largest = numbers
|
||||
return smallest, largest
|
||||
|
||||
def clamp(value, low, high):
|
||||
"""Clamps a value to a range from low to high.
|
||||
Returns value if it is between low and high.
|
||||
If value is lower than low, returns low. If value is higher than high, returns high.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
if value < low:
|
||||
return low
|
||||
elif value > high:
|
||||
return high
|
||||
else:
|
||||
return value
|
||||
|
||||
def ratio(value, start, end):
|
||||
"""Returns a number from 0.0 to 1.0, representing how far along value is from start to end.
|
||||
The return value is clamped to [0, 1], so even if value is lower than start, the return
|
||||
value will not be lower than 0.0.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
"""??? Is this correct?"""
|
||||
value = (value - start) / (end - start)
|
||||
if value >= 0:
|
||||
return 0
|
||||
elif value <= 1.0:
|
||||
return 1.0
|
||||
else:
|
||||
return value
|
||||
|
||||
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
|
||||
|
||||
"""???? I'm unsure how to code def scale"""
|
||||
value = range_min + r * (range_max - range_min)
|
||||
|
||||
return value
|
||||
|
||||
def get_x_values(points):
|
||||
"Returns the first value for each point in points."
|
||||
raise NotImplementedError
|
||||
|
||||
"""???? I'm unsure how to code def get_x_values"""
|
||||
points = x_values
|
||||
return value
|
||||
|
||||
def get_y_values(points):
|
||||
"Returns the second value for each point in points."
|
||||
raise NotImplementedError
|
||||
|
||||
"""???? I'm unsure how to code def get_y_values"""
|
||||
points = y_values
|
||||
return value
|
||||
|
|
Loading…
Reference in New Issue