Graphing

25 views
Skip to first unread message

SaturnsRings

unread,
Oct 20, 2020, 3:22:00 PM10/20/20
to thonny
I'm a total beginner regarding Python graphing. Can we do graphing in Thonny?  Can someone give me or point me to a simple graphing program or tutorial to help me get started using matplotlib or numpy?   When I tried to run some code I found online, no errors were thrown but no graph was generated either (that I could see).  Is there a setting I need to adjust?  Contrarily, I am able to import turtle and create some designs in a popup window that way.

Thank you for your help.

Juan Falgueras

unread,
Oct 20, 2020, 7:16:38 PM10/20/20
to thonny
Here you have a nice house with turtle:

    # 07.casita.py
    # juanfc 2020-10-20

    import turtle
    t = turtle.Turtle()

    # fachada
    t.goto(200,0)
    t.goto(200,150)
    t.goto(0,150)
    t.goto(0,0)

    # techo
    t.goto(0,150)
    t.goto(100,200)
    t.goto(200,150)

    # chimenea
    t.goto(160,170)
    t.goto(160,190)
    t.goto(180,190)
    t.goto(180,160)

    # puerta
    t.pu()
    t.goto(80,0)
    t.pd()
    t.goto(80,50)
    t.goto(120,50)
    t.goto(120,0)

    # ventana 1
    x0 = 30
    y0 = 80
    t.pu()
    t.goto(x0,y0)
    t.pd()
    t.goto(x0,y0+40)
    t.goto(x0+40,y0+40)
    t.goto(x0+40,y0)
    t.goto(x0,y0)

    t.goto(x0+20,y0)
    t.goto(x0+20,y0+40)

    t.pu()
    t.goto(x0,y0+20)
    t.pd()
    t.goto(x0+40,y0+20)

    # ventana 2
    x0 = 130
    y0 = 80
    t.pu()
    t.goto(x0,y0)
    t.pd()
    t.goto(x0,y0+40)
    t.goto(x0+40,y0+40)
    t.goto(x0+40,y0)
    t.goto(x0,y0)

    t.goto(x0+20,y0)
    t.goto(x0+20,y0+40)

    t.pu()
    t.goto(x0,y0+20)
    t.pd()
    t.goto(x0+40,y0+20)

    t.pu()
    t.goto(110, 20)
    t.dot(5, "red")
    t.hideturtle()


    turtle.done()



--
Dr. Juan Falgueras
Profesor Universidad Málaga


Reply all
Reply to author
Forward
0 new messages