Remrinのpython攻略日記

python3に入門しました。python3についてあれこれとサンプルコードとか。

2017-05-06から1日間の記事一覧

バーンスレイのシダ

○バーンスレイのシダ 4種類の変換をそれぞれ、85%、7%、7%、1%の確率で選んでいきます。 # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt def transform1(p): x, y = p[0], p[1] x1 = 0.85*x + 0.04*y y1 = -0.04*x + 0.85…

matplotlibでアニメーション

matplotlibでアニメーションを作ります。 # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.animation as ani def create_circle(): c1 = plt.Circle((0, 0), 0.5) return c1 def update_radius(i, c1): # i:フレーム番号 plt.cl…

matplotlibで図形

matplotlibで図形を描く方法。 plot()関数が呼ばれると背後でfigure()が呼ばれ、続いてaxes()が呼ばれてfigureの中に軸をつくる。 plot()関数を呼ばずにfigure()やaxes()で図、軸を設定できる。 import matplotlib.pyplot as plt c1 = plt.Circle((0, 0), ra…