2021-02-08から1日間の記事一覧
plt.text(配置するx座標, 配置するy座標, 表示文字列, rotation=角度) import matplotlib.pyplot as plt x = [0, 3] y = [0, 3] plt.plot(x, y, color='black') plt.text(0, 2, 'abc') plt.text(1, 2, 'abc', rotation=45) plt.text(2, 1, 'abc', rotation=-…
4つの辺をそれぞれ直線のグラフで描く import matplotlib.pyplot as plt x = [0,1] y = [0,2] plt.plot(x, y, color='black') x = [0,2] y = [0,0] plt.plot(x, y, color='black') x = [1,2] y = [2,2] plt.plot(x, y, color='black') x = [2,2] y = [0,2] …
plt.axis('off')を入れる import matplotlib.pyplot as plt x = [0,1] y = [0,2] plt.plot(x, y) plt.axis('off') plt.show()
何も設定しないとx軸とy軸の目盛りの増分が違う import matplotlib.pyplot as plt x = [0,1] y = [0,2] plt.plot(x, y) plt.show() plt.axis('equal')を追加すると目盛りの増分が等しくなる import matplotlib.pyplot as plt x = [0,1] y = [0,2] plt.plot(x…
import matplotlib.pyplot as plt x = [1,2,3] y = [2,4,6] plt.plot(x, y) plt.savefig('a.png')