0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

matplotlib でレーダーチャート

Last updated at Posted at 2018-08-23

基本は https://matplotlib.org/examples/api/radar_chart.html で良いのですが、
手元の環境、

$ python --version
Python 3.6.5 :: Anaconda, Inc.

$ pip list
matplotlib                         2.2.2

では、パッチが必要だったのでメモ。

--- radar_chart.py.org
+++ radar_chart.py
@@ -39,6 +39,7 @@
     theta = np.linspace(0, 2*np.pi, num_vars, endpoint=False)
     # rotate theta such that the first axis is at the top
     theta += np.pi/2
+    theta = np.where(theta > np.pi * 2, theta - np.pi*2, theta)
 
     def draw_poly_patch(self):
         verts = unit_poly_verts(theta)

時計回りの場合

    theta = np.linspace(np.pi/2, np.pi/2-2*np.pi, num_vars, endpoint=False)
    theta = np.where(theta < 0, theta + np.pi*2, theta)
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?