Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- # Create radar chart function for plotting the EEG metrics
- def create_radar_chart(values, labels, title):
- # Number of variables we're plotting.
- num_vars = len(labels)
- # Compute angle of each axis on the plot (360 degrees distributed over the number of variables).
- angles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist()
- # Repeat the first value to close the circular chart
- values += values[:1]
- angles += angles[:1]
- # Set up the radar plot
- fig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(polar=True))
- ax.fill(angles, values, color='blue', alpha=0.25)
- ax.plot(angles, values, color='blue', linewidth=2)
- # Labels for each axis
- ax.set_yticklabels([])
- ax.set_xticks(angles[:-1])
- ax.set_xticklabels(labels)
- # Add title and make it look nicer
- ax.set_title(title, size=20, color='black', y=1.1)
- plt.show()
- # Values and labels for each site (CZ, O1, F3, F4)
- cz_values = [8.0, 2.9, 5.6, 0.53, 8.2, 5.1, 5.7, 0.85, 10.1] # Example values for CZ
- o1_values = [7.9, 2.5, 4.8, 0.50, 8.0, 4.8, 5.0, 0.88, 9.8] # Example values for O1
- f3_values = [8.5, 3.0, 6.0, 0.54, 8.5, 5.0, 5.5, 0.90, 10.5] # Example values for F3
- f4_values = [8.3, 3.1, 6.2, 0.56, 8.4, 5.2, 5.8, 0.89, 10.3] # Example values for F4
- labels = ["Delta 2 Hz", "HiBeta Amplitude", "Beta Amplitude", "HiBeta/Beta",
- "Sum HiBeta + Beta", "LoAlpha Amplitude", "HiAlpha Amplitude",
- "LoAlpha/HiAlpha", "Alpha Peak Freq"]
- # Create radar charts for each site
- create_radar_chart(cz_values, labels, "CZ Site Radar Chart")
- create_radar_chart(o1_values, labels, "O1 Site Radar Chart")
- create_radar_chart(f3_values, labels, "F3 Site Radar Chart")
- create_radar_chart(f4_values, labels, "F4 Site Radar Chart")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement