Skip to content

Commit 181ef9c

Browse files
committed
style: plot change figsize
1 parent 92f81f3 commit 181ef9c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

main.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
plt.rc('ytick', labelsize=SMALL) # font size of the tick labels
1818
plt.rc('legend', fontsize=SMALL) # legend font size
1919
plt.rc('figure', titlesize=BIGGER) # font size of the figure title
20+
plt.rcParams["font.family"] = "Times", "Times New Roman", "serif"
2021

2122

2223
# -------------------------------------------------------------------------
@@ -27,7 +28,7 @@ def save_plot():
2728
bottom = 0.1
2829
top = 0.9
2930
wspace = 0.2
30-
hspace = 0.3
31+
hspace = 0.21
3132

3233
plt.subplots_adjust(left, bottom, right, top, wspace, hspace)
3334
plt.savefig('result.jpg', bbox_inches='tight')
@@ -42,6 +43,7 @@ def set_signal(self, signal):
4243
self.signal = signal
4344

4445
def recurrence_plot(self, eps=0.10, steps=3):
46+
# Convert 1-D signal to 2-D signal
4547
_2d_array = self.signal[:, None]
4648

4749
# Pairwise distances
@@ -63,18 +65,23 @@ def setup_plot(self, cell=1, signal_name='Raw Signal', image_name='2D Image'):
6365

6466

6567
if __name__ == "__main__":
66-
plt.figure()
68+
fig = plt.figure(figsize=(8, 6))
6769

6870
rp = RecurrencePlot()
6971

7072
raw_signal = np.random.uniform(-1, 1, 50)
7173
convolved_signal = calculate_convolve(raw_signal)
7274
rp.set_signal(convolved_signal)
73-
rp.setup_plot(cell=1)
75+
76+
# cell value must be odd number
77+
# subplot 22(1,2)
78+
rp.setup_plot(cell=1, signal_name='First Signal')
7479

7580
raw_signal = np.random.uniform(-1, 1, 50)
7681
convolved_signal = calculate_convolve(raw_signal)
7782
rp.set_signal(convolved_signal)
78-
rp.setup_plot(cell=3)
83+
84+
# subplot 22(3,4)
85+
rp.setup_plot(cell=3, signal_name='Second Signal')
7986

8087
save_plot()

result.jpg

16 KB
Loading

0 commit comments

Comments
 (0)