-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDST_index_subplot.py
45 lines (39 loc) · 1.23 KB
/
DST_index_subplot.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
42
43
44
45
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib import gridspec
import numpy as np
import pandas as pd
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
import datetime
#initialize variables Main DST
y1 = pd.read_excel('Data/DST.xlsx')
customdate = datetime.datetime(2015, 3, 1, 0)
x1 = [customdate + datetime.timedelta(hours=i) for i in range(len(y1))]
#initialize variables Subplot DST
y2 = pd.read_excel('Data/DST_subplot.xlsx')
customdate = datetime.datetime(2015, 3, 15, 0)
x2 = [customdate + datetime.timedelta(hours=i) for i in range(len(y2))]
fig = plt.figure(figsize=(8, 5))
gs = gridspec.GridSpec(
2,
1,
# width_ratios=[1, 2],
# height_ratios=[2, 3]
)
#subplot main DST
ax = plt.subplot(gs[0])
formatter = mdates.DateFormatter('%d')
plt.gcf().axes[0].xaxis.set_major_formatter(formatter)
plt.plot(x1, y1, 'r', linewidth=0.75)
plt.ylabel('DST Index $(nT)$')
plt.grid(linestyle='-')
#subplot DST zoomin
ax2 = plt.subplot(gs[1])
formatter = mdates.DateFormatter('%d')
plt.gcf().axes[1].xaxis.set_major_formatter(formatter)
plt.plot(x2, y2, 'r', linewidth=0.75)
plt.xlabel('Maret 2015')
plt.ylabel('Indeks DST $(nT)$')
plt.grid(linestyle='-')
plt.show()