forked from cvg/glue-factory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestPlots.py
41 lines (31 loc) · 913 Bytes
/
testPlots.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
32
33
34
35
36
37
38
39
40
41
import scienceplots
import os
import datetime
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = False
import matplotlib as mpl
mpl.font_manager._rebuild()
# Apply the 'science' style
# plt.style.use('science')
plt.style.use(['science'])
# Simple data
x = [1, 2, 3]
y = [4, 5, 2]
# Create the plot
plt.plot(x, y, marker='o')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Simple Plot with SciencePlots')
# Create save directory if it doesn't exist
save_dir = '/homes/tp4618/Documents/bitbucket/SuperGlueThesis/external/glue-factory/plots/'
os.makedirs(save_dir, exist_ok=True)
# Create filename with current datetime
now = datetime.datetime.now()
filename = f'{now.strftime("%Y-%m-%d_%H-%M-%S")}_simple_plot.png'
save_path = os.path.join(save_dir, filename)
plt.show()
plt.tight_layout()
# Save the plot
plt.savefig(save_path)
# Print the save path
print(f"Plot saved to: {save_path}")