Matplotlibのロゴがカッコ良いので、自分で出力できるように調べました。
この図は、極座標図と呼ばれる図で、Matplotlibの公式HPでも紹介されていました。
Matplotlib logo — Matplotlib 3.1.0 documentation
https://matplotlib.org/3.1.0/gallery/misc/logos2.html
上記サイトのソースコードで完全再現できるのですが、公式のコードがめちゃめちゃ長く、分析して自分のものに吸収しにくかったので、Matplotlibの極座標図の作り方を1から勉強してみました。
最短のソースコードは、大体こんなものになりました。
import numpy as np import matplotlib.pyplot as pltこれを出力すると、以下の図になります。1番シンプル。
x = 1.0 #プロットする値 [-] theta = 60 #プロット位置θ [度] # np.deg2radで[度]を[rad]に変換 theta_rad = np.deg2rad(theta) #プロット位置 [rad] #plt.plotではpolarは使えないので、plt.subplotで。 plt.subplot(polar="True") plt.scatter(theta_rad, x, color="red") plt.savefig("logo.png")plt.show()

コメント