forked from Lephenixnoir/PythonExtra
meta: add turtle/matplotlib examples by Critor
This commit is contained in:
parent
b6efd9ed31
commit
9f860bd58a
|
@ -0,0 +1,7 @@
|
|||
from matplotl import *
|
||||
|
||||
x = [119.1, 119.3, 119.5, 119.6, 119.9, 120.0, 120.1, 120.3, 120.4]
|
||||
y = [1, 3, 4, 3, 1, 3, 1, 3, 1]
|
||||
|
||||
bar(x, y, 0.08)
|
||||
show()
|
|
@ -0,0 +1,23 @@
|
|||
import turtle
|
||||
from math import exp
|
||||
|
||||
def try_colormode(m):
|
||||
try: turtle.colormode(m)
|
||||
except: pass
|
||||
def try_pencolor(c):
|
||||
try: turtle.pencolor(c)
|
||||
except: pass
|
||||
try: turtle.color(c)
|
||||
except: pass
|
||||
|
||||
try_colormode(1)
|
||||
turtle.penup()
|
||||
turtle.goto(0, -20)
|
||||
turtle.pendown()
|
||||
for i in range(1,37):
|
||||
red=(exp(-0.5 * ((i-6)/12)**2))
|
||||
green=(exp(-0.5 * ((i-18)/12)**2))
|
||||
blue=(exp(-0.5 * ((i-30)/12)**2))
|
||||
try_pencolor([red,green,blue])
|
||||
turtle.circle(50-i)
|
||||
turtle.right(10)
|
Loading…
Reference in New Issue