-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_pylustrator.py
More file actions
43 lines (33 loc) · 957 Bytes
/
plot_pylustrator.py
File metadata and controls
43 lines (33 loc) · 957 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
# https://towardsdatascience.com/generate-easily-reproducible-scientific-figures-with-pylustrator-9426292e07a4
# Import packages
import matplotlib.pyplot as plt
import numpy as np
import pylustrator
# Use scientific plot style
#plt.style.use('scientific')
plt.style.use('C:\\Users\\rcxsm\\Documents\\pyhton_scripts\\scrientific.mplstyle')
# Create dummy data
x = np.linspace(0, 4*np.pi, 200)
y1 = np.sin(x)
y2 = np.cos(x)
# Start pylustrator
pylustrator.start()
# Create panelled figure
fig = plt.figure()
ax1 = fig.add_subplot(311)
ax2 = fig.add_subplot(312)
ax3 = fig.add_subplot(313)
# Plot data
# Subplot 1
ax1.plot(x, y1, label='y1')
ax1.plot(x, y2, label='y2')
ax1.legend()
# Subplot 2
ax2.plot(x, y1)
# Subplot 3
ax3.plot(x, y2)
#% start: automatic generated code from pylustrator
plt.figure(1).ax_dict = {ax.get_label(): ax for ax in plt.figure(1).axes}
import matplotlib as mpl
#% end: automatic generated code from pylustrator
plt.show()