forked from NebulaTris/vibescape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
polarplot.py
31 lines (21 loc) · 889 Bytes
/
polarplot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import numpy as np
import matplotlib.pyplot as plt
import streamlit as st
def feature_plot(features):
labels= list(features)[:]
stats= features.mean().tolist()
angles=np.linspace(0, 2*np.pi, len(labels), endpoint=False)
# close the plot
stats=np.concatenate((stats,[stats[0]]))
angles=np.concatenate((angles,[angles[0]]))
#Size of the figure
fig=plt.figure(figsize = (18,18))
ax = fig.add_subplot(221, polar=True)
ax.plot(angles, stats, 'o-', linewidth=2, label = "Features", color= 'gray')
ax.fill(angles, stats, alpha=0.25, facecolor='gray')
ax.set_thetagrids(angles[0:7] * 180/np.pi, labels , fontsize = 13)
ax.set_rlabel_position(250)
plt.yticks([0.2 , 0.4 , 0.6 , 0.8 ], ["0.2",'0.4', "0.6", "0.8"], color="grey", size=12)
plt.ylim(0,1)
plt.legend(loc='best', bbox_to_anchor=(0.1, 0.1))
st.pyplot(plt)