Giter Club home page Giter Club logo

psyc161's People

Contributors

mvdoc avatar yarikoptic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

psyc161's Issues

Turtles are very slow animals...

I'm running into trouble with the creation of a scatterplot with kiva data in section 8.15. act_kiva_graph_2 (Create a well scaled scatter plot with X and Y axes using num_lenders_total and loan_amount).
The turtle is painstakingly slow, regardless of the speed parameter, and drawing the loan_amount-num_lenders_total scatterplot fails due to a RunTime Error after the turtle finished the second dot.

This error occurs consistently: it happens in the sandbox, it happens if I build runestone locally from the pbs-psych161-wi19 branch, it happens if I build runestone locally from the current state of runestone/ac101.

The same code runs flawless locally in an ipython instance using Python 3.5:

import turtle
sc = turtle.Screen()
adina = turtle.Turtle()
adina.speed(10)
sc.setworldcoordinates(0, 0, max(num_lenders_total), max(loan_amount))

adina.penup()

for i in range(len(num_lenders_total)):
    adina.goto(num_lenders_total[i], loan_amount[i])
    adina.stamp()

A workaround for me was to scale the loan_amount variable, as this one was clearly responsible for giving my poor turtle a hard time (very long ways to walk for it). The following code works AND is also able to adjust the speed:

loan_amount_scale = [i/500 for i in loan_amount]

import turtle
sc = turtle.Screen()
adina = turtle.Turtle()
adina.speed(0)
sc.setworldcoordinates(0, 0, max(num_lenders_total), max(loan_amount_scale))

adina.penup()

for i in range(len(num_lenders_total)):
    adina.goto(num_lenders_total[i], loan_amount_scale[i])
    adina.stamp()

But I doubt that this is an optimal solution...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.