-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotting.py
More file actions
44 lines (34 loc) · 1009 Bytes
/
plotting.py
File metadata and controls
44 lines (34 loc) · 1009 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import json
n = 4
with open('complex_vs_avg_degree.json') as f:
data = json.load(f)
N = data['N']
x = data['Ds']
y_labels = []
ys = []
for key in data["results"]:
y_labels.append(key)
ys.append(data["results"][key])
# Set the style
sns.set(style="whitegrid")
# Create the plot
plt.figure(figsize=(12, 8))
# Use a colormap
colors = sns.color_palette("husl", n)
# Plot each line with a legend
for i, y in enumerate(ys):
plt.plot(x, y, label=y_labels[i], color=colors[i], linewidth=2.5)
# Add titles and labels
plt.title("Variation of Complex Size with Degree (10,000 nodes)", fontsize=20)
plt.xlabel("AVg. Degree", fontsize=16)
plt.ylabel("Number of Edges/Nodes", fontsize=16)
# Customize the ticks
plt.xticks(fontsize=14)
plt.yticks(fontsize=14)
# Add legend
plt.legend(title="Legend", title_fontsize='13', fontsize='12')
# Show the plot
plt.savefig('complex_vs_avg_degree.png')