Last active
June 18, 2020 13:16
-
-
Save syaffers/97e4a88809d9b802ad8667f80d561437 to your computer and use it in GitHub Desktop.
Reading and plotting an example data from the 9 bus system data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
meta = pd.read_csv('metadata.csv', index_col='ID') | |
n = 693 | |
data = np.load(meta.loc[n, 'Filename']) | |
clearing_time = meta.loc[n, 'Clearing Time'] | |
fig, axs = plt.subplots(2, 2) | |
axs = axs.flatten() | |
for i, (data_type, data_matrix) in enumerate(data.items()): | |
axs[i].plot(data_matrix) | |
axs[i].set_title(data_type) | |
axs[i].set_xlim(0, 1000) | |
axs[i].set_ylim(axs[i].get_ylim()[0], axs[i].get_ylim()[1]) | |
axs[i].vlines(clearing_time, axs[i].get_ylim()[0], axs[i].get_ylim()[1], | |
linestyle='dotted') | |
plt.tight_layout() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment