generated from mwc/lab_scatter
It was too hard! It was really hard to understand what I was doing, and I had to stop multiple times. For example, I was not sure what constants.PLOT_WIDTH was. It took lots of time for me to understand I just read from the class website as well, and why we need certain codes that were provided by our professor. Sometimes, when something is already given, and I understand that it is easy to just use it, but it might make a student feel very uncertain about what we are doing in every step. I also had some struggle when I realize that I also need to have turtle scales, I named them as turtle_x and turtle_y. I thought turtle is a point, and why it needs a scale again since turtle is just a point (this is how I thought intially), I don't think we need to consider any scale, but I had to recall how we used 'forward whatever number, like forward 40' when we draw things with turtle, so I was able to accept that idea that we also need to consider a new scale for the turtle. It was very very hard. Hum, I don't think this is top-bottom process work, even though check point 1 was very top to bottom, but what we did with coding, there are many little peices needs to be done and all of them were put together to complete work. However, even though the top to bottom work should be designed with some consideration of the opposite, bottom to top, I think it is more like what is the more emphasized for each project or task, we often work on top to bottom and bottom to top together simultaneously, maybe it's just me? But I don't see myself to seperate one from another completely to do any work either it is math work or computer sicence or getting a quick grocery for a dinner party. Human brain and mind are not like computer, so shouldn't we use top to bottom and bottom to top together at the same time? Another Program? My brain hearts now, so I don't know. When I see the scatter plot image on my computer screen, I was wondering if I can do box and whisker using python program. Is it possible? :) Excel is doing a job, but scales are not so great. The represenation on the paper is not always pretty, sometimes there are so many emphty spaces around the box and whiskers. Maybe python will give me more felxibility to what parts I want to show only as a final result.
This commit is contained in:
parent
1f5e874b2f
commit
a20495c5fd
|
@ -35,9 +35,35 @@ 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()
|
||||
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_HEIGHT)
|
||||
draw_y_tick(screen_y_position, tick)
|
||||
|
||||
def draw_points(data, color, size):
|
||||
"Draws the scatter plot's points."
|
||||
x_values = get_x_values(data)
|
||||
xmin, xmax = bounds(x_values)
|
||||
y_values = get_y_values(data)
|
||||
ymin, ymax = bounds(y_values)
|
||||
|
||||
for point in data:
|
||||
turtle_x=scale(point[0], xmin, xmax,0, constants.PLOT_WIDTH)
|
||||
turtle_y=scale(point[1], ymin, ymax, 0, constants.PLOT_HEIGHT)
|
||||
draw_point(turtle_x, turtle_y, color, size)
|
||||
|
||||
|
||||
|
||||
with no_delay():
|
||||
data = generate_data(50, 10, 500, 5, 400, 1000)
|
||||
|
|
Loading…
Reference in New Issue